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
litellm_fix(test): fix Bedrock tool search header test regression (#20135)
shin-bot-litellm14a570613138
diff --git a/tests/test_litellm/llms/bedrock/chat/invoke_transformations/test_bedrock_chat_invoke_transformations_anthropic_claude3_transformation.py b/tests/test_litellm/llms/bedrock/chat/invoke_transformations/test_bedrock_chat_invoke_transformations_anthropic_claude3_transformation.pyindex 5c1b4cbd38e..edfdeb08d82 100644--- a/tests/test_litellm/llms/bedrock/chat/invoke_transformations/test_bedrock_chat_invoke_transformations_anthropic_claude3_transformation.py+++ b/tests/test_litellm/llms/bedrock/chat/invoke_transformations/test_bedrock_chat_invoke_transformations_anthropic_claude3_transformation.py@@ -335,11 +335,11 @@ def test_advanced_tool_use_header_translation_for_opus_4_5():def test_advanced_tool_use_header_filtered_for_non_opus_4_5():"""- Test that advanced-tool-use-2025-11-20 header is filtered out for non-Opus 4.5 models- without adding Bedrock-specific headers.+ Test that advanced-tool-use-2025-11-20 header is filtered out for models+ that don't support tool search on Bedrock.- The translation to tool-search-tool-2025-10-19 and tool-examples-2025-10-29 should- only happen for Claude Opus 4.5.+ Tool search is supported on: Claude Opus 4.5, Claude Sonnet 4.5+ Tool search is NOT supported on: Claude 3.5 Sonnet and earlier"""from litellm.llms.bedrock.messages.invoke_transformations.anthropic_claude3_transformation import (AmazonAnthropicClaudeMessagesConfig,@@ -360,9 +360,9 @@ def test_advanced_tool_use_header_filtered_for_non_opus_4_5():"anthropic-beta": "advanced-tool-use-2025-11-20"}- # Test with Claude Sonnet 4.5 (not Opus 4.5)+ # Test with Claude 3.5 Sonnet (does NOT support tool search on Bedrock)result = config.transform_anthropic_messages_request(- model="anthropic.claude-sonnet-4-5-20250929-v1:0",+ model="anthropic.claude-3-5-sonnet-20241022-v2:0",messages=messages,anthropic_messages_optional_request_params=anthropic_messages_optional_request_params,litellm_params={},@@ -374,11 +374,11 @@ def test_advanced_tool_use_header_filtered_for_non_opus_4_5():assert "advanced-tool-use-2025-11-20" not in beta_headers, \"advanced-tool-use header should be removed for Bedrock"- # Verify Bedrock-specific headers were NOT added (only for Opus 4.5)+ # Verify Bedrock-specific headers were NOT added (only for Opus 4.5 and Sonnet 4.5)assert "tool-search-tool-2025-10-19" not in beta_headers, \- "tool-search-tool should not be added for non-Opus 4.5 models"+ "tool-search-tool should not be added for models without tool search support"assert "tool-examples-2025-10-29" not in beta_headers, \- "tool-examples should not be added for non-Opus 4.5 models"+ "tool-examples should not be added for models without tool search support"def test_advanced_tool_use_header_translation_with_multiple_beta_headers():