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.
Related Products
on GumroadDeveloper Productivity Bundle
Stop rebuilding the same setup every project. 51 VSCode snippets, 40 Git aliases, 5 Docker Compose stacks, 5 GitHub Actions workflows, 5 README templates, and a dotfiles kit. Set up a professional dev environment in under an hour.
Buy on Gumroad →AI Prompt Engineering Toolkit
58 structured prompt templates for Claude, ChatGPT, and Gemini — organized by use case. Code Review, Debugging, Documentation, Architecture, and 10 model-specific tips. Stop writing prompts from scratch.
Buy on Gumroad →Developer Cheat Sheet Bundle
10 print-ready cheat sheets for the tools developers use every day: Git, Docker, Linux CLI, SQL, Regex, HTTP Status codes, VS Code shortcuts, Bash scripting, jq/JSON, and Markdown.
Buy on Gumroad →You Might Also Need
JSON Formatter & Validator
Format, beautify, and validate JSON online. Paste your JSON to instantly pretty-print it with 2-space, 4-space, or tab indentation. Minify JSON too. Free, runs in your browser.
Open free tool →
Regex Tester
Free regex tester. Test regular expressions against multiple strings with expected match/no-match assertions — see instant pass/fail results. Built-in presets for email, URL, IPv4, and phone. Pro: unl
Open free tool →
Base64 Encoder & Decoder
Free Base64 Encoder & Decoder. Convert text, images, and any file to Base64 and back. Supports URL-safe Base64, image data URIs, and file download from Base64. Runs 100% in your browser — no data sent
Open free tool →
More Free Tools
Related Articles
curl 深度使用手冊:API 測試從入門到進階
curl 是每位開發者必備的 CLI 工具。本文涵蓋 GET/POST/PUT/DELETE 請求、認證、header 設定、檔案上傳、除錯技巧,以及 REST API 測試的完整實戰範例。
Best AI Code Review Tools 2026: CodeRabbit, Sourcery, DeepCode & Bito Compared
Compare top AI code review tools for 2026: CodeRabbit, Sourcery, DeepCode, and Bito. Features, pricing, GitHub/GitLab integration, and choosing the right tool for your team.
AI Code Review Tools 2026: GitHub Copilot, CodeRabbit, Qodo Merge Ranked
Compare AI code review tools for 2026: GitHub Copilot code review, CodeRabbit, Qodo Merge, Sourcery, and PR-Agent. Pricing, accuracy, and GitHub integration.
AI Coding Tools Comparison 2026: GitHub Copilot vs Cursor vs Windsurf vs Cline
Comprehensive comparison of the best AI coding tools in 2026: GitHub Copilot, Cursor, Windsurf, and Cline. Pricing, features, model support, and real-world benchmarks.
AI Pair Programming in 2026: GitHub Copilot vs Cursor vs Claude Code
Master AI pair programming in 2026. Compare GitHub Copilot, Cursor, and Claude Code for autocomplete, chat, and agentic workflows. Includes setup guides and productivity tips.
Enjoying this tool? Get more like it.
Weekly developer tool guides, productivity playbooks & AI tricks. Free. No spam.
Unlock AI-Powered Dev Tools
- ⚡ AI Code Review, Doc Generator & SQL Builder
- ⚡ All premium templates & early access
- ⚡ Member discounts on Gumroad products
$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.
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 source | Yes | No | Yes | Yes |
| In-process mode | Yes | No | No | No |
| Managed cloud | No | Yes | Yes | Yes |
| Hybrid search | No | Limited | Yes | Yes |
| Scale | ~10M vectors | 100M+ | Billion-scale | 100M+ |
| Best use case | Prototypes, local dev | Managed prod | Self-hosted prod | Hybrid 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.
Related Products
on GumroadAI Prompt Engineering Toolkit
58 structured prompt templates for Claude, ChatGPT, and Gemini — organized by use case. Code Review, Debugging, Documentation, Architecture, and 10 model-specific tips. Stop writing prompts from scratch.
Buy on Gumroad →AI Developer Prompts Pack
55 battle-tested prompt templates for the workflows developers actually use: code review, debugging, architecture, documentation, and testing. Stop writing prompts from scratch.
Buy on Gumroad →Developer Productivity Bundle
Stop rebuilding the same setup every project. 51 VSCode snippets, 40 Git aliases, 5 Docker Compose stacks, 5 GitHub Actions workflows, 5 README templates, and a dotfiles kit. Set up a professional dev environment in under an hour.
Buy on Gumroad →You Might Also Need
CrewAI Agent Config Generator
Build CrewAI agent configurations visually. Define roles, goals, backstories, and tools. Generate YAML or Python code for multi-agent crews.
Open free tool →
Embedding Storage Calculator
Calculate storage requirements for vector embeddings at scale. Choose model, precision, and vector count to get RAM, disk, and Pinecone cost estimates.
Open free tool →
Test Coverage Calculator
Calculate line, branch, function, and statement code coverage percentages. Set thresholds, check pass/fail status, and generate Jest/Vitest coverage config snippets.
Open free tool →
More Free Tools
Related Articles
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.
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.
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.
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.
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.
Unlock AI-Powered Dev Tools
- ⚡ AI Code Review, Doc Generator & SQL Builder
- ⚡ All premium templates & early access
- ⚡ Member discounts on Gumroad products
$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.
MIT licensed · Instant download · No subscription
See what's included → Browse all deals →