fix exception mapping for vertex ai

This commit is contained in:
Ishaan Jaff 2024-06-18 08:38:36 -07:00
parent fdb9b24b9f
commit 8f3bd0780b

View file

@ -6297,6 +6297,7 @@ def exception_type(
)
elif (
"429 Quota exceeded" in error_str
or "Quota exceeded for" in error_str
or "IndexError: list index out of range" in error_str
or "429 Unable to submit request because the service is temporarily out of capacity."
in error_str
@ -6339,6 +6340,22 @@ def exception_type(
),
),
)
if original_exception.status_code == 429:
exception_mapping_worked = True
raise RateLimitError(
message=f"litellm.RateLimitError: VertexAIException - {error_str}",
model=model,
llm_provider="vertex_ai",
litellm_debug_info=extra_information,
response=httpx.Response(
status_code=429,
request=httpx.Request(
method="POST",
url=" https://cloud.google.com/vertex-ai/",
),
),
)
if original_exception.status_code == 500:
exception_mapping_worked = True
raise litellm.InternalServerError(