ImageEmbeddingModel

Trait ImageEmbeddingModel 

Source
pub trait ImageEmbeddingModel:
    Clone
    + Sync
    + Send {
    const MAX_DOCUMENTS: usize;

    // Required methods
    fn ndims(&self) -> usize;
    fn embed_images(
        &self,
        images: impl IntoIterator<Item = Vec<u8>> + Send,
    ) -> impl Future<Output = Result<Vec<Embedding>, EmbeddingError>> + Send;

    // Provided method
    fn embed_image<'a>(
        &'a self,
        bytes: &'a [u8],
    ) -> impl Future<Output = Result<Embedding, EmbeddingError>> + Send { ... }
}
Expand description

Trait for embedding models that can generate embeddings for images.

Required Associated Constants§

Source

const MAX_DOCUMENTS: usize

The maximum number of images that can be embedded in a single request.

Required Methods§

Source

fn ndims(&self) -> usize

The number of dimensions in the embedding vector.

Source

fn embed_images( &self, images: impl IntoIterator<Item = Vec<u8>> + Send, ) -> impl Future<Output = Result<Vec<Embedding>, EmbeddingError>> + Send

Embed multiple images in a single request from bytes.

Provided Methods§

Source

fn embed_image<'a>( &'a self, bytes: &'a [u8], ) -> impl Future<Output = Result<Embedding, EmbeddingError>> + Send

Embed a single image from bytes.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§