#[non_exhaustive]pub enum AssistantContent {
Text {
text: String,
},
ToolCall {
call: ToolCallRef,
},
Reasoning {
text: String,
signature: Option<String>,
},
Compaction {
content: String,
},
}Expand description
A single part of an assistant-produced content array.
Mirrors Claude’s wire format: text / tool_use / thinking / compaction
can appear in any order in a single assistant turn. #[non_exhaustive]
so provider-new block types can be added without semver break.
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
Non-exhaustive enums could have additional variants added in future. Therefore, when matching against variants of non-exhaustive enums, an extra wildcard arm must be added to account for any future variants.
Text
Plain text produced by the assistant.
ToolCall
A tool invocation requested by the assistant.
Fields
§
call: ToolCallRefReasoning
Reasoning / chain-of-thought block.
Compaction
Server-side compaction block.
Implementations§
Source§impl AssistantContent
impl AssistantContent
pub fn text(s: impl Into<String>) -> AssistantContent
pub fn tool_call(call: ToolCallRef) -> AssistantContent
pub fn as_text(&self) -> Option<&str>
pub fn as_tool_call(&self) -> Option<&ToolCallRef>
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 PartialEq for AssistantContent
impl PartialEq for AssistantContent
Source§fn eq(&self, other: &AssistantContent) -> bool
fn eq(&self, other: &AssistantContent) -> bool
Tests for
self and other values to be equal, and is used by ==.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
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