chromadb library

Dart client for the ChromaDB vector database API.

This library provides a type-safe, well-documented interface to ChromaDB for Dart and Flutter applications.

Quick Start

import 'package:chromadb/chromadb.dart';

void main() async {
  // Create a client for local ChromaDB instance
  final client = ChromaClient();

  // Check server health
  final heartbeat = await client.health.heartbeat();
  print('Server time: ${heartbeat.nanosecondHeartbeat}');

  // Get server version
  final version = await client.health.version();
  print('Server version: ${version.version}');

  // Clean up
  client.close();
}

Authentication

For ChromaDB Cloud or secured instances, provide an API key:

final client = ChromaClient(
  config: ChromaConfig(
    baseUrl: 'https://api.trychroma.com',
    authProvider: ApiKeyProvider('your-api-key'),
  ),
);

Multi-Tenant Support

Specify tenant and database for multi-tenant deployments:

final client = ChromaClient(
  config: ChromaConfig(
    tenant: 'my-tenant',
    database: 'my-database',
  ),
);

Classes

ApiKeyCredentials
API key authentication using the x-chroma-token header.
ApiKeyProvider
Provider for API key authentication.
AttachedFunction
Full details of an attached function.
AttachedFunctionInfo
Brief information about an attached function.
AttachFunctionRequest
Request to attach a function to a collection.
AttachFunctionResponse
Response from attaching a function to a collection.
AuthCredentials
Represents authentication credentials for API requests.
AuthProvider
Provides authentication credentials for ChromaDB API requests.
AuthResource
Resource for authentication endpoints.
BearerTokenCredentials
Bearer token authentication using the Authorization header.
BearerTokenProvider
Provider for bearer token authentication.
ChromaClient
Client for interacting with the ChromaDB vector database API.
ChromaCollection
High-level collection wrapper with automatic embedding generation.
ChromaConfig
Configuration for the ChromaDB client.
Collection
A ChromaDB collection.
CollectionConfiguration
Configuration settings for a collection.
CollectionSchema
Schema representation for collection index configurations.
CollectionsResource
Resource for collection management endpoints.
CreateCollectionRequest
Request to create a new collection.
CreateDatabaseRequest
Request to create a new database.
CreateTenantRequest
Request to create a new tenant.
Database
A ChromaDB database.
DatabasesResource
Resource for database management endpoints.
DataLoader<T>
Interface for loading data from URIs.
DetachFunctionRequest
Request to detach a function from a collection.
DetachFunctionResponse
Response from detaching a function from a collection.
Embeddable
Input for embedding generation.
EmbeddableDocument
An embeddable text document.
EmbeddableImage
An embeddable base64-encoded image.
EmbeddingFunction
Interface for custom embedding generation.
FunctionsResource
Resource for serverless function operations on a collection.
GetAttachedFunctionResponse
Response from getting an attached function.
GetResponse
Response from a get records operation.
HealthResource
Resource for health and status endpoints.
HeartbeatResponse
Response from the heartbeat endpoint.
NoAuthCredentials
Indicates no authentication should be used.
NoAuthProvider
Provider that supplies no authentication credentials.
QueryResponse
Response from a query records operation.
RecordsResource
Resource for record operations within a collection.
RequestMetadata
Metadata about an HTTP request.
ResponseMetadata
Metadata about an HTTP response.
RetryPolicy
Configuration for retry behavior.
SearchFilter
Filter criteria for a search query.
SearchGroupBy
Grouping criteria for search results.
SearchLimit
Pagination limits for search results.
SearchPayload
A single search query within a search request.
SearchResponse
Response from a search records operation.
SearchSelect
Field selection for search results.
Tenant
A ChromaDB tenant.
TenantsResource
Resource for tenant management endpoints.
UpdateCollectionRequest
Request to update a collection.
UpdateTenantRequest
Request to update a tenant.
UserIdentity
Response from the auth identity endpoint.
VersionResponse
Response from the version endpoint.

Enums

Include
Fields to include in record responses.

Typedefs

Loadable = List<String>
Type alias for loadable data (list of base64-encoded strings).

Exceptions / Errors

AbortedException
Exception thrown when a request is aborted.
ApiException
Exception thrown when the API returns an error response.
AuthenticationException
Exception thrown when authentication fails.
ChromaException
Base class for all ChromaDB exceptions.
ConflictException
Exception thrown when there is a conflict with the current state.
NotFoundException
Exception thrown when a requested resource is not found.
RateLimitException
Exception thrown when a request exceeds rate limits.
ServerException
Exception thrown when the server encounters an error.
TimeoutException
Exception thrown when a request times out.
ValidationException
Exception thrown when request validation fails.