fix(anthropic): avoid duplicate untyped capability reads

Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
This commit is contained in:
mateo 2026-11-07 22:30:28 +00:00
parent 2664f6c059
commit f80ca05153
2 changed files with 2 additions and 4 deletions

View file

@ -2518,8 +2518,7 @@ class AnthropicConfig(AnthropicModelInfo, BaseConfig):
# Anthropic errors with: "When thinking is disabled, an assistant message cannot contain thinking"
# Related issue: https://github.com/BerriAI/litellm/issues/18926
if (
optional_params.get("thinking") is not None
and optional_params.get("thinking") != {"type": "between_tools"}
optional_params.get("thinking") not in (None, {"type": "between_tools"})
and last_assistant_with_tool_calls_has_no_thinking_blocks(capped_messages)
and not any_assistant_message_has_thinking_blocks(capped_messages)
):

View file

@ -2172,8 +2172,7 @@ class AmazonConverseConfig(BaseConfig):
# If any message has thinking_blocks, we must keep thinking enabled, otherwise
# Related issues: https://github.com/BerriAI/litellm/issues/14194
if (
optional_params.get("thinking") is not None
and optional_params.get("thinking") != {"type": "between_tools"}
optional_params.get("thinking") not in (None, {"type": "between_tools"})
and messages is not None
and last_assistant_with_tool_calls_has_no_thinking_blocks(messages)
and not any_assistant_message_has_thinking_blocks(messages)