RAG & LLMs / 4. VECTOR STORE
Stage 4: Vector Store
Persisting embeddings and enabling fast ANN search
EXPLANATION
A vector store persists your embeddings and enables fast approximate nearest-neighbor (ANN) search. When a query comes in, it's embedded and compared against all stored vectors. Options by use case: • ChromaDB → local, zero config, perfect for dev & moderate scale • FAISS → in-memory, blazing fast, Facebook's library • Pinecone → fully managed cloud, production scale • pgvector → PostgreSQL extension, if you're already on Postgres Start with ChromaDB. Migrate to Pinecone only when you actually need to.
DATA FLOW
chunks + their embeddings
↓
ChromaDB (persisted to ./chroma_db)
┌───────────────────────────────────────────────────┐
│ id │ vector (1024d) │ text │ metadata │
│ 0 │ [0.23,-0.87,...] │ "BERT is..." │ {p:1} │
│ 1 │ [0.11, 0.44,...] │ "RAG uses..."│ {p:2} │
│ 2 │ [-0.9, 0.02,...] │ "The attn..."│ {p:3} │
└───────────────────────────────────────────────────┘
↑
query vector → cosine similarity → top-k resultsCODE