pub enum Message {
System {
content: String,
},
User {
content: String,
},
UserMultimodal {
content: Vec<ContentBlock>,
},
Assistant {
content: String,
tool_calls: Vec<ToolCall>,
},
ToolResult {
tool_use_id: String,
content: String,
},
ProviderOutputItems {
protocol: String,
items: Vec<Value>,
},
}Expand description
A message in a multi-turn conversation.
The System variant exists so callers can express a first-class
system prompt inside messages: Vec<Message> without threading it
through the legacy context: Option<String> field on the request.
Protocol handlers and local chat templates that have a native
system-role slot (OpenAI, Anthropic, Gemini, Gemma 4, Qwen) emit it
in the right place; ones that don’t can fold it into the first user
turn.
Variants§
System
A system prompt. Appears once, at the start of the conversation.
User
A user message (text only).
UserMultimodal
A user message with multimodal content (text + images + video + audio).
Fields
content: Vec<ContentBlock>Assistant
An assistant response, possibly with tool calls.
ToolResult
The result of executing a tool call.
ProviderOutputItems
Provider-specific output items that need to round-trip verbatim across turns. The OpenAI Responses API returns reasoning blobs, encrypted_content, web-search results, etc. as opaque structured items; the next request must include them in the same form to preserve provider-side state.
protocol identifies the provider format that produced the
items (currently "openai-responses"). Builder paths that
don’t recognize the protocol drop the variant — there is no
portable rendering across providers.