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>) -> Self
pub fn text(text: impl Into<String>) -> Self
Helper constructor to make creating assistant text content easier.
Sourcepub fn image_base64(
data: impl Into<String>,
media_type: Option<ImageMediaType>,
detail: Option<ImageDetail>,
) -> Self
pub fn image_base64( data: impl Into<String>, media_type: Option<ImageMediaType>, detail: Option<ImageDetail>, ) -> Self
Helper constructor to make creating assistant image content easier.
Sourcepub fn tool_call(
id: impl Into<String>,
name: impl Into<String>,
arguments: Value,
) -> Self
pub fn tool_call( id: impl Into<String>, name: impl Into<String>, arguments: Value, ) -> Self
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,
) -> Self
pub fn tool_call_with_call_id( id: impl Into<String>, call_id: String, name: impl Into<String>, arguments: Value, ) -> Self
Dual-identifier variant (OpenAI Responses): id is the output-item
handle (fc_…), call_id the correlator (call_…).
pub fn reasoning(reasoning: impl AsRef<str>) -> Self
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 moreSource§impl Debug for AssistantContent
impl Debug for AssistantContent
Source§impl<'de> Deserialize<'de> for AssistantContent
impl<'de> Deserialize<'de> for AssistantContent
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Source§impl From<AssistantContent> for Message
impl From<AssistantContent> for Message
Source§fn from(content: AssistantContent) -> Self
fn from(content: AssistantContent) -> Self
Source§impl From<AssistantContent> for AssistantContent
impl From<AssistantContent> for AssistantContent
Source§fn from(value: AssistantContent) -> Self
fn from(value: AssistantContent) -> Self
Source§impl From<AssistantContent> for AssistantContent
impl From<AssistantContent> for AssistantContent
Source§fn from(value: AssistantContent) -> Self
fn from(value: AssistantContent) -> Self
Source§impl From<String> for AssistantContent
impl From<String> for AssistantContent
Source§impl PartialEq for AssistantContent
impl PartialEq for AssistantContent
Source§impl Serialize for AssistantContent
impl Serialize for AssistantContent
impl StructuralPartialEq for AssistantContent
Source§impl TryFrom<AssistantContent> for Part
impl TryFrom<AssistantContent> for Part
Source§type Error = MessageError
type Error = MessageError
Source§impl TryFrom<AssistantContent> for Content
impl TryFrom<AssistantContent> for Content
Source§type Error = MessageError
type Error = MessageError
Auto Trait Implementations§
impl Freeze for AssistantContent
impl RefUnwindSafe for AssistantContent
impl Send for AssistantContent
impl Sync for AssistantContent
impl Unpin for AssistantContent
impl UnsafeUnpin for AssistantContent
impl UnwindSafe for AssistantContent
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more