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§impl Debug for ChatMessage
impl Debug for ChatMessage
Auto Trait Implementations§
impl Forget for ChatMessage
impl Freeze for ChatMessage
impl Move 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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Source§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Convert
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can
then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.Source§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Convert
Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be
further downcast into Rc<ConcreteType> where ConcreteType implements Trait.Source§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
Convert
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.Source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
Convert
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.