Utility method for system prompt creation

This commit is contained in:
2026-01-15 21:36:33 +00:00
parent c797209b7d
commit 92cc558725

View File

@@ -24,6 +24,10 @@ impl Content {
}) })
} }
pub fn system_prompt<S: Into<String>>(system_prompt: S) -> Self {
Self::builder().add_text_part(system_prompt).build()
}
pub fn builder() -> ContentBuilder { pub fn builder() -> ContentBuilder {
ContentBuilder::default() ContentBuilder::default()
} }
@@ -127,13 +131,13 @@ pub enum PartData {
} }
impl Part { impl Part {
pub fn from_text(text: String) -> Self { pub fn from_text<S: Into<String>>(text: S) -> Self {
Self { Self {
thought: None, thought: None,
thought_signature: None, thought_signature: None,
part_metadata: None, part_metadata: None,
media_resolution: None, media_resolution: None,
data: PartData::Text(text), data: PartData::Text(text.into()),
} }
} }
} }