pub struct Message {
pub role: Role,
pub content: Vec<Content>,
pub response_metadata: Option<ResponseMetadata>,
}Expand description
Conversation message with role and content blocks.
Fields§
§role: RoleRole of the message sender.
content: Vec<Content>Content blocks (text, images, tool use, tool results).
response_metadata: Option<ResponseMetadata>Provider-specific response metadata (safety ratings, grounding, citations).
Implementations§
Source§impl Message
impl Message
Sourcepub fn new(role: Role, text: impl Into<String>) -> Self
pub fn new(role: Role, text: impl Into<String>) -> Self
Create a new message with a single text content block.
Sourcepub fn with_content(role: Role, content: Vec<Content>) -> Self
pub fn with_content(role: Role, content: Vec<Content>) -> Self
Create a message with multiple content blocks.
Sourcepub fn with_metadata(
role: Role,
content: Vec<Content>,
metadata: ResponseMetadata,
) -> Self
pub fn with_metadata( role: Role, content: Vec<Content>, metadata: ResponseMetadata, ) -> Self
Create a message with content and metadata.
Trait Implementations§
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 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