fix: fix pydantic validation error

- When passing result_as_answer=True, it will return ToolOutput so it won't pass pydantic validation as a string

- Get content of ToolOutput before return
This commit is contained in:
Ho Trong Hien
2024-12-17 22:28:41 +07:00
committed by GitHub
parent a49be2fc52
commit 059d635f02

View File

@@ -18,6 +18,10 @@ class LlamaIndexTool(BaseTool):
from llama_index.core.tools import BaseTool as LlamaBaseTool
tool = cast(LlamaBaseTool, self.llama_index_tool)
if self.result_as_answer:
return tool(*args, **kwargs).content
return tool(*args, **kwargs)
@classmethod