Adding Data
Use.add to insert new records into a collection. Each record needs a unique string id.
documents, embeddings, or both. metadatas are always optional.
When only providing documents, Chroma will generate embeddings for you using the collection’s embedding function.
If you’ve already computed embeddings, pass them alongside documents. Chroma will store both as-is without re-embedding the documents.
ids to associate records with your external documents.
This is a useful pattern if your documents are very large, such as high-resolution
images or videos.
Metadata
Metadata values can be strings, integers, floats, or booleans. Additionally, you can store arrays of these types.$contains and $not_contains operators — see Metadata Filtering for details.
Behaviors
- If you add a record with an ID that already exists in the collection, it will be ignored without throwing an error. In order to overwrite data in your collection, you must update the data.
- If the supplied embeddings don’t match the dimensionality of embeddings already in the collection, an exception will be raised.