#[non_exhaustive]pub enum Block {
Text(String),
FileRef {
path: String,
hash: Option<String>,
excerpt: Option<String>,
},
Skill {
name: String,
body: String,
},
ToolCall {
call_id: String,
name: String,
args: Value,
},
ToolResult {
call_id: String,
content: Value,
},
Feedback(Vec<Signal>),
Reasoning(String),
Image {
media_type: String,
base64: String,
},
Audio {
media_type: String,
base64: String,
},
}Expand description
A single block of content within the assembled prompt.
Blocks are grouped so that long-stable prefixes (system + guides) stay cacheable across turns (“prompt caching” pattern).
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
Text(String)
Plain prompt text.
FileRef
Reference to a file in the world. The runtime decides whether to inline contents or hand the agent a tool call to read it.
Skill
Reference to an activated SKILL.md body.
ToolCall
A tool call the assistant requested.
ToolResult
The result of a previous tool call.
Feedback(Vec<Signal>)
Feedback signals from sensors, rendered for the model.
Reasoning(String)
Provider-specific reasoning trace (DeepSeek reasoning_content,
Anthropic thinking blocks). Must be echoed back to the provider on
subsequent calls or the API rejects the request.
Image
An inline image for vision-capable models. media_type is a MIME type
(e.g. "image/png", "image/jpeg"); base64 is the standard-base64
encoding of the raw image bytes. Each provider adapter renders this into
its own multimodal wire shape (OpenAI image_url data-URI, Anthropic
image/base64 source, Gemini inline_data).
Audio
Inline audio for models that listen. media_type is a MIME type (e.g.
"audio/wav", "audio/webm"); base64 is the standard-base64 encoding
of the raw audio bytes. Each provider adapter renders this into its own
wire shape (OpenAI input_audio with a bare format name, Gemini
inline_data).
This is what a transcript cannot carry: intonation, stress, whether two words ran together, whether a vowel was long. Speech transcribed to text before the model sees it has already lost the part a pronunciation judgement rests on.
Implementations§
Source§impl Block
impl Block
Sourcepub fn image_bytes(media_type: impl Into<String>, bytes: &[u8]) -> Self
pub fn image_bytes(media_type: impl Into<String>, bytes: &[u8]) -> Self
Build a Block::Image from raw image bytes, base64-encoding them.
media_type is a MIME type like "image/png".
Sourcepub fn audio_bytes(media_type: impl Into<String>, bytes: &[u8]) -> Self
pub fn audio_bytes(media_type: impl Into<String>, bytes: &[u8]) -> Self
Build a Block::Audio from raw audio bytes, base64-encoding them.
media_type is a MIME type like "audio/wav".