rag
autogen.agentchat.contrib.rag.RAGQueryEngine
RAGQueryEngine
A protocol class that represents a document ingestation and query engine on top of an underlying database.
This interface defines the basic methods for RAG.
Name | Description |
---|---|
*args | |
**kwargs |
Instance Methods
add_docs
Add new documents to the underlying data store.
Parameters:Name | Description |
---|---|
new_doc_dir | Type: pathlib.Path | str | None Default: None |
new_doc_paths_or_urls | Type: Sequence[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:
1. connecting to a database.
2. insert records
3. build indexes etc.
Name | Description |
---|---|
new_doc_dir | A directory containing documents to be ingested. Type: pathlib.Path | str | None Default: None |
new_doc_paths_or_urls | A list of paths or URLs to documents to be ingested. Type: Sequence[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 |