pub enum Message {
System(String),
User(MessageContent),
Assistant(String),
Tool {
tool_call_id: String,
content: String,
},
}Expand description
A message in a chat conversation.
Messages can be from the system (instructions), user (input), assistant (AI response), or tool (result from a tool execution).
Variants§
System(String)
System message providing instructions or context to the model.
User(MessageContent)
User message containing the user’s input (text or multimodal).
Assistant(String)
Assistant message containing the AI’s previous response.
Tool
Tool result message containing the output from a tool execution.
§Important: Message Order
The xAI gRPC API matches tool results to tool calls by message order, not by ID.
Tool results must be provided in the same order as the tool calls were received
from the model. The tool_call_id is accepted for API compatibility with other
providers (e.g., OpenAI) but is not used by xAI’s gRPC API.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Message
impl RefUnwindSafe for Message
impl Send for Message
impl Sync for Message
impl Unpin 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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
Source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
Wrap the input message
T in a tonic::Request