pub trait ImageEmbeddingModel: ModelInfo {
// Required methods
fn embed<'life0, 'async_trait>(
&'life0 self,
images: Vec<ImageInput>,
) -> Pin<Box<dyn Future<Output = Result<EmbedResult>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
fn dimensions(&self) -> u32;
// Provided method
fn warmup<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where Self: Sync + 'async_trait,
'life0: 'async_trait { ... }
}Expand description
A model that produces dense vector embeddings from images.
One vector is returned per input image, each of dimension
dimensions. Implementations
typically batch internally for GPU efficiency; callers should pass as
large a batch as fits their latency budget.
Required Methods§
Sourcefn embed<'life0, 'async_trait>(
&'life0 self,
images: Vec<ImageInput>,
) -> Pin<Box<dyn Future<Output = Result<EmbedResult>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn embed<'life0, 'async_trait>(
&'life0 self,
images: Vec<ImageInput>,
) -> Pin<Box<dyn Future<Output = Result<EmbedResult>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Embed a batch of images.
§Errors
Returns an error if the provider fails to load any input, runs out of memory, or the upstream API rejects the request.
Sourcefn dimensions(&self) -> u32
fn dimensions(&self) -> u32
The dimensionality of vectors produced by this model.
Provided Methods§
Sourcefn warmup<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: Sync + 'async_trait,
'life0: 'async_trait,
fn warmup<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: Sync + 'async_trait,
'life0: 'async_trait,
Optional warmup hook (e.g. load weights into memory on first access). The default is a no-op.
§Errors
Returns an error if the underlying model fails to initialize.