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§
Sourceconst MAX_DOCUMENTS: usize
const MAX_DOCUMENTS: usize
The maximum number of images that can be embedded in a single request.
Required Methods§
Sourcefn embed_images(
&self,
images: impl IntoIterator<Item = Vec<u8>> + Send,
) -> impl Future<Output = Result<Vec<Embedding>, EmbeddingError>> + Send
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§
Sourcefn embed_image<'a>(
&'a self,
bytes: &'a [u8],
) -> impl Future<Output = Result<Embedding, EmbeddingError>> + Send
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.