From 8bd6c977e284e8f19ab7e5b58fc62c357e6340e4 Mon Sep 17 00:00:00 2001 From: Ishaan Jaff Date: Thu, 2 Jan 2025 22:25:15 -0800 Subject: [PATCH] fix - use tp executor (#7509) --- litellm/utils.py | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/litellm/utils.py b/litellm/utils.py index 68a58c6e22..902e20fdf6 100644 --- a/litellm/utils.py +++ b/litellm/utils.py @@ -915,9 +915,12 @@ def client(original_function): # noqa: PLR0915 # LOG SUCCESS - handle streaming success logging in the _next_ object, remove `handle_success` once it's deprecated verbose_logger.info("Wrapper: Completed Call, calling success_handler") - threading.Thread( - target=logging_obj.success_handler, args=(result, start_time, end_time) - ).start() + executor.submit( + logging_obj.success_handler, + result, + start_time, + end_time, + ) # RETURN RESULT if hasattr(result, "_hidden_params"): result._hidden_params["model_id"] = kwargs.get("model_info", {}).get( @@ -1122,11 +1125,12 @@ def client(original_function): # noqa: PLR0915 asyncio.create_task( logging_obj.async_success_handler(result, start_time, end_time) ) - threading.Thread( - target=logging_obj.success_handler, - args=(result, start_time, end_time), - ).start() - + executor.submit( + logging_obj.success_handler, + result, + start_time, + end_time, + ) # REBUILD EMBEDDING CACHING if ( isinstance(result, EmbeddingResponse)