Installation
Clients
ChromaClient
Main client class for interacting with ChromaDB. Provides methods for managing collections and performing operations on them.The host address of the Chroma server. Defaults to ‘localhost’
The port number of the Chroma server. Defaults to 8000
Whether to use SSL/HTTPS for connections. Defaults to false
The tenant name in the Chroma server to connect to
The database name to connect to
Additional HTTP headers to send with requests
Additional fetch options for HTTP requests
CloudClient
ChromaDB cloud client for connecting to hosted Chroma instances. Extends ChromaClient with cloud-specific authentication and configuration.AdminClient
Administrative client for managing ChromaDB tenants and databases. Provides methods for creating, deleting, and listing tenants and databases.The host address of the Chroma server
The port number of the Chroma server
Whether to use SSL/HTTPS for connections
Additional HTTP headers to send with requests
Additional fetch options for HTTP requests
Client Methods
heartbeat
Sends a heartbeat request to check server connectivity. Returns: Promise resolving to the server’s nanosecond heartbeat timestamplistCollections
Lists all collections in the current database.countCollections
Gets the total number of collections in the current database. Returns: Promise resolving to the collection countcreateCollection
Creates a new collection with the specified configuration.getCollection
Retrieves an existing collection by name.getOrCreateCollection
Gets an existing collection or creates it if it doesn’t exist.deleteCollection
Deletes a collection and all its data.reset
Resets the entire database, deleting all collections and data. Returns: Promise that resolves when the reset is completeversion
Gets the version of the Chroma server. Returns: Promise resolving to the server version stringAdmin Client Methods
createTenant
Creates a new tenant.getTenant
Retrieves information about a specific tenant.createDatabase
Creates a new database within a tenant.getDatabase
Retrieves information about a specific database.deleteDatabase
Deletes a database and all its data.listDatabases
Lists all databases within a tenant.Listing parameters including tenant and pagination
Collection Methods
count
Gets the total number of records in the collectionadd
Adds new records to the collection.get
Retrieves records from the collection based on filters.peek
Retrieves a preview of records from the collection.query
Performs similarity search on the collection.modify
Modifies collection properties like name, metadata, or configuration.update
Updates existing records in the collection.upsert
Inserts new records or updates existing ones (upsert operation).delete
Deletes records from the collection based on filters.search
Performs hybrid search on the collection using expression builders.Single search payload or array of payloads
Embedding Functions
EmbeddingFunction
Interface for embedding functions. Embedding functions transform text documents into numerical representations that can be used for similarity search and other vector operations. PropertiesOptional name identifier for the embedding function
buildFromConfig(), defaultSpace(), generate(), generateForQueries(), getConfig(), supportedSpaces(), validateConfig(), validateConfigUpdate()
SparseEmbeddingFunction
Interface for sparse embedding functions. Sparse embedding functions transform text documents into sparse numerical representations where only non-zero values are stored, making them efficient for high-dimensional spaces. PropertiesOptional name identifier for the embedding function
buildFromConfig(), generate(), generateForQueries(), getConfig(), validateConfig(), validateConfigUpdate()
Types
CollectionMetadata
Metadata that can be associated with a collection. Values must be boolean, number, or string types.Record< string, boolean | number | string | SparseVector | null >
Metadata
Metadata that can be associated with individual records. Values must be boolean, number, or string types.Record< string, boolean | number | string | SparseVector | null >
Where
Where clause for filtering records based on metadata. Supports field equality, comparison operators, and logical operators.{ [key: string]: LiteralValue | OperatorExpression } | { $and: Where[] } | { $or: Where[] }
WhereDocument
Where clause for filtering based on document content. Supports text search operators and logical combinations.{ $contains: string } | { $not_contains: string } | { $matches: string } | { $not_matches: string } | { $regex: string } | { $not_regex: string } | { $and: WhereDocument[] } | { $or: WhereDocument[] }
GetResult
Result class for get operations, containing retrieved records. PropertiesQueryResult
Result class for query operations, containing search results. PropertiesReadLevel
"index_and_wal" | "index_only"
IncludeEnum
Enum specifying which fields to include in query results."distances" | "documents" | "embeddings" | "metadatas" | "uris"