Chroma

Module: implementation.datasources.db



ChromaDBCreateCollection

Create collection. Subclass of Action. Type of Action[str, Collection]


__init__

Arguments:

  • client (ClientAPI): ChromaDB client to use.

  • embedding_function (Optional[EmbeddingFunction[Embeddable]], optional): Embedding function to use. If equals to None, default will be used. Defaults to None.

  • metadata (Optional[Dict[str, Any]], optional): Collection metadata. Defaults to None.

  • name (Optional[str], optional): Name for identification. If equals to None, class name will be used. Defaults to None.


execute

Arguments:

  • input_data (str): The name of the collection to create.

Returns:




ChromaDBGetCollection

Get collection. Subclass of Action. Type of Action[str, Collection]


__init__

Arguments:

  • client (ClientAPI): ChromaDB client to use.

  • embedding_function (Optional[EmbeddingFunction[Embeddable]], optional): Embedding function to use. If equals to None, default will be used. Defaults to None.

  • metadata (Optional[Dict[str, Any]], optional): Collection metadata. Defaults to None.

  • name (Optional[str], optional): Name for identification. If equals to None, class name will be used. Defaults to None.


execute

Arguments:

  • input_data (str): The name of the collection to get.

Returns:




ChromaDBGetOrCreateCollection

Get or Create collection. Subclass of Action. Type of Action[str, Collection]


__init__

Arguments:

  • client (ClientAPI): ChromaDB client to use.

  • embedding_function (Optional[EmbeddingFunction[Embeddable]], optional): Embedding function to use. If equals to None, default will be used. Defaults to None.

  • metadata (Optional[Dict[str, Any]], optional): Collection metadata. Defaults to None.

  • name (Optional[str], optional): Name for identification. If equals to None, class name will be used. Defaults to None.


execute

Arguments:

  • input_data (str): The name of the collection to get or create.

Returns:




ChromaDBDeleteCollection

Delete collection. Subclass of Action. Type of Action[str, None]


__init__

Arguments:

  • client (ClientAPI): ChromaDB client to use.

  • name (Optional[str], optional): Name for identification. If equals to None, class name will be used. Defaults to None.

  • default_key (str, optional): Default key used for results that is not of type Dict. Defaults to "output".


execute

Arguments:

  • input_data (str): The name of the collection to delete.




ChromaDBCollectionAdd

Add embeddings to the data store. Subclass of Action. Type of Action[Dict[str, Any], None]


execute

Arguments:

  • input_data (Dict[str, Any]): Expected keys:

    • "collection" (Collection): Collection to use.

    • "ids": The ids of the embeddings you wish to add.

    • "embeddings": 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.

    • "metadatas": The metadata to associate with the embeddings. When querying, you can filter on this metadata. Optional.

    • "documents": The documents to associate with the embeddings. Optional.

    • "images": The images to associate with the embeddings. Optional.

    • "uris": The uris of the images to associate with the embeddings. Optional.




ChromaDBCollectionUpdate

Update the embeddings, metadatas or documents for provided ids. Subclass of Action. Type of Action[Dict[str, Any], None]


execute

Arguments:

  • input_data (Dict[str, Any]): Expected keys:

    • "collection" (Collection): Collection to use.

    • "ids": The ids of the embeddings to update.

    • "embeddings": 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.

    • "metadatas": The metadata to associate with the embeddings. When querying, you can filter on this metadata. Optional.

    • "documents": The documents to associate with the embeddings. Optional.

    • "images": The images to associate with the embeddings. Optional.

    • "uris": The uris of the images to associate with the embeddings. Optional.




ChromaDBCollectionUpsert

Update the embeddings, metadatas or documents for provided ids, or create them if they don't exist. Subclass of Action. Type of Action[Dict[str, Any], None]


execute

Arguments:

  • input_data (Dict[str, Any]): Expected keys:

    • "collection" (Collection): Collection to use.

    • "ids": The ids of the embeddings to update.

    • "embeddings": 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.

    • "metadatas": The metadata to associate with the embeddings. When querying, you can filter on this metadata. Optional.

    • "documents": The documents to associate with the embeddings. Optional.

    • "images": The images to associate with the embeddings. Optional.

    • "uris": The uris of the images to associate with the embeddings. Optional.




ChromaDBCollectionQuery

Get the n_results nearest neighbor embeddings for provided query_embeddings or query_texts. Subclass of Action. Type of Action[Dict[str, Any], QueryResult]


execute

Arguments:

  • input_data (Dict[str, Any]): Expected keys:

    • "collection" (Collection): Collection to use.

    • "query_embeddings": The embeddings to get the closes neighbors of. Optional.

    • "query_texts": The document texts to get the closes neighbors of. Optional.

    • "query_images": The images to get the closes neighbors of. Optional.

    • "n_results": The number of neighbors to return for each query_embedding or query_texts. Optional.

    • "where": A Where type dict used to filter results by. E.g. {"$and": ["color" : "red", "price": {"$gte": 4.20}]}. Optional.

    • "where_document": A WhereDocument type dict used to filter by the documents. E.g. {$contains: {"text": "hello"}}. Optional.

    • "include": 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.




ChromaDBCollectionGet

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. Type of Action[Dict[str, Any], GetResult]


execute

Arguments:

  • input_data (Dict[str, Any]): Expected keys:

    • "collection" (Collection): Collection to use.

    • "ids": The ids of the embeddings to get. Optional.

    • "where": A Where type dict used to filter results by. E.g. {"$and": ["color" : "red", "price": {"$gte": 4.20}]}. Optional.

    • "limit": The number of documents to return. Optional.

    • "offset": The offset to start returning results from. Useful for paging results with limit. Optional.

    • "where_document": A WhereDocument type dict used to filter by the documents. E.g. {$contains: {"text": "hello"}}. Optional.

    • "include": 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.



Last updated