pub trait Embedder: Send + Sync {
// Required methods
fn dimension(&self) -> usize;
fn embed<'life0, 'life1, 'async_trait>(
&'life0 self,
texts: &'life1 [String],
) -> Pin<Box<dyn Future<Output = Result<Vec<Vec<f32>>, MemoryError>> + Send + 'async_trait>>
where 'life0: 'async_trait,
'life1: 'async_trait,
Self: 'async_trait;
// Provided method
fn is_ranking(&self) -> bool { ... }
}Expand description
Compute embeddings for one or more texts.
Output vectors must each be of length Embedder::dimension.
Implementations must be deterministic at the type level — the
dimensionality cannot vary across calls on the same instance.
Required Methods§
Provided Methods§
Sourcefn is_ranking(&self) -> bool
fn is_ranking(&self) -> bool
Whether distinct inputs produce distinct directions, i.e. whether a vector store wired with this embedder actually ranks by relevance.
Defaults to true — a real embedding model needs no ceremony. Only
NonRankingEmbedder and its like override it, which is what lets a
store report klieo_core::memory::RecallSemantics::NonRanking
instead of claiming vector recall it cannot deliver.
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".