Skip to main content

EmbeddingModel

Trait EmbeddingModel 

Source
pub trait EmbeddingModel:
    Send
    + Sync
    + 'static {
    // Required methods
    fn provider(&self) -> &ProviderId;
    fn model_id(&self) -> &ModelId;
    fn max_embeddings_per_call(&self) -> Option<usize>;
    fn supports_parallel_calls(&self) -> bool;
    fn do_embed(
        &self,
        options: EmbedOptions,
    ) -> impl Future<Output = Result<EmbedResult, ProviderError>> + Send;

    // Provided method
    fn max_input_bytes_per_call(&self) -> Option<usize> { ... }
}
Expand description

A model that turns text into embedding vectors.

Implementations report their batching limits through max_embeddings_per_call and supports_parallel_calls; the core splits inputs and schedules calls accordingly.

Required Methods§

Source

fn provider(&self) -> &ProviderId

Provider identifier.

Source

fn model_id(&self) -> &ModelId

Model identifier.

Source

fn max_embeddings_per_call(&self) -> Option<usize>

Maximum number of values per call, or None when unlimited.

Source

fn supports_parallel_calls(&self) -> bool

Whether several calls may run concurrently against this model.

Source

fn do_embed( &self, options: EmbedOptions, ) -> impl Future<Output = Result<EmbedResult, ProviderError>> + Send

Embeds options.values in one provider call.

Provided Methods§

Source

fn max_input_bytes_per_call(&self) -> Option<usize>

Maximum total UTF-8 size of the values of one call in bytes, or None when unlimited.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§