Skip to main content
Chroma provides comprehensive type definitions for type-safe interactions with the API.

Core Types

IDs

Record identifiers.
str
A single record identifier.
List[str]
A list of record identifiers.

Documents

Text documents.
str
A single text document.
List[str]
A list of text documents.

Embeddings

Vector embeddings.
ndarray
A single embedding vector as numpy array.
List[ndarray]
A list of embedding vectors.
List[float]
A single embedding as Python list (alternative format).
List[List[float]]
Multiple embeddings as nested Python lists.

Metadata

Record metadata.
Dict[str, Union[str, int, float, bool, List, SparseVector]]
Metadata dictionary. Values can be:
  • Strings
  • Numbers (int or float)
  • Booleans
  • Lists of strings, numbers, or booleans (homogeneous)
  • SparseVector objects
List[Metadata]
A list of metadata dictionaries.
Dict[str, Union[str, int, float, bool, List, SparseVector, None]]
Metadata for updates. Same as Metadata but allows None values to unset fields.

SparseVector

Sparse vector representation.
List[int]
Non-zero indices (must be sorted in ascending order).
List[float]
Corresponding values (must be same length as indices).
Indices must be non-negative, sorted, and have the same length as values.

URIs

Uniform Resource Identifiers for external data.
str
A single URI string.
List[str]
A list of URI strings.

Query Filters

Where

Metadata filter for querying.
Dict
Metadata filter using MongoDB-style query operators:Comparison Operators:
  • {"field": value} - Equality (shorthand)
  • {"field": {"$eq": value}} - Equality
  • {"field": {"$ne": value}} - Not equal
  • {"field": {"$gt": value}} - Greater than
  • {"field": {"$gte": value}} - Greater than or equal
  • {"field": {"$lt": value}} - Less than
  • {"field": {"$lte": value}} - Less than or equal
Set Operators:
  • {"field": {"$in": [values]}} - In list
  • {"field": {"$nin": [values]}} - Not in list
Array Operators:
  • {"field": {"$contains": value}} - Array contains value
  • {"field": {"$not_contains": value}} - Array does not contain value
Logical Operators:
  • {"$and": [conditions]} - All conditions must match
  • {"$or": [conditions]} - Any condition must match

WhereDocument

Document content filter for querying.
Dict
Document content filter using operators:String Operators:
  • {"$contains": "text"} - Document contains substring
  • {"$not_contains": "text"} - Document does not contain substring
  • {"$regex": "pattern"} - Document matches regex
  • {"$not_regex": "pattern"} - Document does not match regex
Logical Operators:
  • {"$and": [conditions]} - All conditions must match
  • {"$or": [conditions]} - Any condition must match

Result Types

GetResult

Result from collection.get() operations.
List[str]
List of record IDs (always included).
List[str]
List of documents (if included).
List[Dict]
List of metadata dictionaries (if included).
List[ndarray]
List of embeddings (if included).
List[str]
List of URIs (if included).
List[str]
List of fields that were included in the query.

QueryResult

Result from collection.query() operations.
List[List[str]]
Nested list of IDs (one list per query).
List[List[str]]
Nested list of documents (if included).
List[List[Dict]]
Nested list of metadata dictionaries (if included).
List[List[ndarray]]
Nested list of embeddings (if included).
List[List[float]]
Nested list of distances (if included).
List[str]
List of fields that were included in the query.

SearchResult

Result from collection.search() operations (experimental).
List[List[str]]
Nested list of IDs (one list per search).
List[List[str]]
Nested list of documents (if selected).
List[List[List[float]]]
Nested list of embeddings (if selected).
List[List[Dict]]
Nested list of metadata dictionaries (if selected).
List[List[float]]
Nested list of ranking scores (if scoring is used).
List[List[str]]
List of selected keys for each payload.
Methods:
  • rows(): Convert column-major format to row-major format, returning List[List[SearchResultRow]]

IndexingStatus

Indexing progress information.
int
Number of user operations that have been indexed.
int
Number of user operations pending indexing.
int
Total number of user operations in the collection.
float
Proportion of operations indexed (value between 0.0 and 1.0).

Schema Configuration Types

Schema

Collection schema for indexing and encryption configuration.

VectorIndexConfig

Configuration for dense vector indexes.
'cosine' | 'l2' | 'ip'
Distance metric: "cosine", "l2" (Euclidean), or "ip" (inner product).
EmbeddingFunction
Embedding function for the index.
str
Source key to extract vectors from. Defaults to "#document" for the default embedding.
HnswIndexConfig
HNSW algorithm configuration.
SpannIndexConfig
SPANN algorithm configuration.

HnswIndexConfig

Hierarchical Navigable Small World (HNSW) algorithm configuration.
int
Size of candidate list during index construction. Higher values improve quality but increase build time.
int
Maximum number of neighbors per node (M parameter). Higher values improve recall but increase memory usage.
Size of candidate list during search. Higher values improve recall but increase query time.
int
Number of threads for index construction.
int
Batch size for index operations.
int
Threshold for syncing index to disk.
float
Factor for resizing the index.

FtsIndexConfig

Full-text search index configuration.
FtsIndexConfig has no configurable parameters. Use it to enable full-text search on document fields.

SparseVectorIndexConfig

Sparse vector index configuration.
SparseEmbeddingFunction
Sparse embedding function for the index.
str
Source key to extract sparse vectors from.
bool
Enable BM25 weighting for sparse vectors.

Inverted Index Configs

Configuration for inverted indexes on metadata fields.
These indexes are automatically enabled on metadata fields by default. No configuration required.

Embedding Functions

EmbeddingFunction

Protocol for implementing custom embedding functions.

Encryption

Cmek

Customer-managed encryption key for collection data.
CmekProvider
Cloud provider (currently only CmekProvider.GCP supported).
str
Provider-specific resource identifier for the encryption key.
Methods:
  • gcp(resource: str): Create a CMEK for Google Cloud Platform
  • validate_pattern(): Validate the resource name format
  • to_dict(): Serialize to dictionary
  • from_dict(data: dict): Deserialize from dictionary