pub enum BlockContent {
Message {
role: Role,
parts: Vec<ContentPart>,
},
ToolCall(ToolCallPayload),
ToolResult(ToolResultPayload),
ToolChange(ToolChange),
}Expand description
The content shape of a block. Four shapes: one message’s ordered parts (any role), a tool call, a tool result, a change to the offered tools.
Exhaustive on purpose: a renderer must handle every shape, so a new one is a breaking change that should stop downstream code from compiling.
Variants§
Message
One logical message’s ordered content parts (text, media references, or sealed wire items) and the role that produced them — atomic at the block: one identity, one content identity; execution pairing is enforced by specialized append operations rather than by importing arbitrary facts.
ToolCall(ToolCallPayload)
A model-issued tool invocation.
ToolResult(ToolResultPayload)
The recorded outcome of a prior call, paired by
ToolResultPayload::call_block_id.
ToolChange(ToolChange)
The tools offered to the model change from this position on. The first one in a context declares the initial set.
Implementations§
Source§impl BlockContent
impl BlockContent
Sourcepub fn text(role: Role, text: impl Into<String>) -> Self
pub fn text(role: Role, text: impl Into<String>) -> Self
Constructs a BlockContent::Message containing a single ContentPart::Text.