Tool

Integrate ChromaDB with LlamaIndex for Data Retrieval

ChromaReader retrieves documents from existing persisted Chroma collections for LlamaIndex pipelines.

Works with chroma

72
Spark score
out of 100
Updated 2 days ago
Version 0.14.23
Models

Add to Favorites

Why it matters

Seamlessly integrate your existing Chroma document collections into LlamaIndex for advanced data retrieval and RAG applications. This asset enables efficient querying and loading of data from Chroma, powering your AI applications.

Outcomes

What it gets done

01

Load documents from persisted Chroma collections.

02

Query Chroma collections using text or embeddings.

03

Filter retrieved documents by metadata or content.

04

Integrate with LlamaIndex for RAG pipelines.

Install

Add it to your toolbox

Run in your project directory:

curl -fsSL https://spark.entire.vc/get/li-reader-readers-chroma | bash

Overview

LlamaIndex Readers Integration: Chroma

ChromaReader pulls documents out of an existing, already-persisted Chroma collection and loads them into LlamaIndex, filterable by embedding similarity, metadata, or text query. It can also be used as a LangChain Agent tool. Use it when you have a populated Chroma collection and need to retrieve its documents into a pipeline. It only reads from Chroma -- it does not create or populate a collection.

What it does

ChromaReader retrieves documents from existing, already-persisted Chroma collections -- Chroma is a framework for managing document collections and their associated embeddings. It is designed to load that data into LlamaIndex, and can also be used as a Tool inside a LangChain Agent.

When to use - and when NOT to

Use it when you already have a populated Chroma collection and need to pull documents from it into a LlamaIndex (or LangChain agent) pipeline -- by embedding similarity, metadata filter, or text query. It reads from an existing collection rather than creating or writing to one, so it is not the tool for initially building or populating a Chroma collection.

Inputs and outputs

Install with:

pip install llama-index-readers-chroma

Initialize with your collection name and connection details, then load documents:

from llama_index.core.schema import Document
from llama_index.readers.chroma import ChromaReader

reader = ChromaReader(
    collection_name="<Your Collection Name>",
    persist_directory="<Directory Path>",
    chroma_api_impl="rest",
    chroma_db_impl=None,
    host="localhost",
    port=8000,
)

documents = reader.load_data(
    query_embedding=None,
    limit=10,
    where=None,
    where_document=None,
    query=["search term"],
)

collection_name is required; persist_directory, host (default localhost), port (default 8000), and chroma_api_impl (default rest) are optional connection settings. load_data retrieves up to limit (default 10) documents, filterable by a metadata condition (where), a document condition (where_document), a query embedding, or a text query list.

Who it's for

Developers building LlamaIndex or LangChain pipelines that need to pull documents out of an existing Chroma vector store rather than query it directly through Chroma's own client.

Source README

LlamaIndex Readers Integration: Chroma

Overview

Chroma Reader is a tool designed to retrieve documents from existing persisted Chroma collections. Chroma is a framework for managing document collections and their associated embeddings efficiently.

Installation

You can install Chroma Reader via pip:

pip install llama-index-readers-chroma

Usage

from llama_index.core.schema import Document
from llama_index.readers.chroma import ChromaReader

### Initialize ChromaReader with the collection name and optional parameters
reader = ChromaReader(
    collection_name="<Your Collection Name>",
    persist_directory="<Directory Path>",  # Optional: Directory where the collection is persisted
    chroma_api_impl="rest",  # Optional: Chroma API implementation (default: "rest")
    chroma_db_impl=None,  # Optional: Chroma DB implementation (default: None)
    host="localhost",  # Optional: Host for Chroma DB (default: "localhost")
    port=8000,  # Optional: Port for Chroma DB (default: 8000)
)

### Load data from Chroma collection
documents = reader.load_data(
    query_embedding=None,  # Provide query embedding if searching by embeddings
    limit=10,  # Number of results to retrieve
    where=None,  # Filter condition for metadata
    where_document=None,  # Filter condition for document
    query=["search term"],  # Provide query text if searching by text
)

This loader is designed to be used as a way to load data into
LlamaIndex and/or subsequently
used as a Tool in a LangChain Agent.

FAQ

Common questions

Discussion

Questions & comments · 0

Sign In Sign in to leave a comment.