mirror of
https://github.com/crewAIInc/crewAI.git
synced 2026-01-08 15:48:29 +00:00
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:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user