pub enum AssistantContent {
Text(Text),
ToolCall(ToolCall),
Reasoning(Reasoning),
Image(Image),
}Expand description
Describes responses from a provider which is either text or a tool call.
Tagged with "type", exactly like UserContent. The tag is required on
deserialize — there is no fallback to the tagless shape 0.41 serialized,
so a bare {"text": …} block does not load; see MIGRATING for the
tag-insertion recipe.
Variants§
Text(Text)
Plain assistant text.
ToolCall(ToolCall)
Tool call requested by the assistant.
Reasoning(Reasoning)
Structured reasoning emitted by the assistant.
Image(Image)
Image content emitted by the assistant.
Implementations§
Source§impl AssistantContent
impl AssistantContent
Sourcepub fn text(text: impl Into<String>) -> AssistantContent
pub fn text(text: impl Into<String>) -> AssistantContent
Helper constructor to make creating assistant text content easier.
Sourcepub fn image_base64(
data: impl Into<String>,
media_type: Option<ImageMediaType>,
detail: Option<ImageDetail>,
) -> AssistantContent
pub fn image_base64( data: impl Into<String>, media_type: Option<ImageMediaType>, detail: Option<ImageDetail>, ) -> AssistantContent
Helper constructor to make creating assistant image content easier.
Sourcepub fn tool_call(
id: impl Into<String>,
name: impl Into<String>,
arguments: Value,
) -> AssistantContent
pub fn tool_call( id: impl Into<String>, name: impl Into<String>, arguments: Value, ) -> AssistantContent
Helper constructor to make creating assistant tool call content easier.
id is the provider-issued identifier when one exists; an empty
id records no provider id and mints the correlation handle.
Sourcepub fn tool_call_with_call_id(
id: impl Into<String>,
call_id: String,
name: impl Into<String>,
arguments: Value,
) -> AssistantContent
pub fn tool_call_with_call_id( id: impl Into<String>, call_id: String, name: impl Into<String>, arguments: Value, ) -> AssistantContent
Dual-identifier variant (OpenAI Responses): id is the output-item
handle (fc_…), call_id the correlator (call_…).
pub fn reasoning(reasoning: impl AsRef<str>) -> AssistantContent
Trait Implementations§
Source§impl Clone for AssistantContent
impl Clone for AssistantContent
Source§fn clone(&self) -> AssistantContent
fn clone(&self) -> AssistantContent
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more