graph_rag
autogen.agentchat.contrib.graph_rag.GraphQueryEngine
GraphQueryEngine
An abstract base class that represents a graph query engine on top of a underlying graph database.
This interface defines the basic methods for graph-based RAG.
Name | Description |
---|---|
*args | |
**kwargs |
Instance Methods
add_records
Add new records to the underlying database and add to the graph if required.
Parameters:Name | Description |
---|---|
new_records | Type: list[typing.Any] |
init_db
This method initializes graph database with the input documents or records.
Usually, it takes the following steps,
- connecting to a graph database.
2. extract graph nodes, edges based on input data, graph schema and etc.
3. build indexes etc.
Name | Description |
---|---|
input_doc | a list of input documents that are used to build the graph in database. Type: list[Document]Â |Â None Default: None |
query
This method transform a string format question into database query and return the result.
Parameters:Name | Description |
---|---|
question | Type: str |
n_results | Type: int Default: 1 |
**kwarg | Type: Any |