pub enum ContentBlock {
Text {
text: String,
citations: Option<Vec<Citation>>,
},
Image {
source: ImageSource,
},
Document {
source: DocumentSource,
},
ToolUse {
id: String,
name: String,
input: Value,
},
ToolResult {
tool_use_id: String,
content: Vec<ContentBlock>,
is_error: Option<bool>,
},
}Expand description
Content block types
Variants§
Implementations§
Source§impl ContentBlock
impl ContentBlock
Sourcepub fn image_base64(media_type: ImageMediaType, data: impl Into<String>) -> Self
pub fn image_base64(media_type: ImageMediaType, data: impl Into<String>) -> Self
Create an image content block from base64 data
Sourcepub fn image_url(url: impl TryInto<Url>) -> Result<Self, Error>
pub fn image_url(url: impl TryInto<Url>) -> Result<Self, Error>
Create an image content block from URL
Sourcepub fn tool_use(
id: impl Into<String>,
name: impl Into<String>,
input: impl Serialize,
) -> Result<Self, Error>
pub fn tool_use( id: impl Into<String>, name: impl Into<String>, input: impl Serialize, ) -> Result<Self, Error>
Create a tool use content block
Sourcepub fn document_base64(
media_type: DocumentMediaType,
data: impl Into<String>,
) -> Self
pub fn document_base64( media_type: DocumentMediaType, data: impl Into<String>, ) -> Self
Create a document content block from base64 data
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 · 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<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 Freeze for ContentBlock
impl RefUnwindSafe for ContentBlock
impl Send for ContentBlock
impl Sync for ContentBlock
impl Unpin 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