Skip to main content

select_embedding_provider

Function select_embedding_provider 

Source
pub fn select_embedding_provider(
    llm_config: Option<LlmEmbeddingConfig>,
) -> Box<dyn EmbeddingProvider>
Expand description

Select the best available embedding provider based on configuration.

Priority order (ADR-059 + WEFT-640):

  1. Qwen3-Embedding-0.6B — if model_fp16.onnx + tokenizer.json are present and the onnx-embeddings runtime loads them (project-canonical long-context semantic embedder: 32K ctx, MRL-512).
  2. e5-small-v2 ONNX — 384-d MIT BERT-family encoder (matches RVF/HNSW dim; lightweights CI/dev when staged under .weftos/models/e5-small-v2/).
  3. all-MiniLM-L6-v2 ONNX — the legacy BERT encoder fallback.
  4. LLM API — if an llm_embedding config is present.
  5. Mock — graceful fallback for tests / when no model is available.

Selection only promotes a model-backed provider when its runtime is actually live, so without the onnx-embeddings feature (or the artifacts) this always degrades cleanly to LLM or Mock. Model downloads are not required for CI — real inference is gated on staged artifacts + the onnx-embeddings feature.