Skip to content

Commit

Permalink
- added logging for failed function calls;
Browse files Browse the repository at this point in the history
  • Loading branch information
jaltmayerpizzorno committed Aug 28, 2024
1 parent c06f3a1 commit 3d84fde
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src/coverup/llm.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
import warnings
import textwrap
import json
import traceback

with warnings.catch_warnings():
# ignore pydantic warnings https://github.com/BerriAI/litellm/issues/2832
Expand Down Expand Up @@ -291,6 +292,12 @@ def _call_function(self, ctx: object, tool_call: dict) -> str:
try:
return str(function['function'](ctx=ctx, **args))
except Exception as e:
self._log_msg(ctx, f"""\
Error executing function "{tool_call.function.name}": {e}
args:{args}
{traceback.format_exc()}
""")
return f'Error executing function: {e}'


Expand Down

0 comments on commit 3d84fde

Please sign in to comment.