From 7c91ea4b861ac91eb98e095f65fe01ea1655bf0e Mon Sep 17 00:00:00 2001 From: Ishaan Jaff Date: Tue, 18 Jun 2024 08:41:23 -0700 Subject: [PATCH] fix exception mapping for vertex ai --- litellm/utils.py | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/litellm/utils.py b/litellm/utils.py index 882185ba8df..2eb1c15593a 100644 --- a/litellm/utils.py +++ b/litellm/utils.py @@ -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(