fix(bedrock): upgrade legacy thinking after the invoke response_format stub model swap

Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
This commit is contained in:
Devin AI 2026-09-02 19:58:05 +00:00
parent 9bd870d47a
commit 0346bb2659
2 changed files with 24 additions and 0 deletions

View file

@ -107,6 +107,11 @@ class AmazonAnthropicClaudeConfig(AmazonInvokeConfig, AnthropicConfig):
# Restore original model name
model = original_model
# The stub model hides the original model from the parent's legacy thinking upgrade
AnthropicModelInfo.translate_legacy_thinking_for_adaptive_model(
model=original_model, optional_params=optional_params, custom_llm_provider="bedrock"
)
# The stub model hides the original model from the parent's forced-tool-use backstop
response_format_tool_choice: Final = optional_params.get("tool_choice")
if (

View file

@ -671,3 +671,22 @@ def test_bedrock_chat_invoke_fable_5_1_response_format_avoids_forced_tool_choice
assert "output_format" not in result
assert "tools" in result
assert "tool_choice" not in result
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"}