
Your RAG Pipeline Needs a Storage Layer: Add One in 10 Lines With Chroma
Chris Harper
3 min read
Sep 1, 2026 · 04:03 UTC
TL;DR: Chroma is the shortest path from raw text to a queryable local vector store — pip install chromadb, create a collection, add documents, and semantic search works in under 10 lines.
What you'll be able to do after this:
- Understand what a vector database does that a regular database cannot
- Run a working local vector store with persistent storage in minutes
- Know when Chroma is the right choice versus pgvector or FAISS
Why your RAG pipeline needs a vector store. A sentence embedding is a fixed-size array of floats that encodes the meaning of text. A vector database stores those arrays and finds the ones closest to a query embedding — that's what makes semantic search work at scale. Without a vector store, retrieval means re-embedding the entire corpus every query. With one, nearest-neighbor search runs in milliseconds across millions of documents.
Set up Chroma locally:
pip install chromadb
import chromadb
# PersistentClient saves to disk; use EphemeralClient() for tests
client = chromadb.PersistentClient(path="./chroma_db")
collection = client.get_or_create_collection(name="docs")
# Add documents — Chroma embeds them automatically (all-MiniLM-L6-v2 by default)
collection.add(
documents=[
"Claude Code runs agents on your machine",
"Ollama serves open-weight models locally via an OpenAI-compatible API",
],
ids=["doc-1", "doc-2"],
metadatas=[{"source": "docs"}, {"source": "docs"}],
)
# Query — returns results ranked by semantic similarity
results = collection.query(
query_texts=["run a model on my laptop"],
n_results=2,
)
print(results["documents"])
# [['Ollama serves open-weight models locally...', 'Claude Code runs agents...']]
Chroma's built-in embedder handles the embedding step automatically, so you do not need a separate call to an embedding API for prototypes. When accuracy matters, swap in your own EmbeddingFunction — the swap changes one constructor argument, not your calling code.
When NOT to use Chroma:
- You are already on Postgres:
pgvectoradds vector search to your existing database with no new service to run. - You need production-scale multi-tenancy: Qdrant, Weaviate, or Pinecone are more battle-tested for high-concurrency SaaS workloads.
- Speed is the priority: FAISS is a pure in-memory C++ library with GPU support; Chroma adds more overhead.
- You need an undo on deletes: collection deletion in Chroma is permanent with no built-in recovery.
Best hands-on resource: RAG Made Simple: ChromaDB + Python (All Local) walks the entire pipeline end-to-end with no external API — local embeddings and local retrieval.
Sources: Chroma docs — docs.trychroma.com · DataCamp: ChromaDB step-by-step tutorial · RAG Made Simple: ChromaDB + Python (All Local) — YouTube · FAISS vs Chroma vs Pinecone for RAG — Medium