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 thefastembedcargo feature.
Modules§
- bow
- Deterministic hashed bag-of-words embedder.
- fast
- Real embeddings via fastembed (ONNX). Compiled with the
fastembedfeature, which is on by default; build--no-default-featuresto drop it for the offline bag-of-words lane. Default model: bge-small-en-v1.5; lite alt: all-MiniLM-L6-v2 (quantized).
Enums§
- Embed
Kind - 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§
Functions§
- build
- Pick a backend for
model. With thefastembedfeature and a recognized model id, returns the real embedder; otherwise the offline bag-of-words one. - expected_
id - The
id()the backend picked bybuildformodelwill report — what a matching index’smodeltag must equal. Also construction-free. - is_
dense - Whether
buildwould resolvemodelto the real dense backend (vs the bag-of-words fallback) — without constructing it, which on a cold cache triggers the model download. Letsski doctordescribe the active backend and decide whether a smoke test is safe to run.