pub enum ContentBlock {
Text {
text: String,
cache_control: Option<CacheControl>,
},
Image {
source: ImageSource,
cache_control: Option<CacheControl>,
},
ToolUse {
id: String,
name: String,
input: Value,
},
ToolResult {
tool_use_id: String,
content: Value,
is_error: bool,
},
Document {
source: DocumentSource,
cache_control: Option<CacheControl>,
},
}Expand description
One entry in the content array of an Anthropic message.
Variants§
Text
Plain text block.
Image
Image block (base64 or URL source).
Fields
§
source: ImageSourceImage source (base64 or url).
§
cache_control: Option<CacheControl>Optional cache-control marker.
ToolUse
Model-issued tool call.
Fields
ToolResult
User-issued tool result corresponding to a previous tool_use.
Fields
Document
Document block (PDF, plain text).
Fields
§
source: DocumentSourceDocument source.
§
cache_control: Option<CacheControl>Optional cache-control marker.
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 PartialEq for ContentBlock
impl PartialEq for ContentBlock
Source§fn eq(&self, other: &ContentBlock) -> bool
fn eq(&self, other: &ContentBlock) -> bool
Tests for
self and other values to be equal, and is used by ==.Source§impl Serialize for ContentBlock
impl Serialize for ContentBlock
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