Skip to content

The fastest, litest AI Gateway. Rust core with Python SDK. Call 100+ LLM APIs in OpenAI (or native) format with cost tracking, guardrails, load balancing, and logging [Bedrock, Azure, OpenAI, Anthropic, OpenAI, VertexAI, vLLM, Nvidia NIM]

fix - use tp executor (#7509)

Ishaan Jaff8bd6c977e284
diff --git a/litellm/utils.py b/litellm/utils.py
index 68a58c6e22f..902e20fdf63 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)