From 002b794727f22878bf0ecfd5c36439f3d4620a7a Mon Sep 17 00:00:00 2001 From: Krrish Dholakia Date: Wed, 21 Feb 2024 21:30:22 -0800 Subject: [PATCH] fix(utils.py): add exception mapping for gemini --- litellm/tests/test_streaming.py | 2 ++ litellm/utils.py | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/litellm/tests/test_streaming.py b/litellm/tests/test_streaming.py index 58dc25fb053..bf0da99d986 100644 --- a/litellm/tests/test_streaming.py +++ b/litellm/tests/test_streaming.py @@ -461,6 +461,8 @@ async def test_acompletion_gemini_stream(): print(f"completion_response: {complete_response}") if complete_response.strip() == "": raise Exception("Empty response received") + except litellm.APIError as e: + pass except Exception as e: pytest.fail(f"Error occurred: {e}") diff --git a/litellm/utils.py b/litellm/utils.py index 9c11e1bd1aa..dc83b340f76 100644 --- a/litellm/utils.py +++ b/litellm/utils.py @@ -6797,7 +6797,7 @@ def exception_type( llm_provider="vertex_ai", request=original_exception.request, ) - elif custom_llm_provider == "palm": + elif custom_llm_provider == "palm" or custom_llm_provider == "gemini": if "503 Getting metadata" in error_str: # auth errors look like this # 503 Getting metadata from plugin failed with error: Reauthentication is needed. Please run `gcloud auth application-default login` to reauthenticate.