Chroma

pip install pineflow-vector-stores-chroma
class ChromaVectorStore

Chroma is the AI-native open-source vector database. Embeddings are stored within a ChromaDB collection.

Parameters:
  • embed_model (BaseEmbedding) – Embedding model used to compute vectors.

  • collection_name (str, optional) – Name of the ChromaDB collection.

  • distance_strategy (str, optional) – Distance strategy for similarity search. Currently supports “cosine”, “ip”, and “l2”. Defaults to cosine.

Example

from pineflow.embeddings.huggingface import HuggingFaceEmbedding
from pineflow.vector_stores.chroma import ChromaVectorStore

embedding = HuggingFaceEmbedding()
vector_db = ChromaVectorStore(embed_model=embedding)
add_documents(documents)

Add documents to the ChromaDB collection.

Parameters:

documents (List[Document]) – List of documents to add to the collection.

delete_documents(ids)

Delete documents from the ChromaDB collection.

Parameters:

ids (List[str], optional) – List of Document IDs to delete. Defaults to None.

get_all_documents(include_fields=None)

Get all documents from vector store.

search_documents(query, top_k=4)

Performs a similarity search for the top-k most similar documents.

Parameters:
  • query (str) – Query text.

  • top_k (int, optional) – Number of top results to return. Defaults to 4.

Returns:

List of the most similar documents.

Return type:

List[DocumentWithScore]