Client Constructors
EphemeralClient()
Create an in-memory client for testing and development.Optional settings to override defaults.
Tenant name to use for requests.
Database name to use for requests.
A configured client instance that stores all data in memory.
Data in EphemeralClient is not persisted to disk and will be lost when the client is closed.
PersistentClient()
Create a persistent client that stores data on disk.Directory to store persisted data.
Optional settings to override defaults.
Tenant name to use for requests.
Database name to use for requests.
A configured client instance that persists data to disk.
HttpClient()
Create a client that connects to a Chroma server over HTTP.Hostname of the Chroma server.
HTTP port of the Chroma server.
Whether to enable SSL for the connection.
Optional headers to send with each request.
Optional settings to override defaults.
Tenant name to use for requests.
Database name to use for requests.
A configured client instance connected to a Chroma server.
If settings specify a different host or port.
CloudClient()
Create a client for Chroma Cloud.Tenant name, or None to infer from
CHROMA_TENANT environment variable.Database name, or None to infer from
CHROMA_DATABASE environment variable.API key for Chroma Cloud. If not provided, inferred from
CHROMA_API_KEY environment variable.Optional settings to override defaults.
A configured client instance for Chroma Cloud.
If no API key is provided or available in the environment.
AsyncHttpClient()
Create an async client that connects to a Chroma HTTP server.Hostname of the Chroma server.
HTTP port of the Chroma server.
Whether to enable SSL for the connection.
Optional headers to send with each request.
Optional settings to override defaults.
Tenant name to use for requests.
Database name to use for requests.
A configured async client instance.
RustClient()
Create a client using Rust bindings for improved performance. Can be ephemeral or persistent.This client uses the Rust implementation for better performance. It’s useful for testing and development but not recommended for production use.
Optional directory to save Chroma’s data to. If None, the client is ephemeral (in-memory).
Optional settings to override defaults.
Tenant name to use for requests.
Database name to use for requests.
A configured Rust-backed client instance.
AdminClient()
Create an admin client for tenant and database management operations.Settings for connecting to the Chroma server.
An admin client for tenant and database management.
create_tenant(name)- Create a new tenantget_tenant(name)- Get tenant informationlist_tenants()- List all tenantscreate_database(name, tenant)- Create a database in a tenantget_database(name, tenant)- Get database informationlist_databases(tenant)- List databases in a tenant
Global Configuration
configure()
Override Chroma’s default settings globally.chroma_api_impl- API implementation to usechroma_server_host- Server hostnamechroma_server_http_port- Server portanonymized_telemetry- Enable/disable telemetry
get_settings()
Get the current global settings.The current global Settings object.
Collection Management
create_collection()
Create a new collection.Collection name.
Optional collection schema for indexes and encryption.
Optional collection metadata.
Optional embedding function for the collection. Defaults to
DefaultEmbeddingFunction().Optional data loader for documents with URIs.
Whether to return an existing collection if present.
The created collection.
If the collection already exists (when
get_or_create=False) or if the embedding function conflicts with configuration.get_collection()
Get an existing collection by name.Collection name.
Optional embedding function for the collection. Defaults to
DefaultEmbeddingFunction().Optional data loader for documents with URIs.
The requested collection.
If the collection does not exist or if the embedding function conflicts with configuration.
get_or_create_collection()
Get an existing collection or create a new one.Collection name.
Optional collection schema. Ignored if the collection already exists.
Optional collection metadata. Ignored if the collection already exists.
Optional embedding function for the collection. Defaults to
DefaultEmbeddingFunction().Optional data loader for URI-backed data.
The existing or newly created collection.
If the embedding function does not match the collection’s embedding function.
If the collection already exists, the
schema, metadata arguments are ignored.list_collections()
List all collections in the current database.Maximum number of collections to return.
Number of collections to skip before returning.
Collection objects for the current tenant and database.
delete_collection()
Delete a collection by name.Collection name to delete.
Client Utilities
heartbeat()
Check if the server is running and return the server time.Server time in nanoseconds since epoch.
get_version()
Get the Chroma server version.The Chroma version string.
close()
Close the client and release all resources.This is particularly important for
PersistentClient to avoid SQLite file locking issues. Use context managers (with statement) for automatic cleanup.Settings
Configure Chroma behavior withSettings.
Common Settings
anonymized_telemetry(bool): Enable/disable anonymized telemetry. Default:Trueallow_reset(bool): Allow resetting the database. Default:Falsechroma_server_host(str): Chroma server hostnamechroma_server_http_port(int): Chroma server HTTP portchroma_server_ssl_enabled(bool): Enable SSL for server connectionschroma_server_headers(Dict[str, str]): Headers to send with requestspersist_directory(str): Directory for persistent storageis_persistent(bool): Enable persistence