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,
|
APIConnectionError,
|
||||||
APIResponseValidationError,
|
APIResponseValidationError,
|
||||||
UnprocessableEntityError,
|
UnprocessableEntityError,
|
||||||
|
InternalServerError,
|
||||||
LITELLM_EXCEPTION_TYPES,
|
LITELLM_EXCEPTION_TYPES,
|
||||||
)
|
)
|
||||||
from .budget_manager import BudgetManager
|
from .budget_manager import BudgetManager
|
||||||
|
|
|
@ -638,6 +638,7 @@ LITELLM_EXCEPTION_TYPES = [
|
||||||
APIConnectionError,
|
APIConnectionError,
|
||||||
APIResponseValidationError,
|
APIResponseValidationError,
|
||||||
OpenAIError,
|
OpenAIError,
|
||||||
|
InternalServerError,
|
||||||
]
|
]
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -2163,6 +2163,7 @@ def test_completion_azure_key_completion_arg():
|
||||||
logprobs=True,
|
logprobs=True,
|
||||||
max_tokens=10,
|
max_tokens=10,
|
||||||
)
|
)
|
||||||
|
|
||||||
print(f"response: {response}")
|
print(f"response: {response}")
|
||||||
|
|
||||||
print("Hidden Params", response._hidden_params)
|
print("Hidden Params", response._hidden_params)
|
||||||
|
|
|
@ -76,7 +76,7 @@ def test_image_generation_azure_dall_e_3():
|
||||||
)
|
)
|
||||||
print(f"response: {response}")
|
print(f"response: {response}")
|
||||||
assert len(response.data) > 0
|
assert len(response.data) > 0
|
||||||
except litellm.RateLimitError as e:
|
except litellm.InternalServerError as e:
|
||||||
pass
|
pass
|
||||||
except litellm.ContentPolicyViolationError:
|
except litellm.ContentPolicyViolationError:
|
||||||
pass # OpenAI randomly raises these errors - skip when they occur
|
pass # OpenAI randomly raises these errors - skip when they occur
|
||||||
|
|
|
@ -9805,8 +9805,7 @@ def exception_type(
|
||||||
elif custom_llm_provider == "azure":
|
elif custom_llm_provider == "azure":
|
||||||
if "Internal server error" in error_str:
|
if "Internal server error" in error_str:
|
||||||
exception_mapping_worked = True
|
exception_mapping_worked = True
|
||||||
raise APIError(
|
raise litellm.InternalServerError(
|
||||||
status_code=500,
|
|
||||||
message=f"AzureException Internal server error - {original_exception.message}",
|
message=f"AzureException Internal server error - {original_exception.message}",
|
||||||
llm_provider="azure",
|
llm_provider="azure",
|
||||||
model=model,
|
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