Expand description
§orbok-embed
Embedding backend factory (RFC-021). Selects and constructs a local
EmbeddingModel implementation from an EmbeddingModelConfig.
§Backend selection
| Backend | Feature flag | Notes |
|---|---|---|
Mock | always | Deterministic 8-dim, test-only |
CandleCpu/CandleCuda | candle | HuggingFace candle runtime |
OnnxRuntime | tract | Tract ONNX runtime (pure Rust) |
Without the candle or tract feature, create_embedding_model
returns OrbokError::Cache when called with a non-mock backend.
Enable the feature at build time and provide model weights to use
real inference:
cargo build --features orbok-embed/tract§RFC-021 model comparison
Evaluated models for the default recommendation:
| Model | Dim | Size | License | Japanese | Notes |
|---|---|---|---|---|---|
| all-MiniLM-L6-v2 | 384 | ~22 MB | Apache 2.0 | Weak | Fast, widely supported |
| nomic-embed-text-v1.5 | 768 | ~137 MB | Apache 2.0 | Moderate | Good multilingual |
| multilingual-e5-small | 384 | ~118 MB | MIT | Strong | 100 languages including Japanese |
Recommended default (RFC-021): multilingual-e5-small for
orbok’s mixed Japanese-English use case (RFC-014). The 384-dim
vectors keep storage manageable while providing genuine multilingual
recall. Users can override via EmbeddingModelConfig.
Constants§
- RECOMMENDED_
HF_ MODEL_ ID - HuggingFace model ID for manual download reference.
- RECOMMENDED_
MODEL_ DIMENSION - RECOMMENDED_
MODEL_ MAX_ SEQ_ LEN - RECOMMENDED_
MODEL_ NAME - Recommended default model configuration for new installations.
- RECOMMENDED_
MODEL_ VERSION - RECOMMENDED_
ONNX_ FILE - Expected ONNX weights file name once downloaded.
Functions§
- create_
embedding_ model - Construct an embedding model from configuration.
- recommended_
config - Build a default configuration for the recommended model.