mirror of
https://github.com/BerriAI/litellm.git
synced 2025-04-26 03:04:13 +00:00
fix(utils.py): exception map vertex ai 500 internal server errors
This commit is contained in:
parent
a7e9e5b3cb
commit
2e49614230
2 changed files with 11 additions and 2 deletions
|
@ -195,6 +195,8 @@ async def test_aimage_generation_vertex_ai():
|
||||||
assert isinstance(d, litellm.ImageObject)
|
assert isinstance(d, litellm.ImageObject)
|
||||||
print("data in response.data", d)
|
print("data in response.data", d)
|
||||||
assert d.b64_json is not None
|
assert d.b64_json is not None
|
||||||
|
except litellm.ServiceUnavailableError as e:
|
||||||
|
pass
|
||||||
except litellm.RateLimitError as e:
|
except litellm.RateLimitError as e:
|
||||||
pass
|
pass
|
||||||
except litellm.ContentPolicyViolationError:
|
except litellm.ContentPolicyViolationError:
|
||||||
|
|
|
@ -9080,7 +9080,7 @@ def exception_type(
|
||||||
):
|
):
|
||||||
exception_mapping_worked = True
|
exception_mapping_worked = True
|
||||||
raise RateLimitError(
|
raise RateLimitError(
|
||||||
message=f"VertexAIException RateLimitError - {error_str}",
|
message=f"litellm.RateLimitError: VertexAIException - {error_str}",
|
||||||
model=model,
|
model=model,
|
||||||
llm_provider="vertex_ai",
|
llm_provider="vertex_ai",
|
||||||
litellm_debug_info=extra_information,
|
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 hasattr(original_exception, "status_code"):
|
||||||
if original_exception.status_code == 400:
|
if original_exception.status_code == 400:
|
||||||
exception_mapping_worked = True
|
exception_mapping_worked = True
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue