Expand description
Core data model: content, messages, responses, and options.
This is the Rust equivalent of agent_framework._types.
Structs§
- Agent
Response - A full response from an agent run.
- Agent
Response Update - A single streaming chunk from an agent run.
- Annotation
- A citation annotation attached to content.
- Chat
Options - Common per-request settings for a chat/AI service.
- Chat
Response - A full (non-streaming) response from a chat client.
- Chat
Response Update - A single streaming chunk from a chat client.
- Code
Interpreter Tool Call Content - A provider-hosted code-interpreter tool call (the model’s request to run
code).
inputscarries the submitted code / files as nested content. - Code
Interpreter Tool Result Content - The result of a provider-hosted code-interpreter tool call.
outputscarries the produced logs / files as nested content. - Computer
Safety Check - A provider safety warning that must be reviewed before a computer call’s
actions are run (upstream
ComputerSafetyCheck,COMPUTER_USE). - Computer
Tool Call Content - A computer-use request from the model: an ordered list of UI actions for
the application to perform, plus any safety checks the application must
review (upstream
computer_tool_call, experimentalCOMPUTER_USE). - Computer
Tool Result Content - The application’s result for a
ComputerToolCallContent, after running its actions: usually a screenshot of the new state (upstreamcomputer_tool_result, experimentalCOMPUTER_USE). - Continuation
Token - An opaque, provider-issued token that resumes a background / long-running run where it left off.
- Data
Content - Inline binary data encoded as a
data:URI. - Embedding
- A single embedding vector with metadata.
- Embedding
Generation Options - Common request settings for embedding generation.
- Embedding
Input - One value to embed.
- Error
Content - A non-fatal error surfaced as content.
- Finish
Reason - Reason a chat response finished. Open value wrapper, like
FinishReason. - Function
Approval Request Content - A request to the user to approve a function call (human-in-the-loop).
- Function
Approval Response Content - A user’s response approving or denying a function call.
- Function
Call Content - A request from the model to call a tool/function.
- Function
Result Content - The result of executing a tool/function.
- Generated
Embeddings - A batch of generated embeddings plus usage metadata.
- Hosted
File Content - A reference to a file hosted by the service.
- Hosted
Vector Store Content - A reference to a vector store hosted by the service.
- McpServer
Tool Call Content - A provider-hosted MCP server tool call the service already routed to a
remote MCP server. Recorded for transcript fidelity; not a local function
invocation request (always
informational_only). - McpServer
Tool Result Content - The result of a provider-hosted MCP server tool call.
- Message
- A single chat message: an author role plus an ordered list of content items.
- Oauth
Consent Request Content - A request for the user to complete an OAuth consent flow (human-in-the-loop).
- Role
- The role of a message author.
- Shell
Command Output Content - The output of a single shell command execution.
- Shell
Tool Call Content - A shell tool call: the model’s request to run one or more shell commands. This is request metadata, not command output.
- Shell
Tool Result Content - The aggregate result of a shell tool call. Each per-command output is a
ShellCommandOutputContentcarried inoutputs. - Text
Content - Plain text content.
- Text
Reasoning Content - Reasoning / chain-of-thought text, distinct from user-facing text.
- Text
Span Region - An annotated region of text, addressed by index range.
- UriContent
- A reference to a remote resource by URI (not inline data).
- Usage
Content - Token usage carried inline as a content item.
- Usage
Details - Token usage counts for a request/response.
Enums§
- Annotation
Kind - The discriminator for an
Annotation. Upstream tags every annotation withtype: "citation"; this is the sole kind today. - Content
- The unified content union, discriminated by the
typetag. - Function
Arguments - Arguments to a function call: either a raw (possibly partial) string, or a parsed object.
- Operation
State - Where a resumable (background) operation stands, as reported by the update that carries it.
- Region
Coordinate Space - What an
Annotation’sannotated_regionsindex into. Upstream’sannotated_regions_coordinate_space. - Response
Format - The requested structured-output format for a response.
- Tool
Mode - If and how tools may be used for a request. Mirrors the Python
ToolMode.
Constants§
- FUNCTION_
INVOCATION_ ERROR_ MARKER - The marker a redacted
FunctionResultContent::exceptionserializes as. - MCP_
TOOL_ RESULT_ HOST_ PAYLOAD_ KEY - The
FunctionResultContent::additional_propertieskey under which an MCP tool keeps its fulltools/callresult (content blocks with their_meta,structuredContent, the result_meta) for the host (upstream_MCP_TOOL_RESULT_HOST_PAYLOAD_KEY).
Traits§
- Into
Messages - Trait for values that can be turned into a list of chat messages, so the
public API can accept
&str,String,Message, or vectors thereof — mirroring the Pythonstr | Message | list[...]unions.
Functions§
- prepare_
function_ call_ results - Serialize content(s) into a JSON string suitable for a tool result payload.
- prepare_
messages - Normalize loosely-typed input into a list of chat messages, optionally
prepending a system instruction. Mirrors
prepare_messages.