#[non_exhaustive]pub enum ContentBlock {
Show 14 variants
Text(TextBlock),
ToolUse(ToolUseBlock),
ToolResult(ToolResultBlock),
Reasoning(ReasoningBlock),
CachePoint(CachePointBlock),
GuardContent(GuardContentBlock),
Audio(AudioBlock),
Image(ImageBlock),
Video(VideoBlock),
Document(DocumentBlock),
Citations(CitationsBlock),
Injected(InjectedBlock),
Summary(SummaryBlock),
Unknown(UnknownBlock),
}Expand description
A block of content within a message (ContentBlock).
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
Non-exhaustive enums could have additional variants added in future. Therefore, when matching against variants of non-exhaustive enums, an extra wildcard arm must be added to account for any future variants.
Text(TextBlock)
Plain text, {"text": "..."}.
ToolUse(ToolUseBlock)
A tool use request, {"toolUse": {...}}.
ToolResult(ToolResultBlock)
A tool result, {"toolResult": {...}}.
Reasoning(ReasoningBlock)
Model reasoning, {"reasoning": {...}}.
CachePoint(CachePointBlock)
A prompt cache point, {"cachePoint": {...}}.
GuardContent(GuardContentBlock)
Content for guardrail evaluation, {"guardContent": {...}}.
Audio(AudioBlock)
Audio, {"audio": {...}}.
Image(ImageBlock)
An image, {"image": {...}}.
Video(VideoBlock)
A video, {"video": {...}}.
Document(DocumentBlock)
A document, {"document": {...}}.
Citations(CitationsBlock)
Citations, {"citations": {...}}.
Injected(InjectedBlock)
Text the app adds to a user turn, {"injected": {...}}.
Summary(SummaryBlock)
A summary of earlier history, {"summary": {...}}.
Unknown(UnknownBlock)
A block of a type this version does not recognize, kept unchanged.
Implementations§
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<'de>>(deserializer: D) -> Result<Self, D::Error>
fn deserialize<D: Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error>
Deserialize this value from the given Serde deserializer. Read more
Source§impl From<&str> for ContentBlock
impl From<&str> for ContentBlock
Source§impl From<AudioBlock> for ContentBlock
impl From<AudioBlock> for ContentBlock
Source§fn from(block: AudioBlock) -> Self
fn from(block: AudioBlock) -> Self
Converts to this type from the input type.
Source§impl From<CachePointBlock> for ContentBlock
impl From<CachePointBlock> for ContentBlock
Source§fn from(block: CachePointBlock) -> Self
fn from(block: CachePointBlock) -> Self
Converts to this type from the input type.
Source§impl From<CitationsBlock> for ContentBlock
impl From<CitationsBlock> for ContentBlock
Source§fn from(block: CitationsBlock) -> Self
fn from(block: CitationsBlock) -> Self
Converts to this type from the input type.
Source§impl From<ContentBlock> for MockTurn
impl From<ContentBlock> for MockTurn
Source§fn from(block: ContentBlock) -> Self
fn from(block: ContentBlock) -> Self
Converts to this type from the input type.
Source§impl From<DocumentBlock> for ContentBlock
impl From<DocumentBlock> for ContentBlock
Source§fn from(block: DocumentBlock) -> Self
fn from(block: DocumentBlock) -> Self
Converts to this type from the input type.
Source§impl From<GuardContentBlock> for ContentBlock
impl From<GuardContentBlock> for ContentBlock
Source§fn from(block: GuardContentBlock) -> Self
fn from(block: GuardContentBlock) -> Self
Converts to this type from the input type.
Source§impl From<ImageBlock> for ContentBlock
impl From<ImageBlock> for ContentBlock
Source§fn from(block: ImageBlock) -> Self
fn from(block: ImageBlock) -> Self
Converts to this type from the input type.
Source§impl From<InjectedBlock> for ContentBlock
impl From<InjectedBlock> for ContentBlock
Source§fn from(block: InjectedBlock) -> Self
fn from(block: InjectedBlock) -> Self
Converts to this type from the input type.
Source§impl From<ReasoningBlock> for ContentBlock
impl From<ReasoningBlock> for ContentBlock
Source§fn from(block: ReasoningBlock) -> Self
fn from(block: ReasoningBlock) -> Self
Converts to this type from the input type.
Source§impl From<String> for ContentBlock
impl From<String> for ContentBlock
Source§impl From<SummaryBlock> for ContentBlock
impl From<SummaryBlock> for ContentBlock
Source§fn from(block: SummaryBlock) -> Self
fn from(block: SummaryBlock) -> Self
Converts to this type from the input type.
Source§impl From<TextBlock> for ContentBlock
impl From<TextBlock> for ContentBlock
Source§impl From<ToolResultBlock> for ContentBlock
impl From<ToolResultBlock> for ContentBlock
Source§fn from(block: ToolResultBlock) -> Self
fn from(block: ToolResultBlock) -> Self
Converts to this type from the input type.
Source§impl From<ToolUseBlock> for ContentBlock
impl From<ToolUseBlock> for ContentBlock
Source§fn from(block: ToolUseBlock) -> Self
fn from(block: ToolUseBlock) -> Self
Converts to this type from the input type.
Source§impl From<UnknownBlock> for ContentBlock
impl From<UnknownBlock> for ContentBlock
Source§fn from(block: UnknownBlock) -> Self
fn from(block: UnknownBlock) -> Self
Converts to this type from the input type.
Source§impl From<VideoBlock> for ContentBlock
impl From<VideoBlock> for ContentBlock
Source§fn from(block: VideoBlock) -> Self
fn from(block: VideoBlock) -> Self
Converts to this type from the input type.
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 !RefUnwindSafe for ContentBlock
impl !UnwindSafe for ContentBlock
impl Freeze for ContentBlock
impl Send for ContentBlock
impl Sync for ContentBlock
impl Unpin for ContentBlock
impl UnsafeUnpin 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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
§impl<T> FutureExt for T
impl<T> FutureExt for T
§fn with_context(self, otel_cx: Context) -> WithContext<Self> ⓘ
fn with_context(self, otel_cx: Context) -> WithContext<Self> ⓘ
§fn with_current_context(self) -> WithContext<Self> ⓘ
fn with_current_context(self) -> WithContext<Self> ⓘ
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> 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> ⓘ
Converts
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> ⓘ
Converts
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 moreCreates a shared type from an unshared type.