#[non_exhaustive]pub enum UserPart {
Text(TextPart),
Image(ImagePart),
File(FilePart),
}Expand description
A part of a user message.
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(TextPart)
Text.
Image(ImagePart)
An image; normalized to a file part with a detected media type during conversion.
File(FilePart)
A file with an explicit media type.
Implementations§
Source§impl UserPart
impl UserPart
Sourcepub fn image(source: impl Into<FileSource>) -> Self
pub fn image(source: impl Into<FileSource>) -> Self
An image from any source.
Sourcepub fn image_bytes(data: impl Into<Bytes>) -> Self
pub fn image_bytes(data: impl Into<Bytes>) -> Self
An image from inline bytes.
Sourcepub fn image_base64(data: impl Into<String>) -> Self
pub fn image_base64(data: impl Into<String>) -> Self
An image from base64 text.
Sourcepub fn file(
source: impl Into<FileSource>,
media_type: impl Into<MediaType>,
) -> Self
pub fn file( source: impl Into<FileSource>, media_type: impl Into<MediaType>, ) -> Self
A file from any source.
Sourcepub fn file_bytes(
data: impl Into<Bytes>,
media_type: impl Into<MediaType>,
) -> Self
pub fn file_bytes( data: impl Into<Bytes>, media_type: impl Into<MediaType>, ) -> Self
A file from inline bytes.
Sourcepub fn file_reference(
reference: ProviderReference,
media_type: impl Into<MediaType>,
) -> Self
pub fn file_reference( reference: ProviderReference, media_type: impl Into<MediaType>, ) -> Self
A file previously uploaded to providers.
Sourcepub fn file_text(
text: impl Into<String>,
media_type: impl Into<MediaType>,
) -> Self
pub fn file_text( text: impl Into<String>, media_type: impl Into<MediaType>, ) -> Self
An inline text document.
Sourcepub fn file_path(
path: impl Into<PathBuf>,
media_type: impl Into<MediaType>,
) -> Self
pub fn file_path( path: impl Into<PathBuf>, media_type: impl Into<MediaType>, ) -> Self
A file read from a local path during conversion.
Sourcepub fn with_filename(self, filename: impl Into<String>) -> Self
pub fn with_filename(self, filename: impl Into<String>) -> Self
Sets the filename on a file part (no effect on other parts).
Sourcepub fn with_provider_options(self, options: ProviderOptions) -> Self
pub fn with_provider_options(self, options: ProviderOptions) -> Self
Sets provider options.
Trait Implementations§
Source§impl<'de> Deserialize<'de> for UserPart
impl<'de> Deserialize<'de> for UserPart
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 StructuralPartialEq for UserPart
Auto Trait Implementations§
impl !Freeze for UserPart
impl RefUnwindSafe for UserPart
impl Send for UserPart
impl Sync for UserPart
impl Unpin for UserPart
impl UnsafeUnpin for UserPart
impl UnwindSafe for UserPart
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