pub struct ChatMessage {
pub role: String,
pub content: String,
pub tool_calls: Option<Vec<ToolCall>>,
pub tool_call_id: Option<String>,
}Expand description
A chat message in the OpenAI format. The tool fields are only set on the
host agentic loop: tool_calls on an assistant turn that calls tools,
tool_call_id on a tool-role message carrying a call’s result.
Fields§
§role: String§content: String§tool_calls: Option<Vec<ToolCall>>§tool_call_id: Option<String>Implementations§
Source§impl ChatMessage
impl ChatMessage
pub fn system(content: impl Into<String>) -> Self
pub fn user(content: impl Into<String>) -> Self
Sourcepub fn assistant_tool_calls(calls: Vec<ToolCall>) -> Self
pub fn assistant_tool_calls(calls: Vec<ToolCall>) -> Self
An assistant turn that requested tool calls (echoed back into the next request so the model sees its own calls before their results).
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 (const: unstable) · 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
Auto Trait Implementations§
impl Freeze for ChatMessage
impl RefUnwindSafe for ChatMessage
impl Send for ChatMessage
impl Sync for ChatMessage
impl Unpin for ChatMessage
impl UnsafeUnpin 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