From 41fb76740efbf19473b7bd5b6d2545b9a070c23f Mon Sep 17 00:00:00 2001 From: Krrish Dholakia Date: Fri, 29 Mar 2024 09:18:41 -0700 Subject: [PATCH] fix(utils.py): exception mapping on 'next()' streaming error --- litellm/utils.py | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/litellm/utils.py b/litellm/utils.py index f42bdeecc..2b73c0b8f 100644 --- a/litellm/utils.py +++ b/litellm/utils.py @@ -9704,7 +9704,14 @@ class CustomStreamWrapper: threading.Thread( target=self.logging_obj.failure_handler, args=(e, traceback_exception) ).start() - raise e + if isinstance(e, OpenAIError): + raise e + else: + raise exception_type( + model=self.model, + original_exception=e, + custom_llm_provider=self.custom_llm_provider, + ) async def __anext__(self): try: