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):
- Qwen3-Embedding-0.6B — if
model_fp16.onnx+tokenizer.jsonare present and theonnx-embeddingsruntime loads them (project-canonical long-context semantic embedder: 32K ctx, MRL-512). - 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/). - all-MiniLM-L6-v2 ONNX — the legacy BERT encoder fallback.
- LLM API — if an
llm_embeddingconfig is present. - 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.