Chroma is a lightweight, embedded vector database that runs in-process with no server needed, which makes it the easiest local option for development and moderate production scale. The pattern is the same as any vector store: create a persistent client, create a collection, add embeddings with their documents and metadata, then query with a query embedding and take the nearest results.
What you need
- Python with chromadb installed
- Embeddings for your chunks, with matching document text and ids
- A folder for the persistent store, for example ./chroma_db
Step 1: Create a persistent client and collection
Create a PersistentClient pointing at ./chroma_db and get or create a collection for the documents. A persistent client keeps the vectors on disk between runs.
Step 2: Add embeddings with documents and metadata
Add the embeddings, the chunk text, metadata such as source and section, and stable ids in one call. Stable ids matter: an update with the same id replaces the old vector instead of duplicating it.
Step 3: Query with a query embedding
Embed the user question with the same model used for the chunks, then query the collection with that vector and take the top results. Check the returned documents actually answer the question.
Worked example: synthetic Chroma collection check
The table below is a synthetic example. It shows the expected result of a Chroma query; no database was created.
| Check | Value | Result |
|---|---|---|
| Collection | knowledge_base | Created |
| Documents added | 200 | 200 stored |
| Query results | Top 3 returned | All on-topic |
| Duplicate ids | 0 | Pass |
Expected result (UNTESTED). 200 documents are stored in the knowledge_base collection, a query returns 3 on-topic results, and no id is duplicated. This check was not run live; the table shows the expected result for the synthetic example.
Limits
- Chroma is the easiest local option, but it is not the pick for large-scale production; pgvector or a managed store fits there.
- The query must be embedded with the same model as the chunks, or the vectors will not compare.
- ChromaDB is open source with a Rust-based storage core; version drift between 0.x and 1.x changed the pairing, so pin the version you tested.
- Metadata filtering works alongside similarity search; use it to restrict results to one tenant or workspace.
