Skip to content

Commit

Permalink
Print exception type for Python tool (#3126)
Browse files Browse the repository at this point in the history
Useful for debugging agents e.g. KeyError in addition to just printing
the missing key
  • Loading branch information
ProxyCausal committed Apr 19, 2023
1 parent b7dc04c commit 72b7d76
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion langchain/tools/python/tool.py
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ def _run(self, query: str) -> str:
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."""
Expand Down

0 comments on commit 72b7d76

Please sign in to comment.