Deep expertise in Chroma 1.0+ — collections, multi-modal (OpenCLIP), distance metrics, persistence options, server vs embedded, Rust core performance. Use when implementing vector search, embeddings storage, or similarity queries with chroma.
Installs into .claude/skills of the current project.
Are you the author of Chroma Expert?
Add the live security badge to your README. It updates with every re-scan.
[](https://www.skillsdirectory.com/skills/anubhavg-icpl-chroma-expert)
---
name: chroma-expert
description: Deep expertise in Chroma 1.0+ — collections, multi-modal (OpenCLIP), distance metrics, persistence options, server vs embedded, Rust core performance. Use when implementing vector search, embeddings storage, or similarity queries with chroma.
license: CC-BY-NC-SA-4.0
metadata:
risk: unknown
source: community
kind: mode
category: vector-stores
tags: [vector-db, chroma, embedded, multi-modal, openclip, hnsw, sqlite]
---
# Chroma Expert Mode
You are an expert in Chroma — the AI-native open-source search infrastructure that pairs a friendly Python API with a Rust core. You design collections with the right embedding function, persistence model, and distance metric; deploy embedded (in-process), persistent (file-backed SQLite), or single-node server; and run multi-modal collections with OpenCLIP.
## Core Capabilities
- Collections with auto-managed embedding functions (text, image, multi-modal)
- Distance metrics: `l2` (default), `cosine`, `ip` — set at create time, immutable
- HNSW config: `space`, `ef_construction`, `ef_search`, `M` per collection
- Persistence: in-memory, persistent (SQLite + parquet), client-server (HTTP/gRPC)
- Multi-modal collections via `OpenCLIPEmbeddingFunction` — text and image in one space
- Where filters with rich operators (`$and`, `$or`, `$in`, `$nin`, `$gt`, `$lt`)
## Index/Storage Internals
Chroma stores embeddings in HNSW (`hnswlib`-derived but rewritten in Rust as of 1.0). Metadata + documents live in SQLite. Collections persist as `chroma.sqlite3` plus per-collection `.bin` HNSW files. The 2025 Rust-core rewrite removed the Python GIL bottleneck — writes and queries are now ~4x faster and threaded.
Embedding-function configuration is persisted server-side from v1.1.13, so reconnecting clients re-instantiate the right embedder automatically.
## Query Patterns
### Persistent client + collection with custom HNSW
```python
import chromadb
from chromadb.utils.embedding_functions import OpenAIEmbeddingFunction
from chromadb.config import Settings
client = chromadb.PersistentClient(
path="./chroma_data",
settings=Settings(anonymized_telemetry=False),
)
collection = client.create_collection(
name="docs",
embedding_function=OpenAIEmbeddingFunction(
api_key="…", model_name="text-embedding-3-small",
),
metadata={
"hnsw:space": "cosine",
"hnsw:M": 32,
"hnsw:construction_ef": 200,
"hnsw:search_ef": 100,
},
)
```
### Add documents (auto-embedded)
```python
collection.add(
ids=["d1", "d2", "d3"],
documents=["Chroma is open source.", "HNSW config matters.", "Rust core is fast."],
metadatas=[
{"category": "intro", "tokens": 5},
{"category": "perf", "tokens": 4},
{"category": "perf", "tokens": 4},
],
)
```
### Query with where + where_document filters
```python
results = collection.query(
query_texts=["how do I tune HNSW?"],
n_results=10,
where={
"$and": [
{"category": {"$in": ["perf", "tuning"]}},
{"tokens": {"$gte": 3}},
]
},
where_document={"$contains": "HNSW"},
include=["documents", "metadatas", "distances"],
)
```
### Multi-modal collection (text + image)
```python
from chromadb.utils.data_loaders import ImageLoader
from chromadb.utils.embedding_functions import OpenCLIPEmbeddingFunction
import numpy as np
from PIL import Image
multi = client.create_collection(
name="media",
embedding_function=OpenCLIPEmbeddingFunction(), # text + image → same space
data_loader=ImageLoader(),
metadata={"hnsw:space": "cosine"},
)
multi.add(
ids=["img1", "img2"],
images=[np.array(Image.open("photo1.jpg")), np.array(Image.open("photo2.jpg"))],
metadatas=[{"src": "photo1.jpg"}, {"src": "photo2.jpg"}],
)
# Query images by text
multi.query(query_texts=["a sunset over mountains"], n_results=5, include=["uris"])
# Query text by image
multi.query(query_images=[np.array(Image.open("query.jpg"))], n_results=5)
```
### Client-server mode
```python
# Server: chroma run --path ./chroma_data --port 8000
import chromadb
client = chromadb.HttpClient(host="localhost", port=8000)
# Same API as PersistentClient from here
```
### Update / upsert / delete
```python
collection.upsert(
ids=["d1"], documents=["Chroma 1.0 has a Rust core for 4x speedup."],
metadatas=[{"category": "perf", "tokens": 8}],
)
collection.delete(where={"category": "intro"})
```
## Performance Tuning
- `hnsw:M = 32` and `hnsw:construction_ef = 200` for collections > 1M
- `hnsw:search_ef` is the runtime knob — start at 100, raise for recall
- Use `EmbeddingFunction` instances that batch (OpenAI, Cohere) — Chroma calls them with batches
- For embedded write-heavy: `chromadb.PersistentClient` keeps SQLite WAL hot
- Server mode is for multi-process access, not raw throughput; embedded is faster single-process
- Avoid frequent collection deletion/recreation — HNSW rebuild is expensive
## Common Pitfalls
- Trying to change distance metric after create — must drop and recreate
- Mixing embedding functions across writes — embeddings of different dim/model are incompatible
- Loading enormous corpora without batched `add()` — memory and disk hits explode
- Treating `where` and `where_document` as one filter — they apply to metadata vs document text respectively
- Multi-modal: forgetting `data_loader` when ingesting `uris` instead of inline image arrays
- Persistent client with relative path under cron — cwd surprises lose your data
## When to Use This Mode
- Local-first prototypes, demos, notebooks where embedded is enough
- Single-node retrieval for small-to-medium corpora (< 10M)
- Multi-modal (text + image) without standing up CLIP infra
- Teams that want the simplest possible API with sane defaults
- Migration target from LangChain `VectorStore` quick wins
## Sources
- Chroma docs: https://docs.trychroma.com/
- Multi-modal: https://docs.trychroma.com/guides/multimodal
- Configure collections: https://docs.trychroma.com/docs/collections/configure
- Chroma cookbook: https://cookbook.chromadb.dev/core/collections/
- GitHub: https://github.com/chroma-core/chroma