#[non_exhaustive]pub struct Message {
pub role: Role,
pub parts: Vec<Part>,
}Expand description
One turn of a conversation: a role, and its parts in order.
Fields (Non-exhaustive)§
This struct is marked as non-exhaustive
Non-exhaustive structs could have additional fields added in future. Therefore, non-exhaustive structs cannot be constructed in external crates using the traditional
Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.role: RoleWho it is from.
parts: Vec<Part>What it says, in order.
Implementations§
Source§impl Message
impl Message
Sourcepub fn user(text: impl Into<String>) -> Self
pub fn user(text: impl Into<String>) -> Self
A user message with this text. Empty text adds no part, so Message::user("") followed
by images carries only the images.
Sourcepub fn assistant(text: impl Into<String>) -> Self
pub fn assistant(text: impl Into<String>) -> Self
A model message with this text, for example when replaying a stored conversation.
Sourcepub fn tool_result(result: ToolResult) -> Self
pub fn tool_result(result: ToolResult) -> Self
A message carrying the result of one tool call.
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
Source§impl From<Completion> for Message
impl From<Completion> for Message
Source§fn from(done: Completion) -> Self
fn from(done: Completion) -> Self
The model’s answer as the next request needs it: reasoning, text, then tool calls.
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