From 4bf893afe1b3212d12a36da5d62e492b3efa38b8 Mon Sep 17 00:00:00 2001 From: Krrish Dholakia Date: Sat, 24 Aug 2024 23:37:41 -0700 Subject: [PATCH] fix(openai.py): fix error handling --- litellm/llms/OpenAI/openai.py | 17 +++++------------ 1 file changed, 5 insertions(+), 12 deletions(-) diff --git a/litellm/llms/OpenAI/openai.py b/litellm/llms/OpenAI/openai.py index 1b90d5825..ed4d199f6 100644 --- a/litellm/llms/OpenAI/openai.py +++ b/litellm/llms/OpenAI/openai.py @@ -1160,18 +1160,11 @@ class OpenAIChatCompletion(BaseLLM): "complete_input_dict": data, }, ) - try: - headers, response = self.make_sync_openai_chat_completion_request( - openai_client=openai_client, - data=data, - timeout=timeout, - ) - except Exception as e: - status_code = getattr(e, "status_code", 500) - error_headers = getattr(e, "headers", None) - raise OpenAIError( - status_code=status_code, message=str(e), headers=error_headers - ) + headers, response = self.make_sync_openai_chat_completion_request( + openai_client=openai_client, + data=data, + timeout=timeout, + ) logging_obj.model_call_details["response_headers"] = headers streamwrapper = CustomStreamWrapper(