pub struct Message {
pub role: Role,
pub blocks: Vec<ContentBlock>,
}Expand description
Fields§
§role: Role§blocks: Vec<ContentBlock>Implementations§
Source§impl Message
impl Message
pub fn system(text: impl Into<String>) -> Self
pub fn user(text: impl Into<String>) -> Self
pub fn assistant(text: impl Into<String>) -> Self
pub fn tool(result: ToolResult) -> Self
pub fn tool_results(results: Vec<ToolResult>) -> Self
pub fn text(role: Role, text: impl Into<String>) -> Self
pub fn text_content(&self) -> String
pub fn thinking_content(&self) -> String
pub fn tool_calls(&self) -> impl Iterator<Item = &ToolCall>
pub fn tool_results_iter(&self) -> impl Iterator<Item = &ToolResult>
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
impl StructuralPartialEq for Message
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