chromadb-advanced
БесплатноБез исполняемых скриптовНе проверенChromaDB 0.5+ advanced features. Persistent vs ephemeral clients, collection-level HNSW tuning (space, construction_ef, M), multi-tenancy via collections…
от claude-dev-suite★ 51 звезда на GitHubОб этом скилле
ChromaDB Advanced
Where Chroma Fits
Chroma is the go-to local-first vector DB for prototypes, notebooks, and small production workloads. Strengths:
- Single
pip install chromadb, runs in-process or as a server. - Simple, consistent API across embeddings, storage, and querying.
- Good defaults, low ceremony.
Known limits:
- Single-node architecture (no sharding in OSS).
- Throughput and recall curves tail off past 10-20M vectors.
- Filter performance worse than purpose-built stores at high cardinality.
Plan a migration path to Qdrant / Pinecone / Milvus when approaching those limits — see the end of this skill.
Persistent vs Ephemeral vs HTTP Client
# pip install chromadb>=0.5
import chromadb
# In-memory, wiped on exit
client = chromadb.EphemeralClient()
# On-disk, survives restarts
client = chromadb.PersistentClient(path="./.chroma")
# HTTP client to a remote Chroma server
client = chromadb.HttpClient(host="chroma.internal", port=8000, ssl=False)
# Chroma Cloud
client = chromadb.CloudClient(
tenant="your-tenant",
database="default",
api_key=os.environ["CHROMA_API_KEY"],
)
In production, run a dedicated Chroma server (chroma run --path /data) or use Chroma Cloud — never rely on the persistent client inside a web server that scales horizontally (file-level locking fights concurrent writers).
Collection Creation with HNSW Tuning
collection = client.create_collection(
name="docs",
metadata={
"hnsw:space": "cosine", # cosine | l2 | ip
"hnsw:construction_ef": 200, # build-time breadth
"hnsw:M": 32, # connections per node
"hnsw:search_ef": 100, # query-time breadth (higher = better recall)
"hnsw:num_threads": 4,
"hnsw:batch_size": 100, # cached writes before rebuilding HNSW
"hnsw:sync_threshold": 1000,
},
)
Defaults (M=16, construction_ef=100, search_ef=10) under-serve production recall. Raise M to 24-32, construction_ef to 200, and search_ef to 64-128 on any corpus > 100k vectors.
hnsw:space must be set at creation — cannot change later without rebuilding.
Embedding Functions
Chroma can compute embeddings for you on insert and query.
from chromadb.utils import embedding_functions
openai_ef = embedding_functions.OpenAIEmbeddingFunction(
api_key=os.environ["OPENAI_API_KEY"],
model_name="text-embedding-3-small",
dimensions=1024, # Matryoshka truncation
)
cohere_ef = embedding_functions.CohereEmbeddingFunction(
api_key=os.environ["COHERE_API_KEY"],
model_name="embed-multilingual-v3.0",
)
voyage_ef = embedding_functions.VoyageAIEmbeddingFunction(
api_key=os.environ["VOYAGE_API_KEY"],
model_name="voyage-3",
)
st_ef = embedding_functions.SentenceTransformerEmbeddingFunction(
model_name="BAAI/bge-base-en-v1.5",
)
collection = client.create_collection(
name="docs",
embedding_function=openai_ef,
metadata={"hnsw:space": "cosine", "hnsw:M": 32},
)
Text in, vectors stored automatically. For large ingests, batch via the embedding function directly and feed precomputed vectors to avoid redundant API calls.
Custom Embedding Function
from chromadb import EmbeddingFunction, Documents, Embeddings
class MyEmbedder(EmbeddingFunction[Documents]):
def __init__(self, model): self.model = model
def __call__(self, input: Documents) -> Embeddings:
return self.model.encode(input).tolist()
collection = client.create_collection(
name="docs",
embedding_function=MyEmbedder(my_st_model),
)
Chroma stores the embedding function's name() so reads can reattach the same function automatically.
Insert / Upsert
collection.add(
ids=["d1", "d2", "d3"],
documents=["OAuth uses refresh tokens.", "PKCE protects public clients.", "..."],
metadatas=[{"source": "kb", "tenant_id": "acme"}] * 3,
)
# Upsert: insert or update
collection.upsert(
ids=["d1"],
documents=["Updated text."],
metadatas=[{"source": "kb", "tenant_id": "acme", "rev": 2}],
)
Batch size: keep batches under 5000 IDs to avoid memory spikes during HNSW merge.
Query
result = collection.query(
query_texts=["how do I refresh a token"], # embedded by the collection's ef
n_results=10,
where={
"$and": [
{"tenant_id": {"$eq": "acme"}},
{"source": {"$in": ["kb", "faq"]}},
{"created_at": {"$gte": 1700000000}},
],
},
where_document={"$contains": "refresh"},
include=["documents", "metadatas", "distances"],
)
Two filter kinds:
where: metadata filters (typed operators$eq,$ne,$gt,$gte,$lt,$lte,$in,$nin,$and,$or).where_document: substring/regex on document text ($contains,$not_contains).
Chroma applies both before the ANN search (pre-filter) when the filter is selective enough.
Multi
Установить chromadb-advanced в Claude Code и Claude Desktop
Зарегайся, чтобы установить скилл
Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.
- Открой команду установки в одну строку
- Сохраняй скиллы в синхронизируемую библиотеку
- Уведомления, когда скиллы обновляются
Разрешённые инструменты
Инструменты, которые скиллу разрешено вызывать.
ReadGrepGlobWriteEditFAQ
Что делает скилл chromadb-advanced?
ChromaDB 0.5+ advanced features. Persistent vs ephemeral clients, collection-level HNSW tuning (space, construction_ef, M), multi-tenancy via collections, metadata filtering, embedding function plugins (OpenAI, Cohere, Voyage, custom), Chroma Cloud, recall tuning, migration patterns to production stores. USE WHEN: user mentions "Chroma", "ChromaDB", "chromadb-client", "Chroma Cloud", "Chroma collection", "chroma embedding function" DO NOT USE FOR: production-scale vector stores - use `vector-stores/qdrant-advanced`, `vector-stores/milvus`, or `vector-stores/pinecone-advanced`; hybrid search theory - use `rag/hybrid-search`
Как установить скилл chromadb-advanced?
Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.
Скилл chromadb-advanced запускает скрипты?
Нет, скилл состоит только из инструкций (SKILL.md), без исполняемых скриптов.
Похожие скиллы
agent-skill-stack
Find, evaluate, and assemble the smallest compatible set of AI Agent Skills for an end-to-end natural-language goal. Use when a user wants Skills for a…
от GitHubbuild-evidence-map
Build an auditable evidence map for a contested technical choice, research synthesis, proposal review, or consequential decision. Use when Copilot must…
от GitHubpinecone-rag
Build production RAG pipelines and persistent agent memory using Pinecone as the vector database backend. ALWAYS USE THIS SKILL when the user mentions…
от GitHubqdrant-monitoring-debugging
Diagnoses Qdrant production issues using metrics and observability tools. Use when someone reports 'optimizer stuck', 'indexing too slow', 'memory too high'…
от GitHub