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§
Sourcefn provider(&self) -> &ProviderId
fn provider(&self) -> &ProviderId
Provider identifier.
Sourcefn max_embeddings_per_call(&self) -> Option<usize>
fn max_embeddings_per_call(&self) -> Option<usize>
Maximum number of values per call, or None when unlimited.
Sourcefn supports_parallel_calls(&self) -> bool
fn supports_parallel_calls(&self) -> bool
Whether several calls may run concurrently against this model.
Sourcefn do_embed(
&self,
options: EmbedOptions,
) -> impl Future<Output = Result<EmbedResult, ProviderError>> + Send
fn do_embed( &self, options: EmbedOptions, ) -> impl Future<Output = Result<EmbedResult, ProviderError>> + Send
Embeds options.values in one provider call.
Provided Methods§
Sourcefn max_input_bytes_per_call(&self) -> Option<usize>
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".