From 8e75d07bd0feabacf71c5b8cf6fe9397f61400b0 Mon Sep 17 00:00:00 2001 From: Ishaan Jaff Date: Wed, 1 May 2024 11:43:14 -0700 Subject: [PATCH] fix - error seeing details to log on sentry --- litellm/utils.py | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/litellm/utils.py b/litellm/utils.py index 5c5324be1..82502c8b5 100644 --- a/litellm/utils.py +++ b/litellm/utils.py @@ -1236,7 +1236,10 @@ class Logging: 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) @@ -1327,8 +1330,10 @@ class Logging: ) 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) @@ -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)