pub enum MessageContent {
Text {
text: String,
},
Thinking {
text: String,
signature: Option<String>,
},
ToolUse {
id: String,
name: String,
args: Value,
},
ToolResult {
tool_use_id: String,
output: ToolResultBody,
is_error: bool,
},
Image {
mime: String,
data: ImageData,
},
ProviderActivity {
provider_id: String,
kind: ProviderActivityKind,
payload: Value,
},
}Expand description
A piece of content inside a message body.
Both “the model requesting a tool call in the previous turn” and “the tool result
reported back in the current turn” are placed in the messages array, matching the
shape of the Anthropic Messages API. OpenAI uses separate assistant message with tool_calls + tool message; the codec translates between the two during encoding.
Variants§
Text
Thinking
The thinking chain produced by the model in the previous turn. Only present in
Role::Assistant messages.
signature is the anti-forgery signature for Anthropic extended thinking: it must
be kept together with the text. For providers that echo plain text (e.g.
DeepSeek-v4-pro), this is None.
ToolUse
Tool call from a previous turn: when sending a request, include both the prior
tool_use and tool_result in messages so the provider can reconstruct the
context.
ToolResult
Image
Multimodal input. (P2)
ProviderActivity
Provider-hosted capability activity (e.g. hosted web_search, hosted code
execution).
The agent does not interpret payload; it passes it through when retrying the
same
provider, or the codec decides how to degrade when switching providers.
payload uses #[serde(skip)]: it is dropped when persisting across processes;
on session resume, if the model re-triggers the same hosted call, a new hosted
call is made without relying on the old payload.
Trait Implementations§
Source§impl Clone for MessageContent
impl Clone for MessageContent
Source§fn clone(&self) -> MessageContent
fn clone(&self) -> MessageContent
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for MessageContent
impl Debug for MessageContent
Source§impl<'de> Deserialize<'de> for MessageContent
impl<'de> Deserialize<'de> for MessageContent
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Source§impl PartialEq for MessageContent
impl PartialEq for MessageContent
Source§fn eq(&self, other: &MessageContent) -> bool
fn eq(&self, other: &MessageContent) -> bool
self and other values to be equal, and is used by ==.