> For the complete documentation index, see [llms.txt](https://utca.knowledgator.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://utca.knowledgator.com/datasources/db/chroma.md).

# Chroma

## Module: [implementation](/framework-structure.md#implementation).datasources.db

***

***

## <mark style="color:green;">ChromaDBCreateCollection</mark>

Create collection. Subclass of [**Action**](/core/action.md)**.** Type of [**Action**](/core/action.md)**\[str,** [**Collection**](https://cookbook.chromadb.dev/core/collections/)**]**

***

### <mark style="color:blue;">\_\_init\_\_</mark>

#### Arguments:

* <mark style="color:orange;">**client**</mark>**&#x20;(**[**ClientAPI**](https://cookbook.chromadb.dev/core/clients/)**):** ChromaDB client to use.
* <mark style="color:orange;">**embedding\_function**</mark>**&#x20;(Optional\[**[**EmbeddingFunction**](https://cookbook.chromadb.dev/embeddings/bring-your-own-embeddings/)**\[Embeddable]], optional):** Embedding function to use. If equals to None, default will be used. Defaults to None.
* <mark style="color:orange;">**metadata**</mark>**&#x20;(Optional\[Dict\[str, Any]], optional):** Collection metadata. Defaults to None.
* <mark style="color:orange;">**name**</mark>**&#x20;(Optional\[str], optional):** Name for identification. If equals to None, class name will be used. Defaults to None.

***

### <mark style="color:blue;">execute</mark>

#### Arguments:

* <mark style="color:orange;">**input\_data**</mark>**&#x20;(str):** The name of the collection to create.

#### Returns:

* [**Collection**](https://cookbook.chromadb.dev/core/collections/)**:** The newly created collection.

***

***

***

## <mark style="color:green;">ChromaDBGetCollection</mark>

Get collection. Subclass of [**Action**](/core/action.md)**.** Type of [**Action**](/core/action.md)**\[str,** [**Collection**](https://cookbook.chromadb.dev/core/collections/)**]**

***

### <mark style="color:blue;">\_\_init\_\_</mark>

#### Arguments:

* <mark style="color:orange;">**client**</mark>**&#x20;(**[**ClientAPI**](https://cookbook.chromadb.dev/core/clients/)**):** ChromaDB client to use.
* <mark style="color:orange;">**embedding\_function**</mark>**&#x20;(Optional\[**[**EmbeddingFunction**](https://cookbook.chromadb.dev/embeddings/bring-your-own-embeddings/)**\[Embeddable]], optional):** Embedding function to use. If equals to None, default will be used. Defaults to None.
* <mark style="color:orange;">**metadata**</mark>**&#x20;(Optional\[Dict\[str, Any]], optional):** Collection metadata. Defaults to None.
* <mark style="color:orange;">**name**</mark>**&#x20;(Optional\[str], optional):** Name for identification. If equals to None, class name will be used. Defaults to None.

***

### <mark style="color:blue;">execute</mark>

#### Arguments:

* <mark style="color:orange;">**input\_data**</mark>**&#x20;(str):** The name of the collection to get.

#### Returns:

* [**Collection**](https://cookbook.chromadb.dev/core/collections/)**:** Retrieved collection.

***

***

***

## <mark style="color:green;">ChromaDBGetOrCreateCollection</mark>

Get or Create collection. Subclass of [**Action**](/core/action.md)**.** Type of [**Action**](/core/action.md)**\[str,** [**Collection**](https://cookbook.chromadb.dev/core/collections/)**]**

***

### <mark style="color:blue;">\_\_init\_\_</mark>

#### Arguments:

* <mark style="color:orange;">**client**</mark>**&#x20;(**[**ClientAPI**](https://cookbook.chromadb.dev/core/clients/)**):** ChromaDB client to use.
* <mark style="color:orange;">**embedding\_function**</mark>**&#x20;(Optional\[**[**EmbeddingFunction**](https://cookbook.chromadb.dev/embeddings/bring-your-own-embeddings/)**\[Embeddable]], optional):** Embedding function to use. If equals to None, default will be used. Defaults to None.
* <mark style="color:orange;">**metadata**</mark>**&#x20;(Optional\[Dict\[str, Any]], optional):** Collection metadata. Defaults to None.
* <mark style="color:orange;">**name**</mark>**&#x20;(Optional\[str], optional):** Name for identification. If equals to None, class name will be used. Defaults to None.

***

### <mark style="color:blue;">execute</mark>

#### Arguments:

* <mark style="color:orange;">**input\_data**</mark>**&#x20;(str):** The name of the collection to get or create.

#### Returns:

* [**Collection**](https://cookbook.chromadb.dev/core/collections/)**:** Retrieved collection.

***

***

***

## <mark style="color:green;">ChromaDBDeleteCollection</mark>

Delete collection. Subclass of [**Action**](/core/action.md)**.** Type of [**Action**](/core/action.md)**\[str, None]**

***

### <mark style="color:blue;">\_\_init\_\_</mark>

#### Arguments:

* <mark style="color:orange;">**client**</mark>**&#x20;(**[**ClientAPI**](https://cookbook.chromadb.dev/core/clients/)**):** ChromaDB client to use.
* <mark style="color:orange;">**name**</mark>**&#x20;(Optional\[str], optional):** Name for identification. If equals to None, class name will be used. Defaults to None.
* <mark style="color:orange;">**default\_key**</mark>**&#x20;(str, optional):** Default key used for results that is not of type Dict. Defaults to "output".

***

### <mark style="color:blue;">execute</mark>

#### Arguments:

* <mark style="color:orange;">**input\_data**</mark>**&#x20;(str):** The name of the collection to delete.

***

***

***

## <mark style="color:green;">ChromaDBCollectionAdd</mark>

Add embeddings to the data store. Subclass of [**Action**](/core/action.md)**.** Type of [**Action**](/core/action.md)**\[Dict\[str, Any], None]**

***

### <mark style="color:blue;">execute</mark>

#### Arguments:

* <mark style="color:orange;">**input\_data**</mark>**&#x20;(Dict\[str, Any]):**\
  Expected keys:
  * <mark style="color:red;">**"collection"**</mark>**&#x20;(**[**Collection**](https://cookbook.chromadb.dev/core/collections/)**):** Collection to use.
  * <mark style="color:red;">**"ids"**</mark>**:** The ids of the embeddings you wish to add.
  * <mark style="color:red;">**"embeddings"**</mark>**:** The embeddings to add. If None, embeddings will be computed based on the documents or images using the embedding\_function set for the Collection. Optional.
  * <mark style="color:red;">**"metadatas"**</mark>**:** The metadata to associate with the embeddings. When querying, you can filter on this metadata. Optional.
  * <mark style="color:red;">**"documents"**</mark>**:** The documents to associate with the embeddings. Optional.
  * <mark style="color:red;">**"images"**</mark>**:** The images to associate with the embeddings. Optional.
  * <mark style="color:red;">**"uris"**</mark>**:** The uris of the images to associate with the embeddings. Optional.

***

***

***

## <mark style="color:green;">ChromaDBCollectionUpdate</mark>

Update the embeddings, metadatas or documents for provided ids. Subclass of [**Action**](/core/action.md)**.** Type of [**Action**](/core/action.md)**\[Dict\[str, Any], None]**

***

### <mark style="color:blue;">execute</mark>

#### Arguments:

* <mark style="color:orange;">**input\_data**</mark>**&#x20;(Dict\[str, Any]):**\
  Expected keys:
  * <mark style="color:red;">**"collection"**</mark>**&#x20;(**[**Collection**](https://cookbook.chromadb.dev/core/collections/)**):** Collection to use.
  * <mark style="color:red;">**"ids"**</mark>**:** The ids of the embeddings to update.
  * <mark style="color:red;">**"embeddings"**</mark>**:** The embeddings to update. If None, embeddings will be computed based on the documents or images using the embedding\_function set for the Collection. Optional.
  * <mark style="color:red;">**"metadatas"**</mark>**:** The metadata to associate with the embeddings. When querying, you can filter on this metadata. Optional.
  * <mark style="color:red;">**"documents"**</mark>**:** The documents to associate with the embeddings. Optional.
  * <mark style="color:red;">**"images"**</mark>**:** The images to associate with the embeddings. Optional.
  * <mark style="color:red;">**"uris"**</mark>**:** The uris of the images to associate with the embeddings. Optional.

***

***

***

## <mark style="color:green;">ChromaDBCollectionUpsert</mark>

Update the embeddings, metadatas or documents for provided ids, or create them if they don't exist. Subclass of [**Action**](/core/action.md)**.** Type of [**Action**](/core/action.md)**\[Dict\[str, Any], None]**

***

### <mark style="color:blue;">execute</mark>

#### Arguments:

* <mark style="color:orange;">**input\_data**</mark>**&#x20;(Dict\[str, Any]):**\
  Expected keys:
  * <mark style="color:red;">**"collection"**</mark>**&#x20;(**[**Collection**](https://cookbook.chromadb.dev/core/collections/)**):** Collection to use.
  * <mark style="color:red;">**"ids"**</mark>**:** The ids of the embeddings to update.
  * <mark style="color:red;">**"embeddings"**</mark>**:** The embeddings to add. If None, embeddings will be computed based on the documents or images using the embedding\_function set for the Collection. Optional.
  * <mark style="color:red;">**"metadatas"**</mark>**:** The metadata to associate with the embeddings. When querying, you can filter on this metadata. Optional.
  * <mark style="color:red;">**"documents"**</mark>**:** The documents to associate with the embeddings. Optional.
  * <mark style="color:red;">**"images"**</mark>**:** The images to associate with the embeddings. Optional.
  * <mark style="color:red;">**"uris"**</mark>**:** The uris of the images to associate with the embeddings. Optional.

***

***

***

## <mark style="color:green;">ChromaDBCollectionQuery</mark>

Get the n\_results nearest neighbor embeddings for provided query\_embeddings or query\_texts. Subclass of [**Action**](/core/action.md)**.** Type of [**Action**](/core/action.md)**\[Dict\[str, Any], QueryResult]**

***

### <mark style="color:blue;">execute</mark>

#### Arguments:

* <mark style="color:orange;">**input\_data**</mark>**&#x20;(Dict\[str, Any]):**\
  Expected keys:
  * <mark style="color:red;">**"collection"**</mark>**&#x20;(**[**Collection**](https://cookbook.chromadb.dev/core/collections/)**):** Collection to use.
  * <mark style="color:red;">**"query\_embeddings"**</mark>**:** The embeddings to get the closes neighbors of. Optional.
  * <mark style="color:red;">**"query\_texts"**</mark>**:** The document texts to get the closes neighbors of. Optional.
  * <mark style="color:red;">**"query\_images"**</mark>**:** The images to get the closes neighbors of. Optional.
  * <mark style="color:red;">**"n\_results"**</mark>**:** The number of neighbors to return for each query\_embedding or query\_texts. Optional.
  * <mark style="color:red;">**"where"**</mark>**:** A Where type dict used to filter results by. E.g. {"$and": \["color" : "red", "price": {"$gte": 4.20}]}. Optional.
  * <mark style="color:red;">**"where\_document"**</mark>**:** A WhereDocument type dict used to filter by the documents. E.g. {$contains: {"text": "hello"}}. Optional.
  * <mark style="color:red;">**"include"**</mark>**:** A list of what to include in the results. Can contain "embeddings", "metadatas", "documents", "distances". Ids are always included. Defaults to \["metadatas", "documents", "distances"]. Optional.

#### Returns:

* **QueryResult:** A QueryResult object containing the results.

***

***

***

## <mark style="color:green;">ChromaDBCollectionGet</mark>

Get embeddings and their associate data from the data store. If no ids or where filter is provided returns all embeddings up to limit starting at offset. Subclass of [**Action**](/core/action.md)**.** Type of [**Action**](/core/action.md)**\[Dict\[str, Any], GetResult]**

***

### <mark style="color:blue;">execute</mark>

#### Arguments:

* <mark style="color:orange;">**input\_data**</mark>**&#x20;(Dict\[str, Any]):**\
  Expected keys:
  * <mark style="color:red;">**"collection"**</mark>**&#x20;(**[**Collection**](https://cookbook.chromadb.dev/core/collections/)**):** Collection to use.
  * <mark style="color:red;">**"ids"**</mark>**:** The ids of the embeddings to get. Optional.
  * <mark style="color:red;">**"where"**</mark>**:** A Where type dict used to filter results by. E.g. {"$and": \["color" : "red", "price": {"$gte": 4.20}]}. Optional.
  * <mark style="color:red;">**"limit"**</mark>**:** The number of documents to return. Optional.
  * <mark style="color:red;">**"offset"**</mark>**:** The offset to start returning results from. Useful for paging results with limit. Optional.
  * <mark style="color:red;">**"where\_document"**</mark>**:** A WhereDocument type dict used to filter by the documents. E.g. {$contains: {"text": "hello"}}. Optional.
  * <mark style="color:red;">**"include"**</mark>**:** A list of what to include in the results. Can contain "embeddings", "metadatas", "documents". Ids are always included. Defaults to \["metadatas", "documents"]. Optional.

#### Returns:

* **GetResult:** A GetResult object containing the results.

***

***
