post-cortex-embeddings
Embedding engines + in-memory vector database for post-cortex.
Self-contained ML stack — no dependency on any other post-cortex crate, so anyone needing a local text embedder or a nearest-neighbour index can depend on this crate without pulling the daemon or orchestrator.
LocalEmbeddingEngineselects anEmbeddingBackendfromEmbeddingConfig::model_type. The default isPotionMultilingual— Model2Vec static embeddings (minishlab/potion-multilingual-128M, 256 dimensions, multilingual, no GPU).PotionCode(potion-code-16M) is the other Model2Vec model. The BERT models (MiniLM,MultilingualMiniLM,TinyBERT,BGESmall, via Candle) need the opt-inbertfeature.StaticSimilarityMRLis a hash-based fallback that does not produce semantic vectors.VectorDBis a DashMap-backed in-memory index with per-source (session) and per-content-id indexes. Up toexact_search_thresholdvectors (default 10 000) searches are exact bounded top-k scans and no HNSW graph is kept; past it the HNSW graph is built once in bulk and maintained incrementally.search_in_sourcesalways scans only the given sessions' vectors. Quantization and product quantization are off by default.
Install
[]
= "0.4" # Model2Vec + VectorDB (default)
= { = "0.4", = ["bert"] } # + BERT via Candle
# or without any model backend (VectorDB, VectorMetadata, SearchMatch, hash fallback only):
= { = "0.4", = false }
Features
| Feature | Default | What it enables |
|---|---|---|
model2vec |
yes | model2vec-rs backend for the Potion models |
bert |
no | Candle + Tokenizers + hf-hub for the BERT backend |
otel |
no | Placeholder; currently enables nothing |
With both model2vec and bert off the crate still compiles VectorDB and its types, which is how post-cortex-storage uses it. Selecting a model whose backend is not compiled in fails at LocalEmbeddingEngine::new with an error naming the missing feature.
Example
use ;
async
License
MIT — see LICENSE.