Skip to main content

ChromaDBQueryEngine

This engine leverages Chromadb to persist document embeddings in a named collection and LlamaIndex’s VectorStoreIndex to efficiently index and retrieve documents, and generate an answer in response to natural language queries. Collection can be regarded as an abstraction of group of documents in the database.
It expects a Chromadb server to be running and accessible at the specified host and port.
Refer to this link for running Chromadb in a Docker container.
If the host and port are not provided, the engine will create an in-memory ChromaDB client.
Initializes the ChromaDBQueryEngine with db_path, metadata, and embedding function and llm.
Parameters:

Instance Methods

add_docs

Add new documents to the underlying database and add to the index.
Parameters:

connect_db

Connect to the database.
It does not overwrite the existing collection in the database.
It takes the following steps,
  1. Set up ChromaDB and LlamaIndex storage.
    2. Create the llamaIndex vector store index for querying or inserting docs later
Parameters: Returns:

get_collection_name

Get the name of the collection used by the query engine.
Returns:
The name of the collection.
Returns:

init_db

Initialize the database with the input documents or records.
It overwrites the existing collection in the database.
It takes the following steps,
  1. Set up ChromaDB and LlamaIndex storage.
    2. insert documents and build indexes upon them.
Parameters: Returns:

query

Retrieve information from indexed documents by processing a query using the engine’s LLM.
Parameters: Returns: