mirror of
https://github.com/hwchase17/langchain.git
synced 2025-09-20 18:12:35 +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)
|
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."""
|
||||||
|
Reference in New Issue
Block a user