From 3cc82f558eceec3775d2e3a195523a4f2eb5c8c8 Mon Sep 17 00:00:00 2001 From: Krrish Dholakia Date: Tue, 30 Apr 2024 14:17:10 -0700 Subject: [PATCH] fix(utils.py): add exception mapping for gemini error --- litellm/tests/test_amazing_vertex_completion.py | 2 ++ litellm/utils.py | 5 ++++- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/litellm/tests/test_amazing_vertex_completion.py b/litellm/tests/test_amazing_vertex_completion.py index 5d1198d53..05eece834 100644 --- a/litellm/tests/test_amazing_vertex_completion.py +++ b/litellm/tests/test_amazing_vertex_completion.py @@ -394,6 +394,8 @@ async def test_async_vertexai_response(): pass except litellm.Timeout as e: pass + except litellm.APIError as e: + pass except Exception as e: pytest.fail(f"An exception occurred: {e}") diff --git a/litellm/utils.py b/litellm/utils.py index e5f7f9d11..5c5324be1 100644 --- a/litellm/utils.py +++ b/litellm/utils.py @@ -8130,7 +8130,10 @@ def exception_type( llm_provider="vertex_ai", response=original_exception.response, ) - elif "None Unknown Error." in error_str: + elif ( + "None Unknown Error." in error_str + or "Content has no parts." in error_str + ): exception_mapping_worked = True raise APIError( message=f"VertexAIException - {error_str}",