Print exception type for Python tool (#3126)

Useful for debugging agents e.g. KeyError in addition to just printing
the missing key
fix_agent_callbacks
ProxyCausal 1 year ago committed by GitHub
parent b7dc04c086
commit 72b7d76d79
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -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."""

Loading…
Cancel
Save