pub enum Message {
System {
content: Arc<str>,
},
User {
content: Arc<str>,
},
Assistant {
content: Arc<str>,
tool_calls: Arc<[ToolCall]>,
},
ToolResult {
tool_call_id: Arc<str>,
name: Arc<str>,
content: Arc<str>,
},
Event {
source: Arc<str>,
kind: Arc<str>,
content: Arc<str>,
},
}Expand description
One turn of conversation history, preserving the structure a hosted adapter needs to reconstruct valid provider history: visible assistant text, the assistant’s tool calls, tool-call IDs, tool results, and external events.
Variants§
System
The system prompt: instructions framing the whole conversation.
User
A turn from the user.
Assistant
A turn generated by the model: its visible text and any tool calls it made, in the order the provider must replay them.
Fields
§
tool_calls: Arc<[ToolCall]>The tool calls this turn made, correlated to later results by
ToolCall::id.
ToolResult
The result of a previous ToolCall, correlated by tool_call_id.
Fields
§
tool_call_id: Arc<str>The ToolCall::id this result answers.
Event
An event from another system rather than the user.
Implementations§
Trait Implementations§
impl Eq for Message
Source§impl From<ModelMessage> for Message
impl From<ModelMessage> for Message
Source§fn from(message: ModelMessage) -> Self
fn from(message: ModelMessage) -> Self
Lift a core ModelMessage — a tool result
or an external event — into conversation history.
impl StructuralPartialEq for Message
Auto Trait Implementations§
impl Freeze for Message
impl RefUnwindSafe for Message
impl Send for Message
impl Sync for Message
impl Unpin for Message
impl UnsafeUnpin for Message
impl UnwindSafe for Message
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more