#[non_exhaustive]pub enum EmbeddingPart {
Text(Text),
Image(Image),
}Expand description
A part of an EmbeddingInput.
Unlike ContentPart, which keeps content it does not
recognize as Other, an embedding part is strict: an unknown type fails
to deserialize, because dropping a part would silently change the vector.
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
Text(Text)
Text.
Text::citations describe model output (ADR 0007) and are ignored on
embedding input. EmbeddingPart::text, EmbeddingInput::text, and
the From conversions clear them; a part built directly with
EmbeddingPart::Text(text) keeps them, and they then count for
equality, hashing, and serialization. Build parts through the
constructors when inputs are used as cache keys.
Image(Image)
An image, for models that report
EmbeddingCapability::ImageInput.
Image::detail is a hint no embedding API honors: adapters warn, or
fail under UnsupportedPolicy::Error.
Implementations§
Source§impl EmbeddingPart
impl EmbeddingPart
Sourcepub fn image_base64(
media_type: impl Into<String>,
data: impl Into<Base64Data>,
) -> Self
pub fn image_base64( media_type: impl Into<String>, data: impl Into<Base64Data>, ) -> Self
An image part from inline base64 data.
Sourcepub fn image_bytes(
media_type: impl Into<String>,
data: impl AsRef<[u8]>,
) -> Self
pub fn image_bytes( media_type: impl Into<String>, data: impl AsRef<[u8]>, ) -> Self
An image part from raw bytes, sent inline (base64-encoded).
Sourcepub fn provider_data(&self) -> &ProviderData
pub fn provider_data(&self) -> &ProviderData
The part’s provider data.