autogen.agents.experimental.VectorChromaQueryEngine
VectorChromaQueryEngine
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. The Chromadb collection serves as the storage layer, while
the collection name uniquely identifies the set of documents within the persistent database.
Initializes the VectorChromaQueryEngine with db_path, metadata, and embedding function and llm.
Name | Description |
---|---|
db_path | Type: str | None Default: None |
embedding_function | Type: Optional[EmbeddingFunction[Any]] Default: None |
metadata | Type: dict[str, typing.Any] | None Default: None |
llm | Type: ForwardRef(‘LLM’) | None Default: None |
collection_name | Type: str | None Default: None |
Instance Methods
add_docs
Add additional documents to the existing vector index.
Loads new Docling-parsed Markdown files from a specified directory or a list of file paths
and inserts them into the current index for future queries.
Name | Description |
---|---|
new_doc_dir | The directory path from which to load additional documents. If provided, all eligible files in this directory are loaded. Type: pathlib.Path | str | None Default: None |
new_doc_paths | A list of file paths specifying additional documents to load. Each file should be a Docling-parsed Markdown file. Type: list[pathlib.Path | str] | None Default: None |
establish_db
Establish a connection to the Chromadb database and initialize the collection.
get_collection_name
Get the name of the collection used by the query engine.
Returns:
The name of the collection.
Type | Description |
---|---|
str | The name of the collection. |
query
Retrieve information from indexed documents by processing a natural language query.
Name | Description |
---|---|
question | A natural language query string used to search the indexed documents. Type: str |
Type | Description |
---|---|
str | A string containing the response generated by LLM. |
validate_query_index
Ensures an index exists