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:
ProxyCausal
2023-04-19 01:45:06 -04:00
committed by GitHub
parent b7dc04c086
commit 72b7d76d79

View File

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