pub struct Message {
pub native_tool_calls: Vec<NativeToolCall>,
pub role: MessageRole,
pub content: MessageContent,
pub tool_calls: Option<Vec<ToolCall>>,
pub tool_call_id: Option<String>,
pub phase: Option<ExecutionPhase>,
pub reasoning: Vec<ReasoningContentPart>,
pub configuration_update: Option<ReasoningEffort>,
}Expand description
Message format for LLM calls (provider-agnostic): the request-shaped view a driver turns into provider wire format. Distinct from the lossless stored runtime message, which the runtime conversion layer maps here.
Fields§
§native_tool_calls: Vec<NativeToolCall>Provider-native call identities, retained alongside portable fallbacks.
role: MessageRole§content: MessageContent§tool_calls: Option<Vec<ToolCall>>§tool_call_id: Option<String>§phase: Option<ExecutionPhase>Execution phase for assistant messages.
Helps models distinguish between intermediate working commentary (Commentary)
and completed answers (FinalAnswer) in multi-step tool-calling flows.
Only set on assistant messages. Must be preserved when replaying conversation history.
reasoning: Vec<ReasoningContentPart>Provider reasoning artifacts for this assistant turn, in emission order.
Drivers replay these verbatim in the position the provider issued them: each keeps its own signature, id and encrypted payload, so interleaved thinking and per-call thought signatures survive a round trip. Empty for messages without reasoning.
configuration_update: Option<ReasoningEffort>Astra effort transition immediately before this message. Other protocols ignore it; it is never rendered as conversation text.
Implementations§
Source§impl Message
impl Message
Sourcepub fn text(role: MessageRole, content: impl Into<String>) -> Self
pub fn text(role: MessageRole, content: impl Into<String>) -> Self
Create a message with text content
Sourcepub fn parts(role: MessageRole, parts: Vec<LlmContentPart>) -> Self
pub fn parts(role: MessageRole, parts: Vec<LlmContentPart>) -> Self
Create a message with content parts (text, images, audio)
Sourcepub fn content_as_text(&self) -> String
pub fn content_as_text(&self) -> String
Get content as plain text string (for simple cases)
Sourcepub fn prepend_text_prefix(&mut self, prefix: &str)
pub fn prepend_text_prefix(&mut self, prefix: &str)
Prepend a prefix to the first text content.
Used by ReasonAtom to inject external actor identity (e.g. "[Alice] ")
into user messages from external channels.
Sourcepub fn mark_turn_scoped_system(&mut self)
pub fn mark_turn_scoped_system(&mut self)
Mark this system message as scoped to the current model turn.