rag
autogen.agentchat.contrib.rag.VectorDbQueryEngine
VectorDbQueryEngine
An abstract base class that represents a query engine on top of an underlying vector database.
This interface defines the basic methods for RAG.
Name | Description |
---|---|
*args | |
**kwargs |
Instance Methods
add_records
Add new documents to the underlying database and add to the index.
Parameters:Name | Description |
---|---|
new_doc_dir | Type: pathlib.Path | str | None Default: None |
new_doc_paths_or_urls | Type: list[pathlib.Path | str] | None Default: None |
*args | Type: Any |
**kwargs | Type: Any |
connect_db
Connect to the database.
Name | Description |
---|---|
*args | Any additional arguments Type: Any |
**kwargs | Any additional keyword arguments Type: Any |
Type | Description |
---|---|
bool | bool: True if connection is successful, False otherwise |
init_db
Initialize the database with the input documents or records.
This method initializes database with the input documents or records.
Usually, it takes the following steps,
- connecting to a database.
2. insert records - build indexes etc.
Name | Description |
---|---|
new_doc_dir | a dir of input documents that are used to create the records in database. Type: pathlib.Path | str | None Default: None |
new_doc_paths | a list of input documents that are used to create the records in database. a document can be a path to a file or a url. Type: list[pathlib.Path | str] | None Default: None |
*args | Any additional arguments Type: Any |
**kwargs | Any additional keyword arguments Type: Any |
Type | Description |
---|---|
bool | bool: True if initialization is successful, False otherwise |
query
Transform a string format question into database query and return the result.
Name | Description |
---|---|
question | a string format question Type: str |
*args | Any additional arguments Type: Any |
**kwargs | Any additional keyword arguments Type: Any |