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]

test: mark flaky test

Krrish Dholakiaae7eecaa4033
diff --git a/tests/llm_translation/test_anthropic_completion.py b/tests/llm_translation/test_anthropic_completion.py
index 40b2a8a27d7..5d32b8ee0e5 100644
--- a/tests/llm_translation/test_anthropic_completion.py
+++ b/tests/llm_translation/test_anthropic_completion.py
@@ -895,31 +895,35 @@ def test_anthropic_citations_api():
"""
from litellm import completion
- resp = completion(
- model="claude-3-5-sonnet-20241022",
- messages=[
- {
- "role": "user",
- "content": [
- {
- "type": "document",
- "source": {
+ try:
+ resp = completion(
+ model="claude-3-5-sonnet-20241022",
+ messages=[
+ {
+ "role": "user",
+ "content": [
+ {
+ "type": "document",
+ "source": {
+ "type": "text",
+ "media_type": "text/plain",
+ "data": "The grass is green. The sky is blue.",
+ },
+ "title": "My Document",
+ "context": "This is a trustworthy document.",
+ "citations": {"enabled": True},
+ },
+ {
"type": "text",
- "media_type": "text/plain",
- "data": "The grass is green. The sky is blue.",
+ "text": "What color is the grass and sky?",
},
- "title": "My Document",
- "context": "This is a trustworthy document.",
- "citations": {"enabled": True},
- },
- {
- "type": "text",
- "text": "What color is the grass and sky?",
- },
- ],
- }
- ],
- )
+ ],
+ }
+ ],
+ )
+
+ except litellm.InternalServerError:
+ pytest.skip("Anthropic overloaded")
citations = resp.choices[0].message.provider_specific_fields["citations"]