diff --git a/litellm/__pycache__/utils.cpython-311.pyc b/litellm/__pycache__/utils.cpython-311.pyc index ce9ef07de6..2826ca27fd 100644 Binary files a/litellm/__pycache__/utils.cpython-311.pyc and b/litellm/__pycache__/utils.cpython-311.pyc differ diff --git a/litellm/utils.py b/litellm/utils.py index 271aa0257b..f8bd4bb562 100644 --- a/litellm/utils.py +++ b/litellm/utils.py @@ -1801,7 +1801,10 @@ class CustomStreamWrapper: raise ValueError(f"Unable to parse response. Original response: {chunk}") def handle_openai_chat_completion_chunk(self, chunk): - return chunk["choices"][0]["delta"]["content"] + try: + return chunk["choices"][0]["delta"]["content"] + except: + return "" def handle_baseten_chunk(self, chunk): try: @@ -1869,12 +1872,12 @@ class CustomStreamWrapper: else: # openai chat/azure models chunk = next(self.completion_stream) completion_obj["content"] = self.handle_openai_chat_completion_chunk(chunk) - + # LOGGING threading.Thread(target=self.logging_obj.success_handler, args=(completion_obj,)).start() # return this for all models return {"choices": [{"delta": completion_obj}]} - except: + except Exception as e: raise StopIteration async def __anext__(self): diff --git a/pyproject.toml b/pyproject.toml index 321de8908b..0b0633f23e 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [tool.poetry] name = "litellm" -version = "0.1.517" +version = "0.1.518" description = "Library to easily interface with LLM API providers" authors = ["BerriAI"] license = "MIT License"