forked from phoenix/litellm-mirror
fix(utils.py): fix exception mapping for azure internal server error
This commit is contained in:
parent
677e0255c8
commit
6e9bca59b0
6 changed files with 6 additions and 3 deletions
|
@ -808,6 +808,7 @@ from .exceptions import (
|
|||
APIConnectionError,
|
||||
APIResponseValidationError,
|
||||
UnprocessableEntityError,
|
||||
InternalServerError,
|
||||
LITELLM_EXCEPTION_TYPES,
|
||||
)
|
||||
from .budget_manager import BudgetManager
|
||||
|
|
|
@ -638,6 +638,7 @@ LITELLM_EXCEPTION_TYPES = [
|
|||
APIConnectionError,
|
||||
APIResponseValidationError,
|
||||
OpenAIError,
|
||||
InternalServerError,
|
||||
]
|
||||
|
||||
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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,
|
||||
|
|
1
ruff.toml
Normal file
1
ruff.toml
Normal file
|
@ -0,0 +1 @@
|
|||
ignore = ["F403", "F401"]
|
Loading…
Add table
Add a link
Reference in a new issue