pub struct Message {
pub role: String,
pub content: Vec<ContentBlock>,
pub reasoning_content: Option<String>,
}Expand description
Message in conversation
Fields§
§role: String§content: Vec<ContentBlock>§reasoning_content: Option<String>Reasoning/thinking content from models like kimi-k2.5, DeepSeek-R1. Stored so it can be sent back in conversation history.
Implementations§
Source§impl Message
impl Message
pub fn user(text: &str) -> Self
Sourcepub fn user_with_attachments(text: &str, attachments: &[Attachment]) -> Self
pub fn user_with_attachments(text: &str, attachments: &[Attachment]) -> Self
Create a user message with text and image attachments.
pub fn tool_result(tool_use_id: &str, content: &str, is_error: bool) -> Self
Sourcepub fn tool_result_with_images(
tool_use_id: &str,
text: &str,
images: &[Attachment],
is_error: bool,
) -> Self
pub fn tool_result_with_images( tool_use_id: &str, text: &str, images: &[Attachment], is_error: bool, ) -> Self
Create a tool result message with multi-modal content (text + images).
Sourcepub fn tool_calls(&self) -> Vec<ToolCall>
pub fn tool_calls(&self) -> Vec<ToolCall>
Extract tool calls from message
Trait Implementations§
Source§impl<'de> Deserialize<'de> for Message
impl<'de> Deserialize<'de> for Message
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 Message
impl RefUnwindSafe for Message
impl Send for Message
impl Sync for Message
impl Unpin for Message
impl UnsafeUnpin for Message
impl UnwindSafe for Message
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