#[non_exhaustive]pub struct UserMessage {
pub content: UserContent,
pub cache: Option<CacheBreakpoint>,
pub provider_data: ProviderData,
pub app_data: ExtraMap,
}Expand description
User input.
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.content: UserContentText or multimodal content.
cache: Option<CacheBreakpoint>Marks the end of a cacheable prefix.
provider_data: ProviderDataProvider-specific data.
app_data: ExtraMapApplication data: never read by adapters or sent to a provider (see Application data).
Implementations§
Source§impl UserMessage
impl UserMessage
Sourcepub fn new(content: impl Into<UserContent>) -> Self
pub fn new(content: impl Into<UserContent>) -> Self
Create a user message.
Sourcepub fn text_segments(&self) -> impl Iterator<Item = &str>
pub fn text_segments(&self) -> impl Iterator<Item = &str>
Iterate over the text segments; see Message::text_segments.
Sourcepub fn text(&self) -> Option<String>
pub fn text(&self) -> Option<String>
Concatenated text, or None when there is none; see
Message::text.
Trait Implementations§
Source§impl Clone for UserMessage
impl Clone for UserMessage
Source§impl Debug for UserMessage
impl Debug for UserMessage
Source§impl<'de> Deserialize<'de> for UserMessage
impl<'de> Deserialize<'de> for UserMessage
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
impl Eq for UserMessage
Source§impl From<UserMessage> for Message
impl From<UserMessage> for Message
Source§fn from(value: UserMessage) -> Self
fn from(value: UserMessage) -> Self
Converts to this type from the input type.
Source§impl PartialEq for UserMessage
impl PartialEq for UserMessage
Source§impl Serialize for UserMessage
impl Serialize for UserMessage
impl StructuralPartialEq for UserMessage
Auto Trait Implementations§
impl Freeze for UserMessage
impl RefUnwindSafe for UserMessage
impl Send for UserMessage
impl Sync for UserMessage
impl Unpin for UserMessage
impl UnsafeUnpin for UserMessage
impl UnwindSafe for UserMessage
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