pub enum Content {
Text {
text: String,
citations: Vec<Citation>,
cache_control: Option<CacheControl>,
},
Image {
source: ImageSource,
cache_control: Option<CacheControl>,
},
ToolUse {
id: String,
name: String,
input: Value,
},
ServerToolUse {
id: String,
name: String,
input: Value,
},
WebSearchToolResult {
tool_use_id: String,
content: Value,
},
CodeExecutionToolResult {
tool_use_id: String,
content: Value,
},
ToolResult {
tool_use_id: String,
content: OneOrMany<ToolResultContent>,
is_error: Option<bool>,
cache_control: Option<CacheControl>,
},
Document {
source: DocumentSource,
title: Option<String>,
context: Option<String>,
citations: Option<CitationsConfig>,
cache_control: Option<CacheControl>,
},
Thinking {
thinking: String,
signature: Option<String>,
},
RedactedThinking {
data: String,
},
}Variants§
Text
Fields
§
citations: Vec<Citation>Citations returned by Claude pointing back into the source documents. Empty (and skipped during serialization) on request-side blocks.
§
cache_control: Option<CacheControl>Image
ToolUse
ServerToolUse
WebSearchToolResult
CodeExecutionToolResult
The result of an Anthropic-hosted code execution tool call.
ToolResult
Document
Fields
§
source: DocumentSource§
context: Option<String>Optional document context (e.g. metadata), passed to the model but
not citable. Useful for storing additional information about the
document that should not appear in citation cited_text.
§
citations: Option<CitationsConfig>Configuration for enabling citations on this document. When enabled
is true, Claude returns citation metadata on response text blocks
pointing back into this document’s content.
§
cache_control: Option<CacheControl>Thinking
RedactedThinking
Trait Implementations§
Source§impl<'de> Deserialize<'de> for Content
impl<'de> Deserialize<'de> for Content
Source§fn deserialize<__D>(
__deserializer: __D,
) -> Result<Content, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(
__deserializer: __D,
) -> Result<Content, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Source§impl Serialize for Content
impl Serialize for Content
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 Content
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(
text: AssistantContent,
) -> Result<Content, <Content as TryFrom<AssistantContent>>::Error>
fn try_from( text: AssistantContent, ) -> Result<Content, <Content as TryFrom<AssistantContent>>::Error>
Performs the conversion.
Source§impl TryFrom<Content> for AssistantContent
impl TryFrom<Content> for AssistantContent
Source§type Error = MessageError
type Error = MessageError
The type returned in the event of a conversion error.
Source§fn try_from(
content: Content,
) -> Result<AssistantContent, <AssistantContent as TryFrom<Content>>::Error>
fn try_from( content: Content, ) -> Result<AssistantContent, <AssistantContent as TryFrom<Content>>::Error>
Performs the conversion.
Auto Trait Implementations§
impl Freeze for Content
impl RefUnwindSafe for Content
impl Send for Content
impl Sync for Content
impl Unpin for Content
impl UnsafeUnpin for Content
impl UnwindSafe for Content
Blanket Implementations§
Source§impl<T> ArgumentConvert for Twhere
T: FromStr,
impl<T> ArgumentConvert for Twhere
T: FromStr,
Source§fn convert<'life0, 'async_trait>(
__arg0: impl CacheHttp + 'async_trait,
__arg1: Option<GuildId>,
__arg2: Option<ChannelId>,
s: &'life0 str,
) -> Pin<Box<dyn Future<Output = Result<T, <T as ArgumentConvert>::Err>> + Send + 'async_trait>>where
'life0: 'async_trait,
T: 'async_trait,
fn convert<'life0, 'async_trait>(
__arg0: impl CacheHttp + 'async_trait,
__arg1: Option<GuildId>,
__arg2: Option<ChannelId>,
s: &'life0 str,
) -> Pin<Box<dyn Future<Output = Result<T, <T as ArgumentConvert>::Err>> + Send + 'async_trait>>where
'life0: 'async_trait,
T: 'async_trait,
Parses a string
s as a command parameter of this type.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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneDebuggableStorage for Twhere
T: DebuggableStorage + Clone,
impl<T> CloneDebuggableStorage for Twhere
T: DebuggableStorage + Clone,
fn clone_storage(&self) -> Box<dyn CloneDebuggableStorage>
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> CloneableStorage for T
impl<T> CloneableStorage for T
fn clone_storage(&self) -> Box<dyn CloneableStorage>
impl<T> DebuggableStorage for T
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.