pub enum AssistantContent {
Text(Text),
ToolCall(ToolCall),
Reasoning(Sealed<Reasoning>),
Image(Image),
}Expand description
Assistant text, tool calls, reasoning, or images.
Deserialization requires the lowercase type tag.
Variants§
Text(Text)
Plain assistant text.
ToolCall(ToolCall)
Tool call requested by the assistant.
Reasoning(Sealed<Reasoning>)
Structured reasoning emitted by the assistant, readable only by the service that issued it.
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
Creates assistant text content.
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
Creates assistant image content from base64-encoded data.
Sourcepub fn tool_call(
id: impl Into<String>,
name: ToolName,
arguments: Value,
) -> AssistantContent
pub fn tool_call( id: impl Into<String>, name: ToolName, arguments: Value, ) -> AssistantContent
Creates a tool call from a provider-issued ID, name, and arguments.
Rig issues an id when id is empty.
Sourcepub fn tool_call_with_call_id(
id: impl Into<String>,
call_id: String,
name: ToolName,
arguments: Value,
) -> AssistantContent
pub fn tool_call_with_call_id( id: impl Into<String>, call_id: String, name: ToolName, arguments: Value, ) -> AssistantContent
Dual-identifier variant (OpenAI Responses): id is the output-item
handle (fc_…), call_id the correlator (call_…).
Trait Implementations§
Source§impl Clone for AssistantContent
impl Clone for AssistantContent
Source§fn clone(&self) -> AssistantContent
fn clone(&self) -> AssistantContent
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
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<AssistantContent, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(
__deserializer: __D,
) -> Result<AssistantContent, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Source§impl From<AssistantContent> for Message
impl From<AssistantContent> for Message
Source§fn from(content: AssistantContent) -> Message
fn from(content: AssistantContent) -> Message
Converts to this type from the input type.
Source§impl From<AssistantContent> for AssistantContent
impl From<AssistantContent> for AssistantContent
Source§fn from(value: AssistantContent) -> AssistantContent
fn from(value: AssistantContent) -> AssistantContent
Converts to this type from the input type.
Source§impl From<AssistantContent> for AssistantContent
impl From<AssistantContent> for AssistantContent
Source§fn from(value: AssistantContent) -> AssistantContent
fn from(value: AssistantContent) -> AssistantContent
Converts to this type from the input type.
Source§impl From<String> for AssistantContent
impl From<String> for AssistantContent
Source§fn from(text: String) -> AssistantContent
fn from(text: String) -> AssistantContent
Converts to this type from the input type.
Source§impl PartialEq for AssistantContent
impl PartialEq for AssistantContent
Source§impl Serialize for AssistantContent
impl Serialize for AssistantContent
Source§fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
Serialize this value into the given Serde serializer. Read more
impl StructuralPartialEq for AssistantContent
Source§impl TryFrom<AssistantContent> for Part
impl TryFrom<AssistantContent> for Part
Source§type Error = MessageError
type Error = MessageError
The type returned in the event of a conversion error.
Source§fn try_from(
content: AssistantContent,
) -> Result<Part, <Part as TryFrom<AssistantContent>>::Error>
fn try_from( content: AssistantContent, ) -> Result<Part, <Part as TryFrom<AssistantContent>>::Error>
Performs the conversion.
Source§impl TryFrom<AssistantContent> for Content
impl TryFrom<AssistantContent> for Content
Source§type Error = MessageError
type Error = MessageError
The type returned in the event of a conversion error.
Source§fn try_from(
content: AssistantContent,
) -> Result<Content, <Content as TryFrom<AssistantContent>>::Error>
fn try_from( content: AssistantContent, ) -> Result<Content, <Content as TryFrom<AssistantContent>>::Error>
Performs the conversion.
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
Mutably borrows from an owned value. Read more
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> IntoToolOutput for Twhere
T: Serialize + 'static,
impl<T> IntoToolOutput for Twhere
T: Serialize + 'static,
Source§fn into_tool_output(self) -> Result<ToolOutput, ToolExecutionError>
fn into_tool_output(self) -> Result<ToolOutput, ToolExecutionError>
Convert this value without routing structured data through a string.