From 5f99938cb8b719077102aa4bc705da8d9db484b7 Mon Sep 17 00:00:00 2001 From: Krrish Dholakia Date: Mon, 3 Jun 2024 13:55:25 -0700 Subject: [PATCH] test(test_amazing_vertex_completion.py): add retries for 'Content has no parts.' error in vertex test --- litellm/tests/test_amazing_vertex_completion.py | 1 + litellm/tests/test_completion.py | 4 ++++ litellm/tests/test_router_retries.py | 1 - 3 files changed, 5 insertions(+), 1 deletion(-) diff --git a/litellm/tests/test_amazing_vertex_completion.py b/litellm/tests/test_amazing_vertex_completion.py index 08a27243ea7..ce2e3dcdb82 100644 --- a/litellm/tests/test_amazing_vertex_completion.py +++ b/litellm/tests/test_amazing_vertex_completion.py @@ -295,6 +295,7 @@ async def test_vertex_ai_anthropic_async_streaming(): def test_vertex_ai(): import random + litellm.num_retries = 3 load_vertex_ai_credentials() test_models = ( litellm.vertex_chat_models diff --git a/litellm/tests/test_completion.py b/litellm/tests/test_completion.py index 98e495f45dd..5792c313ab9 100644 --- a/litellm/tests/test_completion.py +++ b/litellm/tests/test_completion.py @@ -97,6 +97,8 @@ def test_null_role_response(): """ import openai + litellm.success_callback = ["lunary"] + openai_client = openai.OpenAI() with patch.object( openai_client.chat.completions, "create", side_effect=_openai_mock_response @@ -112,6 +114,8 @@ def test_null_role_response(): assert response.choices[0].message.role == "assistant" + assert False + def test_completion_azure_command_r(): try: diff --git a/litellm/tests/test_router_retries.py b/litellm/tests/test_router_retries.py index ee84ce3ad7c..db2a1c6465c 100644 --- a/litellm/tests/test_router_retries.py +++ b/litellm/tests/test_router_retries.py @@ -67,7 +67,6 @@ async def test_router_retries_errors(sync_mode, error_type): - Auth Error -> 0 retries - API Error -> 2 retries """ - _api_key = ( "bad-key" if error_type == "Authorization Error" else os.getenv("AZURE_API_KEY") )