agentchat.contrib.graph_rag
agentchat.contrib.graph_rag.falkor_graph_query_engine
FalkorGraphQueryEngine
This is a wrapper for FalkorDB KnowledgeGraph.
__init__
Initialize a FalkorDB knowledge graph. Please also refer to https://github.com/FalkorDB/GraphRAG-SDK/blob/main/graphrag_sdk/kg.py
TODO: Fix LLM API cost calculation for FalkorDB useages.
Arguments:
name
str - Knowledge graph name.host
str - FalkorDB hostname.port
int - FalkorDB port number.username
str|None - FalkorDB username.password
str|None - FalkorDB password.model
GenerativeModel - LLM model to use for FalkorDB to build and retrieve from the graph, default to use OAI gpt-4o.ontology
- FalkorDB knowledge graph schema/ontology, https://github.com/FalkorDB/GraphRAG-SDK/blob/main/graphrag_sdk/ontology.py If None, FalkorDB will auto generate an ontology from the input docs.
connect_db
Connect to an existing knowledge graph.
init_db
Build the knowledge graph with input documents.
query
Query the knowledge graph with a question and optional message history.
Arguments:
-
question
- a human input question. -
n_results
- number of returned results. kwargs: -
messages
- a list of message history. -
Returns
- FalkorGraphQueryResult
delete
Delete graph and its data from database.