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]
Python ai-gatewayanthropicazure-openaibedrockgatewaylangchainlitellmllmllm-gatewayllmopsmcp-gatewayopenaiopenai-proxyrustrust-aivertex-ai
test(anthropic-adapter): cover empty stop_sequences edge case
Tin Chi Lofed03a41d1e4
diff --git a/tests/test_litellm/llms/anthropic/experimental_pass_through/adapters/test_anthropic_experimental_pass_through_adapters_transformation.py b/tests/test_litellm/llms/anthropic/experimental_pass_through/adapters/test_anthropic_experimental_pass_through_adapters_transformation.pyindex 326c8858551..c0c6e315b5b 100644--- a/tests/test_litellm/llms/anthropic/experimental_pass_through/adapters/test_anthropic_experimental_pass_through_adapters_transformation.py+++ b/tests/test_litellm/llms/anthropic/experimental_pass_through/adapters/test_anthropic_experimental_pass_through_adapters_transformation.py@@ -1627,6 +1627,22 @@ def test_stop_sequences_translated_to_stop_for_non_claude_model():assert "stop_sequences" not in openai_request+def test_empty_stop_sequences_does_not_set_stop():+ from litellm.types.llms.anthropic import AnthropicMessagesRequest++ anthropic_request = AnthropicMessagesRequest(+ model=CACHE_CONTROL_NON_ANTHROPIC_MODEL,+ max_tokens=1024,+ messages=[{"role": "user", "content": "hi"}],+ stop_sequences=[],+ )++ adapter = LiteLLMAnthropicMessagesAdapter()+ openai_request, _ = adapter.translate_anthropic_to_openai(anthropic_message_request=anthropic_request)++ assert "stop" not in openai_request++def test_cache_control_preserved_in_image_content_for_claude():"""Cache control should be preserved in image content for Claude models."""anthropic_messages = [