Skip to main content

Chroma: Embedding Database for AI & RAG Applications

ChromaDB is the most developer-friendly embedding database for AI applications. It runs fully in-process with Python — no server, no Docker, no infrastructure. Add documents, query by similarity, filter by metadata, and integrate any embedding model in minutes. The go-to choice for RAG prototypes and local AI development.

✓ Zero-config Python setup ✓ Ephemeral & persistent modes ✓ Auto embedding functions ✓ Metadata filtering ✓ Open source (Apache 2.0)
Share this tool: X / Twitter LinkedIn
✓ 60,000+ developers use DevPlaybook ★★★★★ 4.8 / 5 on Gumroad ✓ MIT licensed · Instant download ✓ No login required

Related Products

on Gumroad

You Might Also Need

More Free Tools

Enjoying this tool? Get more like it.

Weekly developer tool guides, productivity playbooks & AI tricks. Free. No spam.

DevPlaybook Pro 7 days free

Unlock AI-Powered Dev Tools

  • ⚡ AI Code Review, Doc Generator & SQL Builder
  • ⚡ All premium templates & early access
  • ⚡ Member discounts on Gumroad products
Start Free Trial →

$9/mo after trial · Cancel anytime

Want the full toolkit?

Get DevPlaybook Pro

Every template, guide, boilerplate, and automation script in one bundle. 13 premium products — grab them all at once and save big.

$79
$241 separately Save $162 (67% off)
Get DevPlaybook Pro — $79 →

MIT licensed · Instant download · No subscription

See what's included → Browse all deals →

Setup: Ephemeral, Persistent & HTTP Client

Three client modes for different use cases — from in-memory testing to full HTTP server deployment.

pip install chromadb openai sentence-transformers

import chromadb
from chromadb.utils import embedding_functions

# 1. Ephemeral (in-memory, lost on exit) — great for tests
client = chromadb.Client()

# 2. Persistent (saves to disk as SQLite + parquet)
client = chromadb.PersistentClient(path="./chroma_db")

# 3. HTTP Server mode — run server first: chroma run --path ./chroma_db
client = chromadb.HttpClient(host="localhost", port=8000)

# Create a collection with OpenAI embedding function
openai_ef = embedding_functions.OpenAIEmbeddingFunction(
    api_key="YOUR_OPENAI_API_KEY",
    model_name="text-embedding-3-small"
)

collection = client.create_collection(
    name="my_rag_docs",
    embedding_function=openai_ef,
    metadata={"hnsw:space": "cosine"}   # cosine | l2 | ip
)
print(f"Collection: {collection.name}, count: {collection.count()}")

Add, Query, Update & Delete

The complete CRUD API for Chroma collections — Chroma auto-embeds text using the collection's embedding function.

# ADD documents — embedding auto-generated by the embedding function
collection.add(
    documents=[
        "LangChain is a framework for building LLM applications",
        "Chroma stores embeddings for similarity search",
        "RAG combines retrieval with language model generation",
    ],
    metadatas=[
        {"source": "blog", "year": 2024, "category": "llm"},
        {"source": "docs", "year": 2024, "category": "database"},
        {"source": "paper", "year": 2023, "category": "ai"},
    ],
    ids=["doc-1", "doc-2", "doc-3"]
)

# QUERY — similarity search with metadata filter
results = collection.query(
    query_texts=["how does retrieval augmented generation work?"],
    n_results=2,
    where={"category": {"$in": ["ai", "llm"]}},    # metadata filter
    include=["documents", "metadatas", "distances"]
)
for doc, meta, dist in zip(
    results["documents"][0],
    results["metadatas"][0],
    results["distances"][0]
):
    print(f"dist={dist:.4f} | {doc[:60]} | {meta}")

# UPDATE metadata or documents
collection.update(
    ids=["doc-1"],
    metadatas=[{"source": "blog", "year": 2025, "category": "llm"}]
)

# UPSERT (insert or update)
collection.upsert(
    documents=["Updated content about LangChain LCEL"],
    ids=["doc-1"]
)

# DELETE by ID or filter
collection.delete(ids=["doc-3"])
collection.delete(where={"year": {"$lt": 2024}})

Local Embeddings with SentenceTransformers

Use a local embedding model for zero API cost and data privacy — no data leaves your machine.

from chromadb.utils.embedding_functions import SentenceTransformerEmbeddingFunction

# all-MiniLM-L6-v2: 384 dims, very fast, great for local RAG
local_ef = SentenceTransformerEmbeddingFunction(
    model_name="all-MiniLM-L6-v2"
)

local_collection = client.create_collection(
    name="local_docs",
    embedding_function=local_ef
)

# Works identically — model runs locally, no API calls
local_collection.add(
    documents=["Local embedding with no API cost"],
    ids=["local-1"]
)

results = local_collection.query(
    query_texts=["free embeddings"],
    n_results=1
)
print(results["documents"])

Chroma vs Pinecone vs Qdrant vs Weaviate

Feature Chroma Pinecone Qdrant Weaviate
Setup time~30 seconds~5 minutes~5 minutes~10 minutes
Open sourceYesNoYesYes
In-process modeYesNoNoNo
Managed cloudNoYesYesYes
Hybrid searchNoLimitedYesYes
Scale~10M vectors100M+Billion-scale100M+
Best use casePrototypes, local devManaged prodSelf-hosted prodHybrid RAG, SaaS

Frequently Asked Questions

What is Chroma and when should I use it?▼

Chroma (ChromaDB) is an open-source embedding database designed for developer simplicity. It runs entirely in-process in Python with no server required (ephemeral or persistent mode), making it the fastest way to prototype RAG pipelines. Use Chroma for local development, notebooks, and small-to-medium production apps. For billion-scale or managed cloud requirements, consider Pinecone or Qdrant.

What is the difference between ephemeral and persistent Chroma?▼

Ephemeral mode (chromadb.Client()) stores everything in memory — data is lost when the process exits. It is ideal for testing and CI. Persistent mode (chromadb.PersistentClient(path='./chroma_db')) saves data to disk as SQLite + parquet files. For production, you can also run Chroma as a standalone HTTP server and connect with chromadb.HttpClient().

How do embedding functions work in Chroma?▼

Chroma's embedding functions wrap your chosen embedding model and are attached to a collection. When you add documents, Chroma automatically calls the embedding function on each document's text. Built-in functions include OpenAIEmbeddingFunction, CohereEmbeddingFunction, and SentenceTransformerEmbeddingFunction. You can also write a custom function by subclassing EmbeddingFunction.

Can Chroma filter by metadata?▼

Yes. Chroma supports metadata filtering via a 'where' dict at query time using operators like $eq, $ne, $gt, $lt, $in, $nin, $and, $or. You can combine filters: where={'$and': [{'source': {'$eq': 'blog'}}, {'year': {'$gte': 2024}}]}. Metadata filtering runs before the ANN search, so only matching documents are scored.

How does Chroma compare to Pinecone and Qdrant?▼

Chroma: easiest setup, Python-first, great for local dev and prototypes. No managed cloud. Pinecone: zero-infra managed cloud, best for production teams who don't want ops. Qdrant: highest performance self-hosted, Rust-based, supports sparse+dense hybrid search, also has a cloud offering. Choose Chroma to move fast locally; Pinecone for managed production; Qdrant for performance-critical self-hosted.

Does Chroma support multi-user or multi-tenant use cases?▼

Chroma uses collections as the primary isolation unit. You can create one collection per tenant and query them independently. For server mode, Chroma supports basic auth and SSL. However, Chroma does not have built-in row-level security or the shard-level tenant isolation that Weaviate offers. For strict multi-tenant SaaS, Weaviate or a namespace-based Pinecone setup is more robust.

Share this tool: X / Twitter LinkedIn
✓ 60,000+ developers use DevPlaybook ★★★★★ 4.8 / 5 on Gumroad ✓ MIT licensed · Instant download ✓ No login required

Related Products

on Gumroad

You Might Also Need

More Free Tools

CrewAI Agent Config Generator Embedding Storage Calculator Test Coverage Calculator AI Safety Checklist Generator Jotai Atom Explorer LangChain PromptTemplate Builder RAG Chunk Size Optimizer CSS Container Query Builder AI Agent Memory Planner AI Hallucination Detector MySQL Query Explainer PostgreSQL EXPLAIN Analyzer GraphQL Fragment Generator Jest Coverage Config Generator Cron Expression Explainer Font Pairing Preview AI Agent Run Cost Tracker AI Pipeline DAG Builder AI Rate Limit Calculator Prompt Injection Tester Vibe Coding Prompt Optimizer AI IDE Comparator RAG Chunking Calculator AI Commit Message Generator AI Doc Generator — Pro Tool AI Regex Explainer — Pro Tool AI System Guardian AI Token Cost Calculator LLM Cost Calculator AI JSDoc Generator Vitest Configuration Generator AI Prompt Cost Calculator AI Model Comparator Mermaid Diagram Generator Elasticsearch Query Tester mTLS Certificate Chain Builder AI Model Benchmark Comparator JS Prototype Chain Visualizer OpenAI Token Counter AI Model Context Window Visualizer LLM JSON Schema Builder RAG Chunking Calculator OpenAI Prompt Tester AI Model Comparison Tool Multi-Agent Orchestration Planner OpenAI Function Calling Generator Token Counter & Cost Estimator AI Model Comparison Table AI API Rate Limit Calculator LLM Prompt Template Builder HTTP Headers Analyzer AI Code Review — Pro Tool AI Error Explainer — Pro Tool AI SQL Builder — Pro Tool AI Unit Test Generator — Pro Tool Color Palette Generator Docker Compose Generator GitHub Actions Workflow Generator JWT Decoder Prompt Template Builder Regex Tester Pro Regex Tester RSA Key Pair Generator Dockerfile Generator SMTP Server Tester Biome Config Generator Terraform Variable Validator Haproxy Config Validator SBOM Generator AI Variable Namer AI PR Description Generator K8s Resource Limits Calculator LLM Context Window Calculator Regex Flags Explainer NATS Connection String Builder OAuth2 Flow Visualizer Prompt Token Estimator Jest Testing Framework Guide Vitest Guide — Vite-native Testing Playwright E2E Testing Guide Pulumi Modern IaC Guide Core Web Vitals Calculator LLM Prompt Cost Calculator System Prompt Builder Solana Program ID Generator Multi-Chain Wallet Address Validator Pulumi Stack Config Generator Highlight.io LLM System Prompt Analyzer AI Embeddings Dimension Explorer Bezier Curve Editor LLM Benchmark Calculator Token Context Calculator LangGraph Workflow Visualizer LLM Prompt Caching Calculator AI Prompt Token Estimator AI Context Window Visualizer Embedding Similarity Calculator TypeScript Discriminated Union Builder Core Web Vitals Budget Calculator JWT Decoder & Validator Blockchain Transaction Fee Calculator Database Query Cost Analyzer

Related Articles

Apr 1, 2026 · 12 min read

Vector Database Comparison 2026: Pinecone vs Weaviate vs Qdrant vs Chroma

In-depth comparison of the top vector databases in 2026. Evaluate Pinecone, Weaviate, Qdrant, and Chroma on performance, scalability, filtering, pricing, and self-hosting for production AI applications.

Mar 28, 2026 · 12 min read

Building a RAG Pipeline from Scratch: Embeddings, Vector Databases, and Retrieval

Step-by-step guide to building a production-ready RAG pipeline in Python. Covers embeddings, chunking strategies, Chroma and Pinecone setup, hybrid search, reranking, and evaluation with RAGAS.

Mar 28, 2026 · 14 min read

Building Production RAG Systems with LlamaIndex and Vector Databases 2026

Complete guide to building production-ready RAG systems with LlamaIndex v0.10+. Covers chunking strategies, embedding models, Chroma, Pinecone, Weaviate integration, and advanced retrieval patterns.

Mar 28, 2026 · 18 min read

Building a Production RAG Pipeline: Complete Implementation Guide 2026

A comprehensive guide to building production-ready RAG pipelines in 2026. Covers chunking strategies, embedding models, vector store selection, retrieval techniques, reranking, evaluation with RAGAS/TruLens, and LangChain vs LlamaIndex vs custom implementations.

Apr 1, 2026 · 13 min read

Vector Databases Explained: Pinecone vs Weaviate vs Qdrant vs Chroma (2026 Guide)

A complete comparison of the best vector databases in 2026: Pinecone, Weaviate, Qdrant, Chroma, and pgvector. Pricing, code examples, performance benchmarks, and a clear decision framework for AI and LLM applications.

Enjoying this tool? Get more like it.

Weekly developer tool guides, productivity playbooks & AI tricks. Free. No spam.

DevPlaybook Pro 7 days free

Unlock AI-Powered Dev Tools

  • ⚡ AI Code Review, Doc Generator & SQL Builder
  • ⚡ All premium templates & early access
  • ⚡ Member discounts on Gumroad products
Start Free Trial →

$9/mo after trial · Cancel anytime

Want the full toolkit?

Get DevPlaybook Pro

Every template, guide, boilerplate, and automation script in one bundle. 13 premium products — grab them all at once and save big.

$79
$241 separately Save $162 (67% off)
Get DevPlaybook Pro — $79 →

MIT licensed · Instant download · No subscription

See what's included → Browse all deals →