mirror of
https://github.com/hwchase17/langchain.git
synced 2025-09-18 16:16:33 +00:00
Print exception type for Python tool (#3126)
Useful for debugging agents e.g. KeyError in addition to just printing the missing key
This commit is contained in:
@@ -89,7 +89,7 @@ class PythonAstREPLTool(BaseTool):
|
||||
output = str(e)
|
||||
return output
|
||||
except Exception as e:
|
||||
return str(e)
|
||||
return "{}: {}".format(type(e).__name__, str(e))
|
||||
|
||||
async def _arun(self, query: str) -> str:
|
||||
"""Use the tool asynchronously."""
|
||||
|
Reference in New Issue
Block a user