Skip to main content
Cognis ships six vector stores (in-memory, FAISS, Chroma, Qdrant, Pinecone, Weaviate). Adding a seventh is a self-contained task. This page covers the shape.

What you’ll add

  • A new module under crates/cognis-rag/src/vectorstore/<name>.rs (or a directory for larger backends).
  • A struct implementing VectorStore, plus a <Name>Builder for hosted backends.
  • A feature flag in crates/cognis-rag/Cargo.toml (vectorstore-<name>).
  • Tests with mocked HTTP if hosted, or in-process if local.
  • An example under examples/retrieval/.
  • Documentation entries in Embeddings and vector stores and Feature flags.

The trait

SearchResult is { id, text, score, metadata }. add_texts returns the IDs the store assigned; add_vectors is the lower-level entry when the caller has already paid the embedding cost. For backends that don’t natively support a method, provide a sensible fallback (similarity_search_with_filter has one already) and document the difference.

Step 1 — Build the struct

For a hosted backend:
For local stores (FAISS-style), there’s no HTTP — the struct holds the index and the embedder.

Step 2 — Feature flag

In crates/cognis-rag/src/lib.rs:
The cognis umbrella does not auto-glob from cognis_rag — it explicitly lists the types it re-exports at the top level. Add your types to the relevant pub use cognis_rag::{...} block in crates/cognis/src/lib.rs so users get cognis::MyVectorStore without an extra import. Existing entries there (e.g. InMemoryVectorStore, Filter) are the template.

Step 3 — Tests

Mocked HTTP for hosted; in-process tests for local.
Make sure tests cover:
  • add_texts followed by similarity_search returns the right docs.
  • delete actually removes — a search after delete shouldn’t find the deleted ids.
  • similarity_search_with_filter either filters or falls back gracefully (and the doc page says which).
  • Error paths — what happens when the service is down, returns 5xx, or the collection doesn’t exist.

Step 4 — Add an example

Register in crates/examples/Cargo.toml with a name like retrieval_myvector_basics.

Step 5 — Update docs

Step 6 — PR

Title: feat(rag): add MyVectorStore. Description should mention:
  • The backend’s public docs.
  • Feature flag name.
  • Whether similarity_search_with_filter is native or an in-process fallback.
  • Anything not yet supported.

See also

Adding a provider

Same shape, different domain.

cognis-rag reference

Trait surface and existing implementations.