#[non_exhaustive]pub enum KnownBlock {
Text {
text: String,
cache_control: Option<CacheControl>,
citations: Option<Vec<Citation>>,
},
Image {
source: ImageSource,
cache_control: Option<CacheControl>,
},
Document {
source: DocumentSource,
title: Option<String>,
citations: Option<CitationConfig>,
cache_control: Option<CacheControl>,
},
ToolUse {
id: String,
name: String,
input: Value,
},
ToolResult {
tool_use_id: String,
content: ToolResultContent,
is_error: Option<bool>,
cache_control: Option<CacheControl>,
},
Thinking {
thinking: String,
signature: String,
},
RedactedThinking {
data: String,
},
ServerToolUse {
id: String,
name: String,
input: Value,
},
WebSearchToolResult {
tool_use_id: String,
content: Value,
},
}Expand description
All content block variants known to this SDK version.
#[non_exhaustive] so that adding a new variant in a future release
is not a breaking change for downstream match statements.
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
Text
Plain text content.
Fields
cache_control: Option<CacheControl>Optional cache breakpoint.
Image
An image embedded in the message.
Fields
source: ImageSourceWhere the image bytes come from.
cache_control: Option<CacheControl>Optional cache breakpoint.
Document
A document (e.g. PDF) embedded in the message.
Fields
source: DocumentSourceWhere the document bytes come from.
citations: Option<CitationConfig>Optional citation configuration for this document.
cache_control: Option<CacheControl>Optional cache breakpoint.
ToolUse
A model-emitted request to invoke a tool.
Fields
ToolResult
The result of a tool invocation, supplied back to the model.
Fields
tool_use_id: StringThe id of the KnownBlock::ToolUse this result corresponds to.
content: ToolResultContentThe tool’s output.
cache_control: Option<CacheControl>Optional cache breakpoint.
Thinking
Extended-thinking trace from the model.
Fields
RedactedThinking
A redacted thinking block; only the opaque blob is visible.
ServerToolUse
A server-side tool invocation initiated by the model.
Fields
WebSearchToolResult
The result of a server-side web_search invocation.
Fields
tool_use_id: StringThe id of the KnownBlock::ServerToolUse this result corresponds to.
Trait Implementations§
Source§impl Clone for KnownBlock
impl Clone for KnownBlock
Source§fn clone(&self) -> KnownBlock
fn clone(&self) -> KnownBlock
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for KnownBlock
impl Debug for KnownBlock
Source§impl<'de> Deserialize<'de> for KnownBlock
impl<'de> Deserialize<'de> for KnownBlock
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>,
Source§impl From<KnownBlock> for ContentBlock
impl From<KnownBlock> for ContentBlock
Source§fn from(k: KnownBlock) -> Self
fn from(k: KnownBlock) -> Self
Source§impl PartialEq for KnownBlock
impl PartialEq for KnownBlock
Source§impl Serialize for KnownBlock
impl Serialize for KnownBlock
impl StructuralPartialEq for KnownBlock
Auto Trait Implementations§
impl Freeze for KnownBlock
impl RefUnwindSafe for KnownBlock
impl Send for KnownBlock
impl Sync for KnownBlock
impl Unpin for KnownBlock
impl UnsafeUnpin for KnownBlock
impl UnwindSafe for KnownBlock
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more