pub enum ModelContentBlock {
Text {
text: String,
},
Image {
media_type: String,
data: String,
},
Document {
media_type: String,
data: String,
title: Option<String>,
},
Thinking {
text: String,
signature: Option<String>,
provider: Option<String>,
},
RedactedThinking {
data: String,
provider: Option<String>,
},
ToolUse {
id: String,
name: String,
input: Value,
},
ToolResult {
tool_use_id: String,
content: String,
is_error: Option<bool>,
},
}Variants§
Text
Image
A base64-encoded image. Carries the same two fields the Anthropic API’s
source object needs, kept flat here because every provider that
supports images needs exactly these and nothing more.
data is not logged or Debug-printed usefully — it is megabytes of
base64. Anything that renders a message for humans or for a token
estimate must special-case this variant rather than falling through to
a generic text path.
Fields
Document
A base64-encoded document, PDF in practice. Like Image
its data is megabytes of base64 and must never be rendered as text.
Thinking
An extended-thinking block, with the signature that closed it if the provider sent one.
When thinking is enabled and the assistant’s turn contained tool use, the Anthropic API requires the previous assistant turn’s thinking blocks to be echoed back with their signatures on the following request. Blocks without a signature (reasoning from an OpenAI-compatible endpoint, or a relay that never sends one) are kept for the transcript and are never sent to the Anthropic API.
Fields
provider: Option<String>Model::provenance of the client that produced it.
RedactedThinking
Thinking the API chose to encrypt. Opaque to us; must still be echoed
back verbatim for the same reason as ModelContentBlock::Thinking.
ToolUse
ToolResult
Implementations§
Source§impl ModelContentBlock
impl ModelContentBlock
Sourcepub fn is_foreign_reasoning(&self, provenance: Option<&str>) -> bool
pub fn is_foreign_reasoning(&self, provenance: Option<&str>) -> bool
Reasoning another provider produced. Only that provider can verify or
use it, so it is never sent to provenance. Blocks without a recorded
provider, and requests to a client without one, are not foreign.