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]

Merge branch 'litellm_bedrock_converse_legacy_thinking_adaptive' of https://github.com/BerriAI/litellm into litellm_bedrock_converse_legacy_thinking_adaptive

mateo-berri277cb3a93807
diff --cc tests/test_litellm/llms/bedrock/chat/invoke_transformations/test_bedrock_chat_invoke_transformations_anthropic_claude3_transformation.py
index 4a1e97ca170,d136cb6450b..0d7573a2536
--- 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
@@@ -673,25 -673,20 +673,44 @@@ def test_bedrock_chat_invoke_fable_5_1_
assert "tool_choice" not in result
[email protected]("model", ["us.anthropic.claude-sonnet-5", "us.anthropic.claude-fable-5-1"])
+def test_bedrock_chat_invoke_tool_based_response_format_still_upgrades_legacy_thinking(local_model_cost_map, model):
+ result = AmazonAnthropicClaudeConfig().map_openai_params(
+ non_default_params={
+ "response_format": {
+ "type": "json_schema",
+ "json_schema": {
+ "name": "test_schema",
+ "schema": {"type": "object", "properties": {"result": {"type": "string"}}},
+ },
+ },
+ "thinking": {"type": "enabled", "budget_tokens": 4096},
+ "max_tokens": 8192,
+ },
+ optional_params={},
+ model=model,
+ drop_params=False,
+ )
+
+ assert "tools" in result
+ assert result["thinking"] == {"type": "adaptive"}
+ assert result["output_config"] == {"effort": "high"}
++
++
+ def test_bedrock_chat_invoke_response_format_stub_still_upgrades_legacy_thinking(local_model_cost_map):
+ """Regression: the tool-based ``response_format`` path swaps in a Claude 3 stub
+ model before the shared Anthropic mapping, which hid the adaptive-only model
+ from the legacy ``thinking`` upgrade and left ``type=enabled`` on the wire."""
+ result = AmazonAnthropicClaudeConfig().map_openai_params(
+ non_default_params={
+ "response_format": {"type": "json_object"},
+ "thinking": {"type": "enabled", "budget_tokens": 4096},
+ "max_tokens": 8192,
+ },
+ optional_params={},
+ model="us.anthropic.claude-fable-5-1",
+ drop_params=False,
+ )
+
+ assert result["thinking"] == {"type": "adaptive"}
+ assert result["output_config"] == {"effort": "high"}