0
RAG Engineering
Phase 3Module 16 of 18

ChromaDB

LLMs need relevant context at query time. Chroma persists embeddings locally or in client-server mode with minimal setup.

Chroma is a filing cabinet sorted by meaning, not alphabet — you ask 'documents about refunds' and it finds semantically similar files.

Visual Workflows

Start here — study each diagram, then use + / to zoom if needed.

100%
Loading diagram...

Scroll inside the frame · use + / − to zoom

Key Takeaways

  • 1.ChromaDB is an open-source embedding database for storing and querying vector representations of text for RAG and semantic search.
  • 2.Collections hold documents + embeddings + metadata.
  • 3.Supports cosine similarity search, filtering by metadata, persistent storage, and Python/JS clients.
  • 4.Integrates with LangChain and LlamaIndex as a vector store backend.

Real Example

Scenario

Index 500 support tickets, then retrieve the 5 most similar tickets when a new customer asks about billing errors.

What you would do

In RAG Engineering, apply ChromaDB to this scenario: Index 500 support tickets, then retrieve the 5 most similar tickets when a new customer asks about billing errors. 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.

ChromaDB
1import chromadb  # import dependencies2client = chromadb.PersistentClient(path="./chroma_db")  # key line for ChromaDB3collection = client.get_or_create_collection("tickets")4collection.add(documents=["billing issue", "login failed"], ids=["1", "2"], metadatas=[{"team": "billing"}, {"team": "auth"}])  # key line for ChromaDB5results = collection.query(query_texts=["payment declined"], n_results=2)  # key line for ChromaDB6print(results["documents"])  # show output for debugging

Cheat Sheet

Quick recap

quick ref
  • ChromaDB
  • Embeddings
  • Metadata Filtering
  • Cosine Similarity

Common Mistakes

  • Treating ChromaDB as a black box without evaluation
  • Ignoring cost and latency in production
  • Skipping error handling for chromadb