ChromaClient
The main client for interacting with Chroma. Manages collections and provides access to the database.Constructor
ChromaClientParams
Client configuration options
Collection Methods
createCollection
Creates a new collection with the specified properties.CreateCollectionParams
required
ChromaConnectionError- If unable to connect to the serverChromaServerError- If there is an issue creating the collection
getCollection
Gets an existing collection with the specified name.GetCollectionParams
required
Error if the collection does not exist or there is an issue getting it
Example:
getOrCreateCollection
Gets or creates a collection with the specified properties.GetOrCreateCollectionParams
required
Same as CreateCollectionParams
Error if there is an issue getting or creating the collection
Example:
deleteCollection
Deletes a collection with the specified name.DeleteCollectionParams
required
Error if there is an issue deleting the collection
Example:
listCollections
Get all collection names.ListCollectionsParams
listCollectionsAndMetadata
List collection names, IDs, and metadata.ListCollectionsParams
Same as listCollections
countCollections
Counts all collections.Utility Methods
version
Returns the version of the Chroma API.ChromaConnectionError if unable to connect to the server
Example:
heartbeat
Returns a heartbeat from the Chroma API.ChromaConnectionError if unable to connect to the server
Example:
reset
Resets the state of the database.ChromaConnectionError- If unable to connect to the serverChromaServerError- If the server experienced an error
CloudClient
A client for connecting to Chroma Cloud. Extends ChromaClient with cloud-specific configuration.Constructor
CloudClientParams
required
Error if no API key is provided and CHROMA_API_KEY environment variable is not set
Example:
CloudClient inherits all methods from ChromaClient. See the ChromaClient documentation above for available methods.
AdminClient
A client for administrative operations like managing tenants and databases.Constructor
object
Tenant Methods
createTenant
Creates a new tenant.string
required
The name of the tenant to create
Error if there is an issue creating the tenant
Example:
getTenant
Gets a tenant by name.string
required
The name of the tenant to get
Error if there is an issue getting the tenant
Example:
setTenant
Sets the tenant and database for the client.object
required
Error if there is an issue
Example:
Database Methods
createDatabase
Creates a new database.object
required
Error if there is an issue creating the database
Example:
getDatabase
Gets a database by name.object
required
Error if there is an issue getting the database
Example:
deleteDatabase
Deletes a database.object
required
Error if there is an issue deleting the database
Example:
listDatabases
Lists databases for a specific tenant.object
required
Error if there is an issue listing the databases
Example:
setDatabase
Sets the database for the client.string
The name of the database
Error if there is an issue
Example: