There are several ways you can instantiate clients to connect to your Chroma database.Documentation Index
Fetch the complete documentation index at: https://docs.trychroma.com/llms.txt
Use this file to discover all available pages before exploring further.
Cloud Client
You can use theCloudClient to create a client connecting to Chroma Cloud.
CloudClient can be instantiated just with the API key argument. In which case, we will resolve the tenant and DB from Chroma Cloud. Note our auto-resolution will work only if the provided API key is scoped to a single DB.
If you set the CHROMA_API_KEY, CHROMA_TENANT, and the CHROMA_DATABASE environment variables, you can simply instantiate a CloudClient with no arguments:
Connecting to a non-default region
By default,CloudClient connects to api.trychroma.com (AWS us-east-1). To target a database in another region — for example, our GCP europe-west1 region — point the client at that region’s hostname. See Regions for the list of available endpoints.
.env block. For databases outside aws-us-east-1, the snippet sets CHROMA_HOST to the region-specific host:
In-Memory Client
In Python, you can run a Chroma server in-memory and connect to it with the ephemeral client:Client() method starts a Chroma server in-memory and also returns a client with which you can connect to it.
This is a great tool for experimenting with different embedding functions and retrieval techniques in a Python notebook, for example. If you don’t need data persistence, the ephemeral client is a good choice for getting up and running with Chroma.
Persistent Client
- Python
- TypeScript
- Rust
You can configure Chroma to save and load the database from your local machine, using the The
PersistentClient.Data will be persisted automatically and loaded on start (if it exists).path is where Chroma will store its database files on disk, and load them on start. If you don’t provide a path, the default is .chromaThe client object has a few useful convenience methods.heartbeat()- returns a nanosecond heartbeat. Useful for making sure the client remains connected.reset()- empties and completely resets the database. WARNING: This is destructive and not reversible.