pub trait Embedder: EmbedderBound {
Show 18 methods
// Required method
fn embed_dense<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
text: &'life1 str,
model: &'life2 str,
) -> Pin<Box<dyn Future<Output = Result<Vec<f32>, QqlError>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait;
// Provided methods
fn embed_sparse_query<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
text: &'life1 str,
model: &'life2 str,
) -> Pin<Box<dyn Future<Output = Result<SparseVector, QqlError>> + Send + 'async_trait>>
where Self: Sync + 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait { ... }
fn embed_sparse_document<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
text: &'life1 str,
model: &'life2 str,
) -> Pin<Box<dyn Future<Output = Result<SparseVector, QqlError>> + Send + 'async_trait>>
where Self: Sync + 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait { ... }
fn embed_sparse_document_batch<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
texts: &'life1 [String],
model: &'life2 str,
) -> Pin<Box<dyn Future<Output = Result<Vec<SparseVector>, QqlError>> + Send + 'async_trait>>
where Self: Sync + 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait { ... }
fn embed_sparse_query_batch<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
texts: &'life1 [String],
model: &'life2 str,
) -> Pin<Box<dyn Future<Output = Result<Vec<SparseVector>, QqlError>> + Send + 'async_trait>>
where Self: Sync + 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait { ... }
fn embed_joint<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
text: &'life1 str,
model: &'life2 str,
) -> Pin<Box<dyn Future<Output = Result<JointEmbeddingOutput, QqlError>> + Send + 'async_trait>>
where Self: Sync + 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait { ... }
fn embed_joint_batch<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
texts: &'life1 [String],
model: &'life2 str,
) -> Pin<Box<dyn Future<Output = Result<Vec<JointEmbeddingOutput>, QqlError>> + Send + 'async_trait>>
where Self: Sync + 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait { ... }
fn dimension(&self) -> Option<usize> { ... }
fn bm25_params(&self) -> Bm25Params { ... }
fn bm25_text_config(&self) -> Bm25TextConfig { ... }
fn multi_dimension(&self) -> Option<usize> { ... }
fn accepts_model(&self, _model: &str) -> bool { ... }
fn embed_dense_batch<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
texts: &'life1 [String],
model: &'life2 str,
) -> Pin<Box<dyn Future<Output = Result<Vec<Vec<f32>>, QqlError>> + Send + 'async_trait>>
where Self: Sync + 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait { ... }
fn embed_multi<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
text: &'life1 str,
model: &'life2 str,
) -> Pin<Box<dyn Future<Output = Result<Vec<Vec<f32>>, QqlError>> + Send + 'async_trait>>
where Self: Sync + 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait { ... }
fn embed_multi_batch<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
texts: &'life1 [String],
model: &'life2 str,
) -> Pin<Box<dyn Future<Output = Result<Vec<Vec<Vec<f32>>>, QqlError>> + Send + 'async_trait>>
where Self: Sync + 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait { ... }
fn embed_image<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
source: &'life1 str,
model: &'life2 str,
) -> Pin<Box<dyn Future<Output = Result<Vec<f32>, QqlError>> + Send + 'async_trait>>
where Self: Sync + 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait { ... }
fn embed_image_batch<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
sources: &'life1 [String],
model: &'life2 str,
) -> Pin<Box<dyn Future<Output = Result<Vec<Vec<f32>>, QqlError>> + Send + 'async_trait>>
where Self: Sync + 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait { ... }
fn rerank_pairs<'life0, 'life1, 'life2, 'life3, 'async_trait>(
&'life0 self,
query: &'life1 str,
documents: &'life2 [String],
model: &'life3 str,
) -> Pin<Box<dyn Future<Output = Result<Vec<f32>, QqlError>> + Send + 'async_trait>>
where Self: Sync + 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait { ... }
}Expand description
Host-agnostic embedding backend.
Calls should batch when possible (*_batch → one HTTP request or one ONNX
batch): resolve_embeddings batches dense, sparse-query, multi, and image
jobs alike (grouped by model, one *_batch call per model), so remote
backends must override the batch variants for real batching instead of
relying on the sequential single-call defaults. Sparse is role-split:
Self::embed_sparse_query (unit weights) for search text and
Self::embed_sparse_document (BM25 tf saturation) for ingestion text,
both defaulting to local wire-compatible BM25. Multivector (ColBERT-style)
uses Self::embed_multi → Vec<Vec<f32>>.
Required Methods§
Sourcefn embed_dense<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
text: &'life1 str,
model: &'life2 str,
) -> Pin<Box<dyn Future<Output = Result<Vec<f32>, QqlError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
fn embed_dense<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
text: &'life1 str,
model: &'life2 str,
) -> Pin<Box<dyn Future<Output = Result<Vec<f32>, QqlError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Embed one text into a dense vector; model may be empty or "default".
Provided Methods§
Sourcefn embed_sparse_query<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
text: &'life1 str,
model: &'life2 str,
) -> Pin<Box<dyn Future<Output = Result<SparseVector, QqlError>> + Send + 'async_trait>>where
Self: Sync + 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
fn embed_sparse_query<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
text: &'life1 str,
model: &'life2 str,
) -> Pin<Box<dyn Future<Output = Result<SparseVector, QqlError>> + Send + 'async_trait>>where
Self: Sync + 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Sparse embedding for query text: unique terms with unit weights,
matching Qdrant’s qdrant/bm25 query embedding.
Default implementation uses the local pipeline from
Self::bm25_text_config when model is empty or "default".
Non-default sparse models are rejected — override this method to
provide model-aware sparse inference.
Sourcefn embed_sparse_document<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
text: &'life1 str,
model: &'life2 str,
) -> Pin<Box<dyn Future<Output = Result<SparseVector, QqlError>> + Send + 'async_trait>>where
Self: Sync + 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
fn embed_sparse_document<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
text: &'life1 str,
model: &'life2 str,
) -> Pin<Box<dyn Future<Output = Result<SparseVector, QqlError>> + Send + 'async_trait>>where
Self: Sync + 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Sparse embedding for document text at ingestion: BM25
term-frequency saturation, matching Qdrant’s qdrant/bm25 document
embedding.
Default implementation uses the local pipeline from
Self::bm25_text_config when model is empty or "default",
honoring its Bm25Params. Non-default sparse models are rejected —
override this method to provide model-aware sparse inference.
Sourcefn embed_sparse_document_batch<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
texts: &'life1 [String],
model: &'life2 str,
) -> Pin<Box<dyn Future<Output = Result<Vec<SparseVector>, QqlError>> + Send + 'async_trait>>where
Self: Sync + 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
fn embed_sparse_document_batch<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
texts: &'life1 [String],
model: &'life2 str,
) -> Pin<Box<dyn Future<Output = Result<Vec<SparseVector>, QqlError>> + Send + 'async_trait>>where
Self: Sync + 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Batch document-side sparse embedding. Default loops
Self::embed_sparse_document; override for real batching.
Sourcefn embed_sparse_query_batch<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
texts: &'life1 [String],
model: &'life2 str,
) -> Pin<Box<dyn Future<Output = Result<Vec<SparseVector>, QqlError>> + Send + 'async_trait>>where
Self: Sync + 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
fn embed_sparse_query_batch<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
texts: &'life1 [String],
model: &'life2 str,
) -> Pin<Box<dyn Future<Output = Result<Vec<SparseVector>, QqlError>> + Send + 'async_trait>>where
Self: Sync + 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Batch query-side sparse embedding. Default loops
Self::embed_sparse_query; override for real batching
(model-backed SPLADE / BGE-M3 sparse inference).
Sourcefn embed_joint<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
text: &'life1 str,
model: &'life2 str,
) -> Pin<Box<dyn Future<Output = Result<JointEmbeddingOutput, QqlError>> + Send + 'async_trait>>where
Self: Sync + 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
fn embed_joint<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
text: &'life1 str,
model: &'life2 str,
) -> Pin<Box<dyn Future<Output = Result<JointEmbeddingOutput, QqlError>> + Send + 'async_trait>>where
Self: Sync + 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Single-pass joint multi-modal / BGE-M3 embedding (dense + sparse + multi-vectors).
Default implementation delegates to separate dense, sparse, and multi calls.
Override this to make a single inference pass (e.g. Bgem3Embedding::embed).
The default propagates the first error and does not suppress failures.
Sourcefn embed_joint_batch<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
texts: &'life1 [String],
model: &'life2 str,
) -> Pin<Box<dyn Future<Output = Result<Vec<JointEmbeddingOutput>, QqlError>> + Send + 'async_trait>>where
Self: Sync + 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
fn embed_joint_batch<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
texts: &'life1 [String],
model: &'life2 str,
) -> Pin<Box<dyn Future<Output = Result<Vec<JointEmbeddingOutput>, QqlError>> + Send + 'async_trait>>where
Self: Sync + 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Batch joint embedding. Default loops Self::embed_joint.
Sourcefn dimension(&self) -> Option<usize>
fn dimension(&self) -> Option<usize>
Dense output dimension when it is known without running inference.
Custom and remote embedders may return None.
Sourcefn bm25_params(&self) -> Bm25Params
fn bm25_params(&self) -> Bm25Params
Local BM25 hyperparameters used by the default
Self::embed_sparse_document / Self::embed_sparse_document_batch
implementations.
Document-side only: it does not affect Self::embed_sparse_query
(always unit term weights) or model-backed sparse inference (SPLADE /
BGE-M3), and it is not a collection/wire setting. Defaults to
Bm25Params::default, so hosts that never override it keep Qdrant’s
qdrant/bm25 defaults. Changing it affects documents embedded after
the change — re-ingest to apply.
Sourcefn bm25_text_config(&self) -> Bm25TextConfig
fn bm25_text_config(&self) -> Bm25TextConfig
Full local BM25 text configuration (pipeline + hyperparameters) used
by the default Self::embed_sparse_document /
Self::embed_sparse_query implementations.
Default wraps Self::bm25_params with Qdrant’s text defaults (word
tokenizer, English, lowercase on, folding off, language
stopwords/stemmer), so overriding only bm25_params keeps working
unchanged. Override this instead to change tokenization, language,
folding, stopwords, stemming, or token length limits.
Sourcefn multi_dimension(&self) -> Option<usize>
fn multi_dimension(&self) -> Option<usize>
Multivector (ColBERT) per-token dimension when known without inference.
Sourcefn accepts_model(&self, _model: &str) -> bool
fn accepts_model(&self, _model: &str) -> bool
Whether this embedder can satisfy a requested model identifier.
Dynamic providers may return true for every model.
Sourcefn embed_dense_batch<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
texts: &'life1 [String],
model: &'life2 str,
) -> Pin<Box<dyn Future<Output = Result<Vec<Vec<f32>>, QqlError>> + Send + 'async_trait>>where
Self: Sync + 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
fn embed_dense_batch<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
texts: &'life1 [String],
model: &'life2 str,
) -> Pin<Box<dyn Future<Output = Result<Vec<Vec<f32>>, QqlError>> + Send + 'async_trait>>where
Self: Sync + 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Embed many texts in one shot. Default loops embed_dense; override for
real batching (OpenAI-compatible input: [...], fastembed batch, etc.).
Sourcefn embed_multi<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
text: &'life1 str,
model: &'life2 str,
) -> Pin<Box<dyn Future<Output = Result<Vec<Vec<f32>>, QqlError>> + Send + 'async_trait>>where
Self: Sync + 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
fn embed_multi<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
text: &'life1 str,
model: &'life2 str,
) -> Pin<Box<dyn Future<Output = Result<Vec<Vec<f32>>, QqlError>> + Send + 'async_trait>>where
Self: Sync + 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Multivector embedding (ColBERT-style late interaction).
Returns one dense vector per token/segment. Default rejects so hosts that only support single-vector dense must opt in explicitly.
Sourcefn embed_multi_batch<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
texts: &'life1 [String],
model: &'life2 str,
) -> Pin<Box<dyn Future<Output = Result<Vec<Vec<Vec<f32>>>, QqlError>> + Send + 'async_trait>>where
Self: Sync + 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
fn embed_multi_batch<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
texts: &'life1 [String],
model: &'life2 str,
) -> Pin<Box<dyn Future<Output = Result<Vec<Vec<Vec<f32>>>, QqlError>> + Send + 'async_trait>>where
Self: Sync + 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Batch multivector embedding. Default loops Self::embed_multi.
Sourcefn embed_image<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
source: &'life1 str,
model: &'life2 str,
) -> Pin<Box<dyn Future<Output = Result<Vec<f32>, QqlError>> + Send + 'async_trait>>where
Self: Sync + 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
fn embed_image<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
source: &'life1 str,
model: &'life2 str,
) -> Pin<Box<dyn Future<Output = Result<Vec<f32>, QqlError>> + Send + 'async_trait>>where
Self: Sync + 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Image / CLIP vision embedding. source is a filesystem path or URL.
Returns a single dense vector in the same space as the paired text encoder (e.g. CLIP). Default rejects until the host opts in.
Sourcefn embed_image_batch<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
sources: &'life1 [String],
model: &'life2 str,
) -> Pin<Box<dyn Future<Output = Result<Vec<Vec<f32>>, QqlError>> + Send + 'async_trait>>where
Self: Sync + 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
fn embed_image_batch<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
sources: &'life1 [String],
model: &'life2 str,
) -> Pin<Box<dyn Future<Output = Result<Vec<Vec<f32>>, QqlError>> + Send + 'async_trait>>where
Self: Sync + 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Batch image embedding. Default loops Self::embed_image.
Sourcefn rerank_pairs<'life0, 'life1, 'life2, 'life3, 'async_trait>(
&'life0 self,
query: &'life1 str,
documents: &'life2 [String],
model: &'life3 str,
) -> Pin<Box<dyn Future<Output = Result<Vec<f32>, QqlError>> + Send + 'async_trait>>where
Self: Sync + 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait,
fn rerank_pairs<'life0, 'life1, 'life2, 'life3, 'async_trait>(
&'life0 self,
query: &'life1 str,
documents: &'life2 [String],
model: &'life3 str,
) -> Pin<Box<dyn Future<Output = Result<Vec<f32>, QqlError>> + Send + 'async_trait>>where
Self: Sync + 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait,
Cross-encoder pair scores: (query, documents[i]) → score.
Returns one score per document in the same order as documents
(not sorted). Hosts that return ranked results must unpermute.
Default rejects until the host opts in (edge TextRerank, HTTP rerank API).
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".