diff --git a/litellm/tests/test_completion.py b/litellm/tests/test_completion.py index 6183c78c4e..034abbb807 100644 --- a/litellm/tests/test_completion.py +++ b/litellm/tests/test_completion.py @@ -279,6 +279,9 @@ def test_completion_azure_gpt4_vision(): except openai.RateLimitError as e: print("got a rate liimt error", e) pass + except openai.APIStatusError as e: + print("got an api status error", e) + pass except Exception as e: pytest.fail(f"Error occurred: {e}") diff --git a/litellm/utils.py b/litellm/utils.py index 95ddb433eb..716b524979 100644 --- a/litellm/utils.py +++ b/litellm/utils.py @@ -6964,6 +6964,21 @@ def exception_type( llm_provider="azure", response=original_exception.response, ) + elif original_exception.status_code == 503: + exception_mapping_worked = True + raise ServiceUnavailableError( + message=f"AzureException - {original_exception.message}", + model=model, + llm_provider="azure", + response=original_exception.response, + ) + elif original_exception.status_code == 504: # gateway timeout error + exception_mapping_worked = True + raise Timeout( + message=f"AzureException - {original_exception.message}", + model=model, + llm_provider="azure", + ) else: exception_mapping_worked = True raise APIError(