Skip to content

The fastest, litest AI Gateway. Rust core with Python SDK. Call 100+ LLM APIs in OpenAI (or native) format with cost tracking, guardrails, load balancing, and logging [Bedrock, Azure, OpenAI, Anthropic, OpenAI, VertexAI, vLLM, Nvidia NIM]

Fix flaky tests: anthropic error_msg state leak and vertex llama 404

yuneng-jiang4030a8b2cd8c
diff --git a/tests/local_testing/test_amazing_vertex_completion.py b/tests/local_testing/test_amazing_vertex_completion.py
index 7c66dd55d78..6f7c371bdb5 100644
--- a/tests/local_testing/test_amazing_vertex_completion.py
+++ b/tests/local_testing/test_amazing_vertex_completion.py
@@ -3691,6 +3691,8 @@ def test_vertex_ai_llama_tool_calling():
response = completion(**args)
except litellm.RateLimitError:
pytest.skip("Rate limit error")
+ except litellm.NotFoundError:
+ pytest.skip("Model not found / resource unavailable")
print(response)
assert response.choices[0].message.tool_calls is not None
diff --git a/tests/local_testing/test_function_calling.py b/tests/local_testing/test_function_calling.py
index e47b32a01f3..1597ab691a9 100644
--- a/tests/local_testing/test_function_calling.py
+++ b/tests/local_testing/test_function_calling.py
@@ -333,6 +333,10 @@ def test_parallel_function_call_anthropic_error_msg(
Reference Issue: https://github.com/BerriAI/litellm/issues/5747, https://github.com/BerriAI/litellm/issues/5388
"""
+ # Ensure modify_params is False so UnsupportedParamsError is raised
+ # (other tests in this file set it to True and don't reset it)
+ original_modify_params = litellm.modify_params
+ litellm.modify_params = False
try:
litellm.set_verbose = True
@@ -363,6 +367,8 @@ def test_parallel_function_call_anthropic_error_msg(
print(e)
except Exception as e:
pytest.fail(f"Error occurred: {e}")
+ finally:
+ litellm.modify_params = original_modify_params
def test_parallel_function_call_stream():