From f6e52ac771f37ec56ba4a1bcc728e035f354bab3 Mon Sep 17 00:00:00 2001 From: Krrish Dholakia Date: Wed, 21 Feb 2024 21:44:08 -0800 Subject: [PATCH] test: handle api errors for gemini/palm testing --- litellm/tests/test_completion.py | 4 ++++ litellm/tests/test_streaming.py | 2 ++ 2 files changed, 6 insertions(+) diff --git a/litellm/tests/test_completion.py b/litellm/tests/test_completion.py index 798da53f7..7260c243c 100644 --- a/litellm/tests/test_completion.py +++ b/litellm/tests/test_completion.py @@ -1986,6 +1986,8 @@ def test_completion_gemini(): response = completion(model=model_name, messages=messages) # Add any assertions here to check the response print(response) + except litellm.APIError as e: + pass except Exception as e: pytest.fail(f"Error occurred: {e}") @@ -2015,6 +2017,8 @@ def test_completion_palm(): response = completion(model=model_name, messages=messages) # Add any assertions here to check the response print(response) + except litellm.APIError as e: + pass except Exception as e: pytest.fail(f"Error occurred: {e}") diff --git a/litellm/tests/test_streaming.py b/litellm/tests/test_streaming.py index a890f300a..f1640d97d 100644 --- a/litellm/tests/test_streaming.py +++ b/litellm/tests/test_streaming.py @@ -392,6 +392,8 @@ def test_completion_palm_stream(): if complete_response.strip() == "": raise Exception("Empty response received") print(f"completion_response: {complete_response}") + except litellm.APIError as e: + pass except Exception as e: pytest.fail(f"Error occurred: {e}")