Fix ToolOutput calls for newer llama_index compatibility

The metadata parameter was removed from ToolOutput in recent
llama_index versions. Moved metadata fields into raw_input and
use is_error flag for error cases.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
michael 2026-02-23 16:23:37 -06:00
parent 29134011be
commit fc22a9712c

View file

@ -1049,14 +1049,9 @@ async def initialize_global_index() -> bool:
# Add a source_nodes property that routes.py will look for
tool_output = ToolOutput(
content=final_answer,
tool_name="GraphRAG",
tool_name="GraphRAG",
raw_output=NodeWrapper(vector_nodes),
raw_input={"query": query_str},
metadata={
'source': 'graphrag',
'retrieval_stats': log_message,
'original_result': modified_raw_output # Store the original result too
}
raw_input={"query": query_str, "source": "graphrag", "retrieval_stats": log_message}
)
log_structured('debug', 'GraphRAG Tool: Including image metadata in response',
@ -1071,7 +1066,7 @@ async def initialize_global_index() -> bool:
tool_name="GraphRAG",
raw_input={"query": query_str},
raw_output={"error": str(graphrag_err)},
metadata={'error': str(graphrag_err)}
is_error=True
)
async def acall(self, input: str) -> ToolOutput: