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]

Don't submit a task to a thread if streaming logging is disabled

Roman Leventov6a9ebe88c2a6
diff --git a/litellm/litellm_core_utils/streaming_handler.py b/litellm/litellm_core_utils/streaming_handler.py
index 322691e28b4..bc0fbdf5c11 100644
--- a/litellm/litellm_core_utils/streaming_handler.py
+++ b/litellm/litellm_core_utils/streaming_handler.py
@@ -1619,11 +1619,12 @@ class CustomStreamWrapper:
completion_start_time=datetime.datetime.now()
)
## LOGGING
- executor.submit(
- self.run_success_logging_and_cache_storage,
- response,
- cache_hit,
- ) # log response
+ if not litellm.disable_streaming_logging:
+ executor.submit(
+ self.run_success_logging_and_cache_storage,
+ response,
+ cache_hit,
+ ) # log response
choice = response.choices[0]
if isinstance(choice, StreamingChoices):
self.response_uptil_now += choice.delta.get("content", "") or ""