Skip to content

Commit 2e3e7de

Browse files
Merge pull request #14816 from leventov/no-streaming-logging
Fix concurrency/scaling when many Python threads do streaming using *sync* completions
2 parents 37ea89e + 0a5fe10 commit 2e3e7de

File tree

2 files changed

+7
-6
lines changed

2 files changed

+7
-6
lines changed

litellm/litellm_core_utils/streaming_handler.py

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1619,11 +1619,12 @@ def __next__(self): # noqa: PLR0915
16191619
completion_start_time=datetime.datetime.now()
16201620
)
16211621
## LOGGING
1622-
executor.submit(
1623-
self.run_success_logging_and_cache_storage,
1624-
response,
1625-
cache_hit,
1626-
) # log response
1622+
if not litellm.disable_streaming_logging:
1623+
executor.submit(
1624+
self.run_success_logging_and_cache_storage,
1625+
response,
1626+
cache_hit,
1627+
) # log response
16271628
choice = response.choices[0]
16281629
if isinstance(choice, StreamingChoices):
16291630
self.response_uptil_now += choice.delta.get("content", "") or ""

litellm/llms/custom_httpx/http_handler.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -935,7 +935,7 @@ def _create_sync_transport(self) -> Optional[HTTPTransport]:
935935
if litellm.force_ipv4:
936936
return HTTPTransport(local_address="0.0.0.0")
937937
else:
938-
return None
938+
return getattr(litellm, 'sync_transport', None)
939939

940940

941941
def get_async_httpx_client(

0 commit comments

Comments
 (0)