You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Which could lead to potential problems, hallucinations and undesired answers.
A simple solution could be to just validate the items:
if not retriever_result.items:
result: dict[str, Any] = {"answer": ""}
A more robust solution would be to return either a predefined message or user defined message (as an argument to the function) before the invoke of the llm (as to not invoke an llm over an empty answer) in scenarios where the result is an empty list.
The text was updated successfully, but these errors were encountered:
In the search function of GraphRAG class, theres a step to retrieve data:
neo4j-graphrag-python/src/neo4j_graphrag/generation/graphrag.py
Line 134 in 4db2c45
If the result comes empty, then the value for retriever_result.items is an empty list ([]). This is fine.
Problem is the function later does not validate for this scenario, finally passing the input, message_history and system_instruction to the function:
neo4j-graphrag-python/src/neo4j_graphrag/generation/graphrag.py
Line 143 in 4db2c45
Which could lead to potential problems, hallucinations and undesired answers.
A simple solution could be to just validate the items:
A more robust solution would be to return either a predefined message or user defined message (as an argument to the function) before the invoke of the llm (as to not invoke an llm over an empty answer) in scenarios where the result is an empty list.
The text was updated successfully, but these errors were encountered: