pub struct ChatMessage {
    pub role: String,
    pub content: Option<String>,
    pub tool_calls: Option<Vec<ToolCall>>,
    pub tool_call_id: Option<String>,
}Expand description
Represents a message in the chat history sequence sent to/from the AI.
This struct is used for all roles (system, user, assistant, tool)
within the conversation history managed by the Agent.
Optional fields are handled by serde during serialization/deserialization.
Fields§
§role: StringThe role of the message sender (e.g., “system”, “user”, “assistant”, “tool”).
content: Option<String>The text content of the message.
Present for system, user, and final assistant messages, and tool messages.
tool_calls: Option<Vec<ToolCall>>A list of tool calls requested by the assistant.
Only present for assistant messages that request tool execution.
tool_call_id: Option<String>The ID of the tool call this message is responding to.
Only present for tool messages.
Trait Implementations§
Source§impl Clone for ChatMessage
 
impl Clone for ChatMessage
Source§fn clone(&self) -> ChatMessage
 
fn clone(&self) -> ChatMessage
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
 
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from 
source. Read moreSource§impl Debug for ChatMessage
 
impl Debug for ChatMessage
Source§impl Default for ChatMessage
 
impl Default for ChatMessage
Source§fn default() -> ChatMessage
 
fn default() -> ChatMessage
Returns the “default value” for a type. Read more
Source§impl<'de> Deserialize<'de> for ChatMessage
 
impl<'de> Deserialize<'de> for ChatMessage
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>,
Deserialize this value from the given Serde deserializer. Read more
Auto Trait Implementations§
impl Freeze for ChatMessage
impl RefUnwindSafe for ChatMessage
impl Send for ChatMessage
impl Sync for ChatMessage
impl Unpin for ChatMessage
impl UnwindSafe for ChatMessage
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