diff --git a/litellm/__init__.py b/litellm/__init__.py index 9fb614396..219af0ea1 100644 --- a/litellm/__init__.py +++ b/litellm/__init__.py @@ -808,6 +808,7 @@ from .exceptions import ( APIConnectionError, APIResponseValidationError, UnprocessableEntityError, + InternalServerError, LITELLM_EXCEPTION_TYPES, ) from .budget_manager import BudgetManager diff --git a/litellm/exceptions.py b/litellm/exceptions.py index f84cf3166..484e843b6 100644 --- a/litellm/exceptions.py +++ b/litellm/exceptions.py @@ -638,6 +638,7 @@ LITELLM_EXCEPTION_TYPES = [ APIConnectionError, APIResponseValidationError, OpenAIError, + InternalServerError, ] diff --git a/litellm/tests/test_completion.py b/litellm/tests/test_completion.py index 47c55ca4f..e6cbd1af0 100644 --- a/litellm/tests/test_completion.py +++ b/litellm/tests/test_completion.py @@ -2163,6 +2163,7 @@ def test_completion_azure_key_completion_arg(): logprobs=True, max_tokens=10, ) + print(f"response: {response}") print("Hidden Params", response._hidden_params) diff --git a/litellm/tests/test_image_generation.py b/litellm/tests/test_image_generation.py index fea014e67..1d3d53f70 100644 --- a/litellm/tests/test_image_generation.py +++ b/litellm/tests/test_image_generation.py @@ -76,7 +76,7 @@ def test_image_generation_azure_dall_e_3(): ) print(f"response: {response}") assert len(response.data) > 0 - except litellm.RateLimitError as e: + except litellm.InternalServerError as e: pass except litellm.ContentPolicyViolationError: pass # OpenAI randomly raises these errors - skip when they occur diff --git a/litellm/utils.py b/litellm/utils.py index 42d02f1b8..99fc61c06 100644 --- a/litellm/utils.py +++ b/litellm/utils.py @@ -9805,8 +9805,7 @@ def exception_type( elif custom_llm_provider == "azure": if "Internal server error" in error_str: exception_mapping_worked = True - raise APIError( - status_code=500, + raise litellm.InternalServerError( message=f"AzureException Internal server error - {original_exception.message}", llm_provider="azure", model=model, diff --git a/ruff.toml b/ruff.toml new file mode 100644 index 000000000..8aa9d7073 --- /dev/null +++ b/ruff.toml @@ -0,0 +1 @@ +ignore = ["F403", "F401"] \ No newline at end of file