fix(utils.py): exception map vertex ai 500 internal server errors

This commit is contained in:
Krrish Dholakia 2024-06-10 21:36:48 -07:00
parent a7e9e5b3cb
commit 2e49614230
2 changed files with 11 additions and 2 deletions

View file

@ -9080,7 +9080,7 @@ def exception_type(
):
exception_mapping_worked = True
raise RateLimitError(
message=f"VertexAIException RateLimitError - {error_str}",
message=f"litellm.RateLimitError: VertexAIException - {error_str}",
model=model,
llm_provider="vertex_ai",
litellm_debug_info=extra_information,
@ -9092,7 +9092,14 @@ def exception_type(
),
),
)
elif "500 Internal Server Error" in error_str:
exception_mapping_worked = True
raise ServiceUnavailableError(
message=f"litellm.ServiceUnavailableError: VertexAIException - {error_str}",
model=model,
llm_provider="vertex_ai",
litellm_debug_info=extra_information,
)
if hasattr(original_exception, "status_code"):
if original_exception.status_code == 400:
exception_mapping_worked = True