fix(bedrock): warn when invoke transformation strips output_config

The Bedrock Invoke chat and messages transformations strip output_config
when neither supports_output_config nor any supports_*_reasoning_effort
flag is set in the model JSON. This was silent; emit a verbose_logger
warning when the strip actually removes a present output_config so newly
released models (where the JSON entry hasn't caught up yet) surface a
clear log line instead of dropping the effort parameter without notice.
This commit is contained in:
mateo-berri 2026-05-21 00:35:09 +00:00
parent d87006881c
commit 9309ebdd35
No known key found for this signature in database
2 changed files with 21 additions and 2 deletions

View file

@ -3,6 +3,7 @@ from typing import TYPE_CHECKING, Any, List, Optional
import httpx
from litellm.anthropic_beta_headers_manager import filter_and_transform_beta_headers
from litellm.litellm_core_utils.litellm_logging import verbose_logger
from litellm.litellm_core_utils.prompt_templates.factory import (
convert_to_anthropic_image_obj,
)
@ -178,7 +179,16 @@ class AmazonAnthropicClaudeConfig(AmazonInvokeConfig, AnthropicConfig):
)
or AnthropicConfig._model_supports_effort_param(model)
):
anthropic_request.pop("output_config", None)
if anthropic_request.pop("output_config", None) is not None:
verbose_logger.warning(
"Bedrock Invoke: stripping unsupported `output_config` for "
"model=%s — neither `supports_output_config` nor any "
"`supports_*_reasoning_effort` flag is set in "
"model_prices_and_context_window.json. Add the capability "
"flag to the model JSON entry if this model accepts "
"`output_config`.",
model,
)
if "anthropic_version" not in anthropic_request:
anthropic_request["anthropic_version"] = self.anthropic_version

View file

@ -569,7 +569,16 @@ class AmazonAnthropicClaudeMessagesConfig(
)
or AnthropicConfig._model_supports_effort_param(model)
):
anthropic_messages_request.pop("output_config", None)
if anthropic_messages_request.pop("output_config", None) is not None:
verbose_logger.warning(
"Bedrock Invoke: stripping unsupported `output_config` for "
"model=%s — neither `supports_output_config` nor any "
"`supports_*_reasoning_effort` flag is set in "
"model_prices_and_context_window.json. Add the capability "
"flag to the model JSON entry if this model accepts "
"`output_config`.",
model,
)
# 5b. Remove `custom` field from tools (Bedrock doesn't support it)
# Claude Code sends `custom: {defer_loading: true}` on tool definitions,