What an embedder does
Pick an embedder
- OpenAI
- Google
- Voyage
- Ollama (local)
cognis-rag/openai.Wrappers
You’ll usually wrap your real embedder once or twice:Pick a vector store
All implement
VectorStore:
Quick example — in-memory
SearchResult carries { id, text, score, metadata }. Score is provider-specific (cosine similarity for most).
Filtered search
Vector stores support metadata filters when their backend does:Filter is a small DSL — eq, ne, in, not_in, plus and/or combinators. The store translates it to its native query language.
How it works
- Embedders are stateless. They turn text into floats. Wrappers add memory, batching, routing.
- Vector stores own state. That’s why they take
&mut selffor mutations. Wrap withArc<RwLock<…>>to share between tasks (the indexing pipeline does this). - Embeddings are not interchangeable. A query embedded with model A can’t be searched against vectors stored with model B. Always re-index when you change embedders.
- Dimension mismatches are caught at runtime.
dimensions()lets you cross-check before persistence layouts go wrong.
See also
Retrievers
Turn a vector store into a query interface.
Indexing pipeline
Keep stores in sync with sources.
Reference → cognis-rag
Full method signatures and feature flags.