#[non_exhaustive]pub enum Source {
Base64 {
media_type: String,
data: String,
},
Url {
url: String,
},
FileId {
id: String,
},
}Expand description
Source of an image or document content block.
Three forms cover the providers we ship adapters for today:
Base64carries the binary inline. Always works but inflates the request body and any persisted snapshot — preferUrlorFileIdfor large media.Urlpoints the provider at an external resource. Subject to the provider’s own fetch limits and accessibility rules.FileIdreferences a provider-side file (Anthropic Files Beta, OpenAI Files). Adapters that do not understand the id surface a typed error rather than degrading silently.
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.
Base64
Inline base64-encoded bytes.
Fields
Url
External URL the provider fetches.
FileId
Provider-side file ID (Anthropic Files Beta, OpenAI Files). The id is opaque to the adapter — the provider resolves it on its side.
Trait Implementations§
Source§impl<'de> Deserialize<'de> for Source
impl<'de> Deserialize<'de> for Source
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 Source
impl StructuralPartialEq for Source
Auto Trait Implementations§
impl Freeze for Source
impl RefUnwindSafe for Source
impl Send for Source
impl Sync for Source
impl Unpin for Source
impl UnsafeUnpin for Source
impl UnwindSafe for Source
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