pub struct MultimodalMessage {
pub role: ChatRole,
pub parts: Vec<MediaPart>,
pub cache_marker: Option<CacheMarker>,
}Expand description
A multimodal message containing multiple parts (text, images, video, etc.)
Fields§
§role: ChatRoleMessage role
parts: Vec<MediaPart>Content parts (text, images, video, audio, documents)
cache_marker: Option<CacheMarker>Optional cache marker (for Anthropic caching)
Implementations§
Source§impl MultimodalMessage
impl MultimodalMessage
Sourcepub fn user_with_media(text: impl Into<String>, media: MediaPart) -> Self
pub fn user_with_media(text: impl Into<String>, media: MediaPart) -> Self
Create a user message with text and media
Sourcepub fn user_with_video(text: impl Into<String>, source: MediaSource) -> Self
pub fn user_with_video(text: impl Into<String>, source: MediaSource) -> Self
Create a user message with text and video
Sourcepub fn user_with_image(text: impl Into<String>, source: MediaSource) -> Self
pub fn user_with_image(text: impl Into<String>, source: MediaSource) -> Self
Create a user message with text and image
Sourcepub fn user_with_youtube(
text: impl Into<String>,
url: impl Into<String>,
) -> Self
pub fn user_with_youtube( text: impl Into<String>, url: impl Into<String>, ) -> Self
Create a user message with text and YouTube video
Sourcepub fn with_cache_marker(self, marker: CacheMarker) -> Self
pub fn with_cache_marker(self, marker: CacheMarker) -> Self
Add a cache marker
Trait Implementations§
Source§impl Clone for MultimodalMessage
impl Clone for MultimodalMessage
Source§fn clone(&self) -> MultimodalMessage
fn clone(&self) -> MultimodalMessage
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for MultimodalMessage
impl Debug for MultimodalMessage
Source§impl<'de> Deserialize<'de> for MultimodalMessage
impl<'de> Deserialize<'de> for MultimodalMessage
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<MultimodalMessage> for ConversationMessage
impl From<MultimodalMessage> for ConversationMessage
Source§fn from(msg: MultimodalMessage) -> Self
fn from(msg: MultimodalMessage) -> Self
Converts to this type from the input type.
Auto Trait Implementations§
impl Freeze for MultimodalMessage
impl RefUnwindSafe for MultimodalMessage
impl Send for MultimodalMessage
impl Sync for MultimodalMessage
impl Unpin for MultimodalMessage
impl UnsafeUnpin for MultimodalMessage
impl UnwindSafe for MultimodalMessage
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