mirror of
https://github.com/hwchase17/langchain.git
synced 2025-07-04 04:07:54 +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:
parent
b7dc04c086
commit
72b7d76d79
@ -89,7 +89,7 @@ class PythonAstREPLTool(BaseTool):
|
|||||||
output = str(e)
|
output = str(e)
|
||||||
return output
|
return output
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
return str(e)
|
return "{}: {}".format(type(e).__name__, str(e))
|
||||||
|
|
||||||
async def _arun(self, query: str) -> str:
|
async def _arun(self, query: str) -> str:
|
||||||
"""Use the tool asynchronously."""
|
"""Use the tool asynchronously."""
|
||||||
|
Loading…
Reference in New Issue
Block a user