#[non_exhaustive]pub enum Content {
Text(String),
ToolUse(ToolCall),
ToolResult(ToolResult),
Image(ImageRef),
}Expand description
A single content block within a Message.
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
Text(String)
Plain text.
ToolUse(ToolCall)
A tool invocation emitted by the model.
ToolResult(ToolResult)
The result of a prior Content::ToolUse, fed back to the model.
Image(ImageRef)
A reference to an image (HTTP URL or data: URI).
Implementations§
Source§impl Content
impl Content
Sourcepub fn text(s: impl Into<String>) -> Self
pub fn text(s: impl Into<String>) -> Self
Wraps s in a Content::Text variant.
Sourcepub fn tool_use(
id: impl Into<String>,
name: impl Into<String>,
args_json: impl Into<String>,
) -> Self
pub fn tool_use( id: impl Into<String>, name: impl Into<String>, args_json: impl Into<String>, ) -> Self
Constructs a Content::ToolUse block.
Sourcepub fn tool_use_signed(
id: impl Into<String>,
name: impl Into<String>,
args_json: impl Into<String>,
signature: Option<String>,
) -> Self
pub fn tool_use_signed( id: impl Into<String>, name: impl Into<String>, args_json: impl Into<String>, signature: Option<String>, ) -> Self
Constructs a Content::ToolUse block carrying an opaque
provider-specific signature (e.g. a thinking model’s thought
signature, which some providers require echoed back on the next
request that includes this call).
Sourcepub fn tool_result(
tool_call_id: impl Into<String>,
result_json: impl Into<String>,
is_error: bool,
first_party: bool,
) -> Self
pub fn tool_result( tool_call_id: impl Into<String>, result_json: impl Into<String>, is_error: bool, first_party: bool, ) -> Self
Constructs a Content::ToolResult block.
first_party is the ingestion-time provenance bit (see
ToolResult::first_party) — pass the caller’s already-computed
verdict (the static per-tool-name check for an ordinary tool, or the
worker-derived verdict for a __delegate_to result), not a fixed
default: the whole point of carrying this on ToolResult is that
the live same-turn taint scan needs the REAL per-call answer.