fix(add-custom-success-callback-for-streaming): add custom success callback for streaming

This commit is contained in:
Krrish Dholakia 2023-10-06 15:01:50 -07:00
parent 868c1c594f
commit 7e34736a38
8 changed files with 89 additions and 20 deletions

View file

@ -456,6 +456,14 @@ class Logging:
end_time=end_time,
print_verbose=print_verbose,
)
if callable(callback): # custom logger functions
customLogger.log_event(
kwargs=self.model_call_details,
response_obj=result,
start_time=start_time,
end_time=end_time,
print_verbose=print_verbose,
)
except Exception as e:
print_verbose(
@ -2022,14 +2030,6 @@ def handle_success(args, kwargs, result, start_time, end_time):
litellm_call_id=kwargs["litellm_call_id"],
print_verbose=print_verbose,
)
elif callable(callback): # custom logger functions
customLogger.log_event(
kwargs=kwargs,
response_obj=result,
start_time=start_time,
end_time=end_time,
print_verbose=print_verbose,
)
except Exception as e:
# LOGGING
exception_logging(logger_fn=user_logger_fn, exception=e)