pub struct Message {
pub role: Role,
pub content: Vec<Content>,
}Expand description
A single turn in a conversation, composed of one or more Content parts.
Fields§
§role: RoleThe participant that produced this message.
content: Vec<Content>Ordered content blocks that make up the message body.
Implementations§
Source§impl Message
impl Message
Sourcepub fn user(text: impl Into<String>) -> Self
pub fn user(text: impl Into<String>) -> Self
Creates a Role::User message with a single Content::Text block.
Sourcepub fn assistant(text: impl Into<String>) -> Self
pub fn assistant(text: impl Into<String>) -> Self
Creates a Role::Assistant message with a single Content::Text block.
Sourcepub fn system(text: impl Into<String>) -> Self
pub fn system(text: impl Into<String>) -> Self
Creates a Role::System message with a single Content::Text block.
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