Skip to content

Commit

Permalink
Merge pull request BerriAI#3384 from BerriAI/litellm_fix_details_to
Browse files Browse the repository at this point in the history
fix - error sending details to log on sentry
  • Loading branch information
ishaan-jaff committed May 1, 2024
2 parents 6cfd00e + 8e75d07 commit b3161bb
Showing 1 changed file with 13 additions and 4 deletions.
17 changes: 13 additions & 4 deletions litellm/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -1236,7 +1236,10 @@ def pre_call(self, input, api_key, model=None, additional_args={}):
print_verbose=print_verbose,
)
elif callback == "sentry" and add_breadcrumb:
details_to_log = copy.deepcopy(self.model_call_details)
try:
details_to_log = copy.deepcopy(self.model_call_details)
except:
details_to_log = self.model_call_details
if litellm.turn_off_message_logging:
# make a copy of the _model_Call_details and log it
details_to_log.pop("messages", None)
Expand Down Expand Up @@ -1327,8 +1330,10 @@ def post_call(
)
elif callback == "sentry" and add_breadcrumb:
print_verbose("reaches sentry breadcrumbing")

details_to_log = copy.deepcopy(self.model_call_details)
try:
details_to_log = copy.deepcopy(self.model_call_details)
except:
details_to_log = self.model_call_details
if litellm.turn_off_message_logging:
# make a copy of the _model_Call_details and log it
details_to_log.pop("messages", None)
Expand Down Expand Up @@ -2635,7 +2640,11 @@ def function_setup(
dynamic_success_callbacks = kwargs.pop("success_callback")

if add_breadcrumb:
details_to_log = copy.deepcopy(kwargs)
try:
details_to_log = copy.deepcopy(kwargs)
except:
details_to_log = kwargs

if litellm.turn_off_message_logging:
# make a copy of the _model_Call_details and log it
details_to_log.pop("messages", None)
Expand Down

0 comments on commit b3161bb

Please sign in to comment.