#[non_exhaustive]pub enum UserContent {
Text(String),
Parts(Vec<UserContentPart>),
}Expand description
Content of a user message.
Either a plain string or an array of content parts (for multimodal input).
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
Non-exhaustive enums could have additional variants added in future. Therefore, when matching against variants of non-exhaustive enums, an extra wildcard arm must be added to account for any future variants.
Text(String)
Plain text content.
Parts(Vec<UserContentPart>)
Array of content parts (text, image, file).
Implementations§
Source§impl UserContent
impl UserContent
Sourcepub fn parts(parts: Vec<UserContentPart>) -> Self
pub fn parts(parts: Vec<UserContentPart>) -> Self
Create content from a list of parts.
Sourcepub fn image_url_with_detail(
url: impl Into<String>,
detail: ImageDetail,
) -> Self
pub fn image_url_with_detail( url: impl Into<String>, detail: ImageDetail, ) -> Self
Create content with a single image URL and detail level.
Trait Implementations§
Source§impl Clone for UserContent
impl Clone for UserContent
Source§fn clone(&self) -> UserContent
fn clone(&self) -> UserContent
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 UserContent
impl Debug for UserContent
Source§impl<'de> Deserialize<'de> for UserContent
impl<'de> Deserialize<'de> for UserContent
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 UserContent
Source§impl From<&str> for UserContent
impl From<&str> for UserContent
Source§impl From<String> for UserContent
impl From<String> for UserContent
Source§impl From<Vec<UserContentPart>> for UserContent
impl From<Vec<UserContentPart>> for UserContent
Source§fn from(parts: Vec<UserContentPart>) -> Self
fn from(parts: Vec<UserContentPart>) -> Self
Converts to this type from the input type.
Source§impl PartialEq for UserContent
impl PartialEq for UserContent
Source§impl Serialize for UserContent
impl Serialize for UserContent
impl StructuralPartialEq for UserContent
Auto Trait Implementations§
impl Freeze for UserContent
impl RefUnwindSafe for UserContent
impl Send for UserContent
impl Sync for UserContent
impl Unpin for UserContent
impl UnsafeUnpin for UserContent
impl UnwindSafe for UserContent
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key and return true if they are equal.