FalkorGraphQueryEngine

FalkorGraphQueryEngine(
    name: str,
    host: str = '127.0.0.1',
    port: int = 6379,
    username: str | None = None,
    password: str | None = None,
    model: ForwardRef('GenerativeModel') | None = None,
    ontology: ForwardRef('Ontology') | None = None
)

This is a wrapper for FalkorDB KnowledgeGraph.
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.

Parameters:
NameDescription
nameType: str
hostType: str

Default: ‘127.0.0.1’
portType: int

Default: 6379
usernameType: str | None

Default: None
passwordType: str | None

Default: None
modelType: ForwardRef(‘GenerativeModel’) | None

Default: None
ontologyType: ForwardRef(‘Ontology’) | None

Default: None

Instance Methods

add_records

add_records(self, new_records: list[Document]) -> bool
Parameters:
NameDescription
new_recordsType: list[Document]

connect_db

connect_db(self) -> None

Connect to an existing knowledge graph.


delete

delete(self) -> bool

Delete graph and its data from database.


init_db

init_db(self, input_doc: list[Document]) -> None

Build the knowledge graph with input documents.

Parameters:
NameDescription
input_docType: list[Document]

query

query(
    self,
    question: str,
    n_results: int = 1,
    **kwargs: Any
) -> GraphStoreQueryResult

Query the knowledge graph with a question and optional message history.

Parameters:
NameDescription
questiona human input question.

Type: str
n_resultsnumber of returned results.

Type: int

Default: 1
**kwargsType: Any
Returns:
TypeDescription
GraphStoreQueryResultFalkorGraphQueryResult