Closed codeinging closed 2 months ago
The issue you encountered with the KnowledgeGraphRAGRetriever
and the "nl2graphquery" context arises from the implementation specifics of the KnowledgeGraphQueryEngine
. When the graph_query_synthesis_prompt
parameter is not manually specified, the engine defaults to using a prompt template from DEFAULT_NL2GRAPH_PROMPT_MAP
based on the graph store type. This default behavior means that any custom "nl2graphquery" context or contexts not predefined require the graph_query_synthesis_prompt
to be explicitly provided during initialization.
The source code indicates that the KnowledgeGraphQueryEngine
class initializes its _graph_query_synthesis_prompt
attribute with a value from this map unless the graph_query_synthesis_prompt
is provided. This is why manually adding this parameter resolves the issue.
Furthermore, the engine's reliance on the storage_context
to determine the graph store type underscores the importance of providing a storage_context
with a graph_store
during initialization. The engine asserts the presence of a graph_store
in the storage_context
, which is crucial for its operation.
This behavior, while logical from a coding perspective, could benefit from clearer documentation to help users understand the necessity of manually specifying the graph_query_synthesis_prompt
for custom contexts. This clarification could prevent similar confusion in the future and improve the user experience with the KnowledgeGraphRAGRetriever
.
Bug Description
According to the official documentation, “nl2graphquery” can not be included as Context in Graph RAG, Reason may be that the absence of "graph_query_synthesis_prompt" parameter! However, in the official documentation and source code, this parameter is optional. I manually add this parameter, and the problem is solved!
Version
0.10.29
Steps to Reproduce
`graph_rag_retriever_with_nl2graphquery = KnowledgeGraphRAGRetriever( storage_context=storage_context, verbose=True, with_nl2graphquery=True, )
query_engine_with_nl2graphquery = RetrieverQueryEngine.from_args( graph_rag_retriever_with_nl2graphquery, )`
Relevant Logs/Tracbacks
No response