ChromaDB
You need somewhere to put embeddings on day one without standing up a cluster. Chroma is the learning and prototype store. Move to Qdrant, Pinecone, or pgvector when you need HA, multi-tenant scale, or ops you do not want to own.
Chroma is a filing cabinet sorted by meaning, not alphabet — ask for refunds and it returns semantically nearby files.
Visual Workflows
Start here — scroll inside each diagram frame to explore, then use + / − to zoom up to 200% if needed.
Overview
Scroll inside the frame to explore · use + / − to zoom up to 200%
Scroll inside the frame to explore · use + / − to zoom up to 200%
Local RAG store
Scroll inside the frame to explore · use + / − to zoom up to 200%
Persist to disk so you do not re-embed every demo restart.
When to leave Chroma
Scroll inside the frame to explore · use + / − to zoom up to 200%
Great for learning and small apps. Dedicated DBs when you need HA, tenancy, and huge scale.
Key Takeaways
- 1.ChromaDB is a local-first embedding database: collections of documents, vectors, and metadata you can query by meaning in a few lines of Python.
- 2.Use PersistentClient(path=...) so restarts do not wipe the index.
- 3.A collection holds ids, documents, embeddings, and metadatas. add() upserts. query() takes query_texts or query_embeddings, n_results, and where filters.
- 4.You can let Chroma embed or pass your own vectors.
- 5.One collection per embedding model.
Real Example
Scenario
Index support tickets with team metadata, then query 'payment declined' filtered to team=billing so auth tickets never leak into the answer.
What you would do
In RAG Engineering, apply ChromaDB to this scenario: Index support tickets with team metadata, then query 'payment declined' filtered to team=billing so auth tickets never leak into the answer. Identify the inputs, run the technique, validate the output, and note one thing you would monitor in production.
Practice Task
Open the Code Walkthrough below and run it locally. Change one parameter related to ChromaDB (e.g. model, temperature, top_k, or tool name), observe the difference in output, and write 2–3 sentences explaining what changed.
Code Walkthrough
Highlighted lines show where ChromaDB happens in the code.
1import chromadb # import dependencies2
3client = chromadb.PersistentClient(path="./chroma_db") # key line for ChromaDB4tickets = client.get_or_create_collection("tickets")5tickets.add( # key line for ChromaDB6 documents=["billing issue on invoice 88", "login failed after reset"],7 ids=["t1", "t2"],8 metadatas=[{"team": "billing"}, {"team": "auth"}],9)10hits = tickets.query( # key line for ChromaDB11 query_texts=["payment declined"],12 n_results=2,13 where={"team": "billing"},14)15print(hits["documents"], hits["ids"]) # show output for debuggingCommands
Commands to Remember
pip install chromadbclient = chromadb.PersistentClient(path='./chroma')collection.add(documents=..., ids=..., metadatas=...)collection.query(query_texts=[question], n_results=5, where={...})
Cheat Sheet
Quick recap
quick ref- •PersistentClient(path=...)
- •collection.add(docs, ids, metadatas)
- •query_texts + where filters
- •Prototype here, dedicated DB at scale
Common Mistakes
- ✕In-memory Client() — index vanishes on restart
- ✕Mixing embedding models in one collection
- ✕No metadata — cannot filter tenant or cite sources
