Skip to content

raggy.vectorstores.chroma

Chroma

A wrapper for chromadb.Client - used as an async context manager.

Attributes:

Name Type Description
client_type Literal['base', 'http']

The type of client to use. Must be one of "base" or "http".

collection_name str

The name of the collection to use.

Example

Query a collection:

from raggy.vectorstores.chroma import Chroma

async with Chroma(collection_name="my-collection") as chroma:
    result = await chroma.query(query_texts=["Hello, world!"])
    print(result)

query_collection async

Query a Chroma collection.

Parameters:

Name Type Description Default
query_text str

The text to query for.

required
filters

Filters to apply to the query.

required
collection

The collection to query.

required
top_k int

The number of results to return.

10
Example

Basic query of a collection:

from raggy.vectorstores.chroma import query_collection

print(await query_collection("How to create a flow in Prefect?"))