pub struct ChatMessage {
pub role: ChatRole,
pub content: String,
pub tool_call_id: Option<String>,
pub name: Option<String>,
pub tool_calls: Vec<ToolCall>,
pub attachments: Vec<Attachment>,
}Fields§
§role: ChatRole§content: String§tool_call_id: Option<String>Present when role = Tool — matches the ToolCall.id that triggered this result.
name: Option<String>Present when role = Tool — the tool name.
tool_calls: Vec<ToolCall>Present when role = Assistant and the turn was a tool-call
request. Preserves {id, name, input} across history so the
Anthropic-Messages wire can re-emit tool_use blocks the
follow-up tool_result messages correlate against.
attachments: Vec<Attachment>Optional multi-modal attachments (images, eventually audio/video).
Providers that understand vision render these alongside content;
text-only providers ignore them.
Implementations§
Source§impl ChatMessage
impl ChatMessage
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
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 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