14 lines
449 B
Python
14 lines
449 B
Python
from models import GraphRAGResponse
|
|
from tools import TOOL_MAP
|
|
|
|
|
|
def react_agent(user_message: str, history=None, G=None, language: str = "Slovak") -> GraphRAGResponse:
|
|
"""Retrieve graph evidence first, then answer strictly from it."""
|
|
del history
|
|
result = TOOL_MAP["query_knowledge_graph"](user_message.strip(), G, language)
|
|
return GraphRAGResponse(
|
|
user_message,
|
|
result["answer"],
|
|
result["evidence"],
|
|
)
|