pub enum ContentBlock {
Text {
text: String,
cache_control: Option<CacheControl>,
},
ImageUrl {
image_url: ImageUrlContent,
},
Thinking {
thinking: String,
signature: Option<String>,
state: Option<OpaqueReasoningState>,
},
ToolUse {
id: String,
name: String,
input: Value,
caller: Option<ToolCaller>,
thought_signature: Option<String>,
},
ToolResult {
tool_use_id: String,
content: String,
is_error: Option<bool>,
content_blocks: Option<Vec<Value>>,
},
ServerToolUse {
id: String,
name: String,
input: Value,
},
ToolSearchToolResult {
tool_use_id: String,
content: Value,
},
CodeExecutionToolResult {
tool_use_id: String,
content: Value,
},
}Expand description
A single content block inside a message.
Variants§
Text
ImageUrl
Fields
§
image_url: ImageUrlContentThinking
Fields
§
signature: Option<String>Anthropic signed-thinking signature (#3014). Only populated on the native Messages dialect and serde-skipped when absent so OpenAI dialects are unaffected. Anthropic rejects tool loops that drop or modify signed thinking blocks, so replay this verbatim.
§
state: Option<OpaqueReasoningState>Opaque Responses-style continuity. Never synthesize this from the
readable thinking text or carry it across a route/model switch.
ToolUse
Fields
§
caller: Option<ToolCaller>ToolResult
Fields
ServerToolUse
ToolSearchToolResult
CodeExecutionToolResult
Implementations§
Source§impl ContentBlock
impl ContentBlock
Sourcepub fn thinking(thinking: impl Into<String>) -> ContentBlock
pub fn thinking(thinking: impl Into<String>) -> ContentBlock
Build readable reasoning with no provider-owned continuity state.
Trait Implementations§
Source§impl Clone for ContentBlock
impl Clone for ContentBlock
Source§fn clone(&self) -> ContentBlock
fn clone(&self) -> ContentBlock
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 ContentBlock
impl Debug for ContentBlock
Source§impl<'de> Deserialize<'de> for ContentBlock
impl<'de> Deserialize<'de> for ContentBlock
Source§fn deserialize<__D>(
__deserializer: __D,
) -> Result<ContentBlock, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(
__deserializer: __D,
) -> Result<ContentBlock, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Source§impl PartialEq for ContentBlock
impl PartialEq for ContentBlock
Source§impl Serialize for ContentBlock
impl Serialize for ContentBlock
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 ContentBlock
Auto Trait Implementations§
impl Freeze for ContentBlock
impl RefUnwindSafe for ContentBlock
impl Send for ContentBlock
impl Sync for ContentBlock
impl Unpin for ContentBlock
impl UnsafeUnpin for ContentBlock
impl UnwindSafe for ContentBlock
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