Overview
Chroma is an open-source embedding database that can run locally or as a server. It’s designed for simplicity and ease of use.Installation
Basic Usage
Constructor Options
string
default:"llamaindex"
Name of the Chroma collection
ChromaClient
Custom Chroma client instance
string
default:"http://localhost:8000"
Chroma server URL
number
default:100
Batch size for operations
Setup Options
In-Memory (Default)
Persistent Local Storage
Remote Server
Running Chroma Server
Docker
Python
Querying
Basic Query
Metadata Filtering
Collections
Manage multiple collections:Managing Data
Add Documents
Delete Documents
Clear Collection
Loading Existing Collection
Distance Metrics
Chroma supports different distance metrics:Embedding Functions
Use custom embedding functions:Complete Example
Best Practices
- Use persistent storage: Enable data persistence for production
- Choose appropriate metric: Cosine for most text use cases
- Organize with collections: Separate data by use case or environment
- Run server for production: Use Chroma server for scalability
- Monitor memory: In-memory mode limited by available RAM