* docs: deep audit — fix stale config keys, missing commands, and registry drift Cross-checked ~80 high-impact docs pages (getting-started, reference, top-level user-guide, user-guide/features) against the live registries: hermes_cli/commands.py COMMAND_REGISTRY (slash commands) hermes_cli/auth.py PROVIDER_REGISTRY (providers) hermes_cli/config.py DEFAULT_CONFIG (config keys) toolsets.py TOOLSETS (toolsets) tools/registry.py get_all_tool_names() (tools) python -m hermes_cli.main <subcmd> --help (CLI args) reference/ - cli-commands.md: drop duplicate hermes fallback row + duplicate section, add stepfun/lmstudio to --provider enum, expand auth/mcp/curator subcommand lists to match --help output (status/logout/spotify, login, archive/prune/ list-archived). - slash-commands.md: add missing /sessions and /reload-skills entries + correct the cross-platform Notes line. - tools-reference.md: drop bogus '68 tools' headline, drop fictional 'browser-cdp toolset' (these tools live in 'browser' and are runtime-gated), add missing 'kanban' and 'video' toolset sections, fix MCP example to use the real mcp_<server>_<tool> prefix. - toolsets-reference.md: list browser_cdp/browser_dialog inside the 'browser' row, add missing 'kanban' and 'video' toolset rows, drop the stale '38 tools' count for hermes-cli. - profile-commands.md: add missing install/update/info subcommands, document fish completion. - environment-variables.md: dedupe GMI_API_KEY/GMI_BASE_URL rows (kept the one with the correct gmi-serving.com default). - faq.md: Anthropic/Google/OpenAI examples — direct providers exist (not just via OpenRouter), refresh the OpenAI model list. getting-started/ - installation.md: PortableGit (not MinGit) is what the Windows installer fetches; document the 32-bit MinGit fallback. - installation.md / termux.md: installer prefers .[termux-all] then falls back to .[termux]. - nix-setup.md: Python 3.12 (not 3.11), Node.js 22 (not 20); fix invalid 'nix flake update --flake' invocation. - updating.md: 'hermes backup restore --state pre-update' doesn't exist — point at the snapshot/quick-snapshot flow; correct config key 'updates.pre_update_backup' (was 'update.backup'). user-guide/ - configuration.md: api_max_retries default 3 (not 2); display.runtime_footer is the real key (not display.runtime_metadata_footer); checkpoints defaults enabled=false / max_snapshots=20 (not true / 50). - configuring-models.md: 'hermes model list' / 'hermes model set ...' don't exist — hermes model is interactive only. - tui.md: busy_indicator -> tui_status_indicator with values kaomoji|emoji|unicode|ascii (not kawaii|minimal|dots|wings|none). - security.md: SSH backend keys (TERMINAL_SSH_HOST/USER/KEY) live in .env, not config.yaml. - windows-wsl-quickstart.md: there is no 'hermes api' subcommand — the OpenAI-compatible API server runs inside hermes gateway. user-guide/features/ - computer-use.md: approvals.mode (not security.approval_level); fix broken ./browser-use.md link to ./browser.md. - fallback-providers.md: top-level fallback_providers (not model.fallback_providers); the picker is subcommand-based, not modal. - api-server.md: API_SERVER_* are env vars — write to per-profile .env, not 'hermes config set' which targets YAML. - web-search.md: drop web_crawl as a registered tool (it isn't); deep-crawl modes are exposed through web_extract. - kanban.md: failure_limit default is 2, not '~5'. - plugins.md: drop hard-coded '33 providers' count. - honcho.md: fix unclosed quote in echo HONCHO_API_KEY snippet; document that 'hermes honcho' subcommand is gated on memory.provider=honcho; reconcile subcommand list with actual --help output. - memory-providers.md: legacy 'hermes honcho setup' redirect documented. Verified via 'npm run build' — site builds cleanly; broken-link count went from 149 to 146 (no regressions, fixed a few in passing). * docs: round 2 audit fixes + regenerate skill catalogs Follow-up to the previous commit on this branch: Round 2 manual fixes: - quickstart.md: KIMI_CODING_API_KEY mentioned alongside KIMI_API_KEY; voice-mode and ACP install commands rewritten — bare 'pip install ...' doesn't work for curl-installed setups (no pip on PATH, not in repo dir); replaced with 'cd ~/.hermes/hermes-agent && uv pip install -e ".[voice]"'. ACP already ships in [all] so the curl install includes it. - cli.md / configuration.md: 'auxiliary.compression.model' shown as 'google/gemini-3-flash-preview' (the doc's own claimed default); actual default is empty (= use main model). Reworded as 'leave empty (default) or pin a cheap model'. - built-in-plugins.md: added the bundled 'kanban/dashboard' plugin row that was missing from the table. Regenerated skill catalogs: - ran website/scripts/generate-skill-docs.py to refresh all 163 per-skill pages and both reference catalogs (skills-catalog.md, optional-skills-catalog.md). This adds the entries that were genuinely missing — productivity/teams-meeting-pipeline (bundled), optional/finance/* (entire category — 7 skills: 3-statement-model, comps-analysis, dcf-model, excel-author, lbo-model, merger-model, pptx-author), creative/hyperframes, creative/kanban-video-orchestrator, devops/watchers, productivity/shop-app, research/searxng-search, apple/macos-computer-use — and rewrites every other per-skill page from the current SKILL.md. Most diffs are tiny (one line of refreshed metadata). Validation: - 'npm run build' succeeded. - Broken-link count moved 146 -> 155 — the +9 are zh-Hans translation shells that lag every newly-added skill page (pre-existing pattern). No regressions on any en/ page.
426 lines
9.7 KiB
Markdown
426 lines
9.7 KiB
Markdown
---
|
|
title: "Chroma — Open-source embedding database for AI applications"
|
|
sidebar_label: "Chroma"
|
|
description: "Open-source embedding database for AI applications"
|
|
---
|
|
|
|
{/* This page is auto-generated from the skill's SKILL.md by website/scripts/generate-skill-docs.py. Edit the source SKILL.md, not this page. */}
|
|
|
|
# Chroma
|
|
|
|
Open-source embedding database for AI applications. Store embeddings and metadata, perform vector and full-text search, filter by metadata. Simple 4-function API. Scales from notebooks to production clusters. Use for semantic search, RAG applications, or document retrieval. Best for local development and open-source projects.
|
|
|
|
## Skill metadata
|
|
|
|
| | |
|
|
|---|---|
|
|
| Source | Optional — install with `hermes skills install official/mlops/chroma` |
|
|
| Path | `optional-skills/mlops/chroma` |
|
|
| Version | `1.0.0` |
|
|
| Author | Orchestra Research |
|
|
| License | MIT |
|
|
| Dependencies | `chromadb`, `sentence-transformers` |
|
|
| Platforms | linux, macos, windows |
|
|
| Tags | `RAG`, `Chroma`, `Vector Database`, `Embeddings`, `Semantic Search`, `Open Source`, `Self-Hosted`, `Document Retrieval`, `Metadata Filtering` |
|
|
|
|
## Reference: full SKILL.md
|
|
|
|
:::info
|
|
The following is the complete skill definition that Hermes loads when this skill is triggered. This is what the agent sees as instructions when the skill is active.
|
|
:::
|
|
|
|
# Chroma - Open-Source Embedding Database
|
|
|
|
The AI-native database for building LLM applications with memory.
|
|
|
|
## When to use Chroma
|
|
|
|
**Use Chroma when:**
|
|
- Building RAG (retrieval-augmented generation) applications
|
|
- Need local/self-hosted vector database
|
|
- Want open-source solution (Apache 2.0)
|
|
- Prototyping in notebooks
|
|
- Semantic search over documents
|
|
- Storing embeddings with metadata
|
|
|
|
**Metrics**:
|
|
- **24,300+ GitHub stars**
|
|
- **1,900+ forks**
|
|
- **v1.3.3** (stable, weekly releases)
|
|
- **Apache 2.0 license**
|
|
|
|
**Use alternatives instead**:
|
|
- **Pinecone**: Managed cloud, auto-scaling
|
|
- **FAISS**: Pure similarity search, no metadata
|
|
- **Weaviate**: Production ML-native database
|
|
- **Qdrant**: High performance, Rust-based
|
|
|
|
## Quick start
|
|
|
|
### Installation
|
|
|
|
```bash
|
|
# Python
|
|
pip install chromadb
|
|
|
|
# JavaScript/TypeScript
|
|
npm install chromadb @chroma-core/default-embed
|
|
```
|
|
|
|
### Basic usage (Python)
|
|
|
|
```python
|
|
import chromadb
|
|
|
|
# Create client
|
|
client = chromadb.Client()
|
|
|
|
# Create collection
|
|
collection = client.create_collection(name="my_collection")
|
|
|
|
# Add documents
|
|
collection.add(
|
|
documents=["This is document 1", "This is document 2"],
|
|
metadatas=[{"source": "doc1"}, {"source": "doc2"}],
|
|
ids=["id1", "id2"]
|
|
)
|
|
|
|
# Query
|
|
results = collection.query(
|
|
query_texts=["document about topic"],
|
|
n_results=2
|
|
)
|
|
|
|
print(results)
|
|
```
|
|
|
|
## Core operations
|
|
|
|
### 1. Create collection
|
|
|
|
```python
|
|
# Simple collection
|
|
collection = client.create_collection("my_docs")
|
|
|
|
# With custom embedding function
|
|
from chromadb.utils import embedding_functions
|
|
|
|
openai_ef = embedding_functions.OpenAIEmbeddingFunction(
|
|
api_key="your-key",
|
|
model_name="text-embedding-3-small"
|
|
)
|
|
|
|
collection = client.create_collection(
|
|
name="my_docs",
|
|
embedding_function=openai_ef
|
|
)
|
|
|
|
# Get existing collection
|
|
collection = client.get_collection("my_docs")
|
|
|
|
# Delete collection
|
|
client.delete_collection("my_docs")
|
|
```
|
|
|
|
### 2. Add documents
|
|
|
|
```python
|
|
# Add with auto-generated IDs
|
|
collection.add(
|
|
documents=["Doc 1", "Doc 2", "Doc 3"],
|
|
metadatas=[
|
|
{"source": "web", "category": "tutorial"},
|
|
{"source": "pdf", "page": 5},
|
|
{"source": "api", "timestamp": "2025-01-01"}
|
|
],
|
|
ids=["id1", "id2", "id3"]
|
|
)
|
|
|
|
# Add with custom embeddings
|
|
collection.add(
|
|
embeddings=[[0.1, 0.2, ...], [0.3, 0.4, ...]],
|
|
documents=["Doc 1", "Doc 2"],
|
|
ids=["id1", "id2"]
|
|
)
|
|
```
|
|
|
|
### 3. Query (similarity search)
|
|
|
|
```python
|
|
# Basic query
|
|
results = collection.query(
|
|
query_texts=["machine learning tutorial"],
|
|
n_results=5
|
|
)
|
|
|
|
# Query with filters
|
|
results = collection.query(
|
|
query_texts=["Python programming"],
|
|
n_results=3,
|
|
where={"source": "web"}
|
|
)
|
|
|
|
# Query with metadata filters
|
|
results = collection.query(
|
|
query_texts=["advanced topics"],
|
|
where={
|
|
"$and": [
|
|
{"category": "tutorial"},
|
|
{"difficulty": {"$gte": 3}}
|
|
]
|
|
}
|
|
)
|
|
|
|
# Access results
|
|
print(results["documents"]) # List of matching documents
|
|
print(results["metadatas"]) # Metadata for each doc
|
|
print(results["distances"]) # Similarity scores
|
|
print(results["ids"]) # Document IDs
|
|
```
|
|
|
|
### 4. Get documents
|
|
|
|
```python
|
|
# Get by IDs
|
|
docs = collection.get(
|
|
ids=["id1", "id2"]
|
|
)
|
|
|
|
# Get with filters
|
|
docs = collection.get(
|
|
where={"category": "tutorial"},
|
|
limit=10
|
|
)
|
|
|
|
# Get all documents
|
|
docs = collection.get()
|
|
```
|
|
|
|
### 5. Update documents
|
|
|
|
```python
|
|
# Update document content
|
|
collection.update(
|
|
ids=["id1"],
|
|
documents=["Updated content"],
|
|
metadatas=[{"source": "updated"}]
|
|
)
|
|
```
|
|
|
|
### 6. Delete documents
|
|
|
|
```python
|
|
# Delete by IDs
|
|
collection.delete(ids=["id1", "id2"])
|
|
|
|
# Delete with filter
|
|
collection.delete(
|
|
where={"source": "outdated"}
|
|
)
|
|
```
|
|
|
|
## Persistent storage
|
|
|
|
```python
|
|
# Persist to disk
|
|
client = chromadb.PersistentClient(path="./chroma_db")
|
|
|
|
collection = client.create_collection("my_docs")
|
|
collection.add(documents=["Doc 1"], ids=["id1"])
|
|
|
|
# Data persisted automatically
|
|
# Reload later with same path
|
|
client = chromadb.PersistentClient(path="./chroma_db")
|
|
collection = client.get_collection("my_docs")
|
|
```
|
|
|
|
## Embedding functions
|
|
|
|
### Default (Sentence Transformers)
|
|
|
|
```python
|
|
# Uses sentence-transformers by default
|
|
collection = client.create_collection("my_docs")
|
|
# Default model: all-MiniLM-L6-v2
|
|
```
|
|
|
|
### OpenAI
|
|
|
|
```python
|
|
from chromadb.utils import embedding_functions
|
|
|
|
openai_ef = embedding_functions.OpenAIEmbeddingFunction(
|
|
api_key="your-key",
|
|
model_name="text-embedding-3-small"
|
|
)
|
|
|
|
collection = client.create_collection(
|
|
name="openai_docs",
|
|
embedding_function=openai_ef
|
|
)
|
|
```
|
|
|
|
### HuggingFace
|
|
|
|
```python
|
|
huggingface_ef = embedding_functions.HuggingFaceEmbeddingFunction(
|
|
api_key="your-key",
|
|
model_name="sentence-transformers/all-mpnet-base-v2"
|
|
)
|
|
|
|
collection = client.create_collection(
|
|
name="hf_docs",
|
|
embedding_function=huggingface_ef
|
|
)
|
|
```
|
|
|
|
### Custom embedding function
|
|
|
|
```python
|
|
from chromadb import Documents, EmbeddingFunction, Embeddings
|
|
|
|
class MyEmbeddingFunction(EmbeddingFunction):
|
|
def __call__(self, input: Documents) -> Embeddings:
|
|
# Your embedding logic
|
|
return embeddings
|
|
|
|
my_ef = MyEmbeddingFunction()
|
|
collection = client.create_collection(
|
|
name="custom_docs",
|
|
embedding_function=my_ef
|
|
)
|
|
```
|
|
|
|
## Metadata filtering
|
|
|
|
```python
|
|
# Exact match
|
|
results = collection.query(
|
|
query_texts=["query"],
|
|
where={"category": "tutorial"}
|
|
)
|
|
|
|
# Comparison operators
|
|
results = collection.query(
|
|
query_texts=["query"],
|
|
where={"page": {"$gt": 10}} # $gt, $gte, $lt, $lte, $ne
|
|
)
|
|
|
|
# Logical operators
|
|
results = collection.query(
|
|
query_texts=["query"],
|
|
where={
|
|
"$and": [
|
|
{"category": "tutorial"},
|
|
{"difficulty": {"$lte": 3}}
|
|
]
|
|
} # Also: $or
|
|
)
|
|
|
|
# Contains
|
|
results = collection.query(
|
|
query_texts=["query"],
|
|
where={"tags": {"$in": ["python", "ml"]}}
|
|
)
|
|
```
|
|
|
|
## LangChain integration
|
|
|
|
```python
|
|
from langchain_chroma import Chroma
|
|
from langchain_openai import OpenAIEmbeddings
|
|
from langchain.text_splitter import RecursiveCharacterTextSplitter
|
|
|
|
# Split documents
|
|
text_splitter = RecursiveCharacterTextSplitter(chunk_size=1000)
|
|
docs = text_splitter.split_documents(documents)
|
|
|
|
# Create Chroma vector store
|
|
vectorstore = Chroma.from_documents(
|
|
documents=docs,
|
|
embedding=OpenAIEmbeddings(),
|
|
persist_directory="./chroma_db"
|
|
)
|
|
|
|
# Query
|
|
results = vectorstore.similarity_search("machine learning", k=3)
|
|
|
|
# As retriever
|
|
retriever = vectorstore.as_retriever(search_kwargs={"k": 5})
|
|
```
|
|
|
|
## LlamaIndex integration
|
|
|
|
```python
|
|
from llama_index.vector_stores.chroma import ChromaVectorStore
|
|
from llama_index.core import VectorStoreIndex, StorageContext
|
|
import chromadb
|
|
|
|
# Initialize Chroma
|
|
db = chromadb.PersistentClient(path="./chroma_db")
|
|
collection = db.get_or_create_collection("my_collection")
|
|
|
|
# Create vector store
|
|
vector_store = ChromaVectorStore(chroma_collection=collection)
|
|
storage_context = StorageContext.from_defaults(vector_store=vector_store)
|
|
|
|
# Create index
|
|
index = VectorStoreIndex.from_documents(
|
|
documents,
|
|
storage_context=storage_context
|
|
)
|
|
|
|
# Query
|
|
query_engine = index.as_query_engine()
|
|
response = query_engine.query("What is machine learning?")
|
|
```
|
|
|
|
## Server mode
|
|
|
|
```python
|
|
# Run Chroma server
|
|
# Terminal: chroma run --path ./chroma_db --port 8000
|
|
|
|
# Connect to server
|
|
import chromadb
|
|
from chromadb.config import Settings
|
|
|
|
client = chromadb.HttpClient(
|
|
host="localhost",
|
|
port=8000,
|
|
settings=Settings(anonymized_telemetry=False)
|
|
)
|
|
|
|
# Use as normal
|
|
collection = client.get_or_create_collection("my_docs")
|
|
```
|
|
|
|
## Best practices
|
|
|
|
1. **Use persistent client** - Don't lose data on restart
|
|
2. **Add metadata** - Enables filtering and tracking
|
|
3. **Batch operations** - Add multiple docs at once
|
|
4. **Choose right embedding model** - Balance speed/quality
|
|
5. **Use filters** - Narrow search space
|
|
6. **Unique IDs** - Avoid collisions
|
|
7. **Regular backups** - Copy chroma_db directory
|
|
8. **Monitor collection size** - Scale up if needed
|
|
9. **Test embedding functions** - Ensure quality
|
|
10. **Use server mode for production** - Better for multi-user
|
|
|
|
## Performance
|
|
|
|
| Operation | Latency | Notes |
|
|
|-----------|---------|-------|
|
|
| Add 100 docs | ~1-3s | With embedding |
|
|
| Query (top 10) | ~50-200ms | Depends on collection size |
|
|
| Metadata filter | ~10-50ms | Fast with proper indexing |
|
|
|
|
## Resources
|
|
|
|
- **GitHub**: https://github.com/chroma-core/chroma ⭐ 24,300+
|
|
- **Docs**: https://docs.trychroma.com
|
|
- **Discord**: https://discord.gg/MMeYNTmh3x
|
|
- **Version**: 1.3.3+
|
|
- **License**: Apache 2.0
|