pub struct ChatMessage {
pub role: String,
pub content: MessageContent,
pub tool_calls: Vec<ToolCall>,
pub tool_call_id: Option<String>,
pub name: Option<String>,
pub thinking_steps: Vec<ThinkingStep>,
pub reasoning_content: String,
pub reasoning: String,
}Fields§
§role: String§content: MessageContent§tool_calls: Vec<ToolCall>Tool calls an assistant turn is requesting (OpenAI tool_calls).
tool_call_id: Option<String>For a tool role message: the id of the tool call this result answers.
name: Option<String>For a tool role message: the name of the tool that produced the result.
thinking_steps: Vec<ThinkingStep>Ordered solver-thinking projection attached to assistant answers.
reasoning_content: StringOpenAI-compatible reasoning text used by clients that display assistant reasoning in a standard message field.
reasoning: StringAlias consumed by some OpenAI-compatible clients for the same reasoning
text as reasoning_content.
Implementations§
Source§impl ChatMessage
impl ChatMessage
Sourcepub fn new(role: impl Into<String>, content: impl Into<String>) -> Self
pub fn new(role: impl Into<String>, content: impl Into<String>) -> Self
A message with the given role and plain-text content.
Sourcepub fn assistant_tool_calls(tool_calls: Vec<ToolCall>) -> Self
pub fn assistant_tool_calls(tool_calls: Vec<ToolCall>) -> Self
An assistant message requesting tool_calls (no textual content).
Sourcepub fn assistant_tool_calls_with_content(
content: impl Into<String>,
tool_calls: Vec<ToolCall>,
) -> Self
pub fn assistant_tool_calls_with_content( content: impl Into<String>, tool_calls: Vec<ToolCall>, ) -> Self
An assistant message that explains an action before requesting it.
Tool-capable protocol surfaces preserve both fields, so agentic clients can show the user what is about to happen while they execute the machine-readable call (issue #781).
Trait Implementations§
Source§impl Clone for ChatMessage
impl Clone for ChatMessage
Source§fn clone(&self) -> ChatMessage
fn clone(&self) -> ChatMessage
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
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
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>,
impl Eq for ChatMessage
Source§impl PartialEq for ChatMessage
impl PartialEq for ChatMessage
Source§impl Serialize for ChatMessage
impl Serialize for ChatMessage
impl StructuralPartialEq 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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.