pub enum ContentBlock {
Text {
text: String,
},
Image {
source: ImageSource,
},
Document {
source: DocumentSource,
title: Option<String>,
},
ToolResult {
tool_use_id: String,
content: Vec<ContentBlock>,
is_error: Option<bool>,
},
}Expand description
Content block of a user message (Anthropic Messages API shape).
Variants§
Text
Plain text.
Image
An image.
Fields
§
source: ImageSourceWhere the image data comes from.
Document
A PDF or plain-text document.
Fields
§
source: DocumentSourceWhere the document data comes from.
ToolResult
The result of a tool call, answering a tool_use block.
Implementations§
Source§impl ContentBlock
impl ContentBlock
Sourcepub fn image_base64(
media_type: impl Into<String>,
data: impl Into<String>,
) -> Self
pub fn image_base64( media_type: impl Into<String>, data: impl Into<String>, ) -> Self
An image from base64 data; media_type e.g. “image/png”.
Sourcepub fn pdf_base64(data: impl Into<String>) -> Self
pub fn pdf_base64(data: impl Into<String>) -> Self
A PDF from base64 data.
Trait Implementations§
Source§impl Clone for ContentBlock
impl Clone for ContentBlock
Source§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<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::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
impl StructuralPartialEq for ContentBlock
Auto Trait Implementations§
impl Forget for ContentBlock
impl Freeze for ContentBlock
impl Move 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