From 2a6a72a0e76b6198fced4ce6133d004fd0191a87 Mon Sep 17 00:00:00 2001 From: Krrish Dholakia Date: Mon, 26 Feb 2024 19:32:30 -0800 Subject: [PATCH] fix(utils.py): fixing sync streaming for caching --- litellm/utils.py | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/litellm/utils.py b/litellm/utils.py index c9618e8f3..dd5210e08 100644 --- a/litellm/utils.py +++ b/litellm/utils.py @@ -1196,7 +1196,8 @@ class Logging: start_time=start_time, end_time=end_time, ) - except: + except Exception as e: + complete_streaming_response = None else: self.sync_streaming_chunks.append(result) @@ -8903,13 +8904,7 @@ class CustomStreamWrapper: response: Optional[ModelResponse] = self.chunk_creator(chunk=chunk) print_verbose(f"PROCESSED CHUNK POST CHUNK CREATOR: {response}") - if response is None or ( - isinstance(response, ModelResponse) - and isinstance(response.choices[0], StreamingChoices) - and response.choices[0].delta.content is None - and response.choices[0].delta.function_call is None - and response.choices[0].delta.tool_calls is None - ): + if response is None: continue ## LOGGING threading.Thread(