pub struct Message {
pub role: Role,
pub content: MessageContent,
pub id: Option<String>,
pub metadata: Option<MessageMetadata>,
}Fields§
§role: Role§content: MessageContent§id: Option<String>§metadata: Option<MessageMetadata>Implementations§
Source§impl Message
impl Message
pub fn user(content: impl Into<String>) -> Self
pub fn user_blocks(blocks: Vec<ContentBlock>) -> Self
pub fn assistant(content: impl Into<String>) -> Self
pub fn assistant_blocks(blocks: Vec<ContentBlock>) -> Self
pub fn system(content: impl Into<String>) -> Self
Sourcepub fn get_all_text(&self) -> String
pub fn get_all_text(&self) -> String
Collect all text content blocks into one concatenated string.
pub fn get_tool_use_blocks(&self) -> Vec<&ContentBlock>
pub fn has_tool_use(&self) -> bool
pub fn content_blocks(&self) -> Vec<ContentBlock>
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