mirror of
https://github.com/BerriAI/litellm.git
synced 2025-04-26 03:04:13 +00:00
fix(utils.py): fix azure exception mapping
This commit is contained in:
parent
241f0aad5e
commit
245ec2430e
2 changed files with 18 additions and 0 deletions
|
@ -279,6 +279,9 @@ def test_completion_azure_gpt4_vision():
|
||||||
except openai.RateLimitError as e:
|
except openai.RateLimitError as e:
|
||||||
print("got a rate liimt error", e)
|
print("got a rate liimt error", e)
|
||||||
pass
|
pass
|
||||||
|
except openai.APIStatusError as e:
|
||||||
|
print("got an api status error", e)
|
||||||
|
pass
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
pytest.fail(f"Error occurred: {e}")
|
pytest.fail(f"Error occurred: {e}")
|
||||||
|
|
||||||
|
|
|
@ -6964,6 +6964,21 @@ def exception_type(
|
||||||
llm_provider="azure",
|
llm_provider="azure",
|
||||||
response=original_exception.response,
|
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:
|
else:
|
||||||
exception_mapping_worked = True
|
exception_mapping_worked = True
|
||||||
raise APIError(
|
raise APIError(
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue