Skip to main content

Module embed

Module embed 

Source
Expand description

Embedding backends behind a single trait.

  • bow::BowEmbedder — deterministic hashed bag-of-words. No deps, no network, no model. Always available; used for tests and offline fallback.
  • fast::FastEmbedder — real bge-small / MiniLM via fastembed (ONNX). Behind the fastembed cargo feature.

Modules§

bow
Deterministic hashed bag-of-words embedder.
fast
Real embeddings via fastembed (ONNX). Compiled with the fastembed feature, which is on by default; build --no-default-features to drop it for the offline bag-of-words lane. Default model: bge-small-en-v1.5; lite alt: all-MiniLM-L6-v2 (quantized).

Enums§

EmbedKind
Whether a text is a search query or an indexed document. bge models are asymmetric (query gets an instruction prefix); symmetric models ignore this.

Traits§

Embedder

Functions§

build
Pick a backend for model. With the fastembed feature and a recognized model id, returns the real embedder; otherwise the offline bag-of-words one.
expected_id
The id() the backend picked by build for model will report — what a matching index’s model tag must equal. Also construction-free.
is_dense
Whether build would resolve model to the real dense backend (vs the bag-of-words fallback) — without constructing it, which on a cold cache triggers the model download. Lets ski doctor describe the active backend and decide whether a smoke test is safe to run.