From 37ae24dbebc582180feec84afb995f2822d6d976 Mon Sep 17 00:00:00 2001 From: Cursor Agent Date: Mon, 4 May 2026 21:05:25 +0000 Subject: [PATCH] refactor(anthropic,bedrock): hoist drop_params output_config warning to module constant Three call sites (anthropic chat, bedrock converse, bedrock invoke messages) emitted the same '...Effort is only supported on Opus 4.5+, Sonnet 4.6+, and Mythos Preview' warning verbatim. Extract DROP_UNSUPPORTED_OUTPUT_CONFIG_WARNING in litellm/llms/anthropic/chat/transformation.py and import it from the bedrock sites so future copy edits live in one place. Addresses Michael's review on PR #27074. Co-authored-by: Mateo Wang --- litellm/llms/anthropic/chat/transformation.py | 10 +++++++--- litellm/llms/bedrock/chat/converse_transformation.py | 5 ++--- .../anthropic_claude3_transformation.py | 9 +++++---- 3 files changed, 14 insertions(+), 10 deletions(-) diff --git a/litellm/llms/anthropic/chat/transformation.py b/litellm/llms/anthropic/chat/transformation.py index de021ed0c4..00147b2ec8 100644 --- a/litellm/llms/anthropic/chat/transformation.py +++ b/litellm/llms/anthropic/chat/transformation.py @@ -113,6 +113,12 @@ REASONING_EFFORT_TO_OUTPUT_CONFIG_EFFORT: Dict[str, str] = { "max": "max", } +DROP_UNSUPPORTED_OUTPUT_CONFIG_WARNING = ( + "Dropping unsupported `output_config` for model=%s " + "(drop_params=True). Effort is only supported on Opus 4.5+, " + "Sonnet 4.6+, and Mythos Preview." +) + class AnthropicConfig(AnthropicModelInfo, BaseConfig): """ @@ -1630,9 +1636,7 @@ class AnthropicConfig(AnthropicModelInfo, BaseConfig): return if litellm.drop_params is True and not self._model_supports_effort_param(model): litellm.verbose_logger.warning( - "Dropping unsupported `output_config` for model=%s " - "(drop_params=True). Effort is only supported on Opus 4.5+, " - "Sonnet 4.6+, and Mythos Preview.", + DROP_UNSUPPORTED_OUTPUT_CONFIG_WARNING, model, ) optional_params.pop("output_config", None) diff --git a/litellm/llms/bedrock/chat/converse_transformation.py b/litellm/llms/bedrock/chat/converse_transformation.py index dbd55e957f..3b79d5b5db 100644 --- a/litellm/llms/bedrock/chat/converse_transformation.py +++ b/litellm/llms/bedrock/chat/converse_transformation.py @@ -32,6 +32,7 @@ from litellm.litellm_core_utils.prompt_templates.factory import ( _bedrock_tools_pt, ) from litellm.llms.anthropic.chat.transformation import ( + DROP_UNSUPPORTED_OUTPUT_CONFIG_WARNING, REASONING_EFFORT_TO_OUTPUT_CONFIG_EFFORT, AnthropicConfig, ) @@ -1282,9 +1283,7 @@ class AmazonConverseConfig(BaseConfig): and not AnthropicConfig._model_supports_effort_param(model) ): litellm.verbose_logger.warning( - "Dropping unsupported `output_config` for model=%s " - "(drop_params=True). Effort is only supported on " - "Opus 4.5+, Sonnet 4.6+, and Mythos Preview.", + DROP_UNSUPPORTED_OUTPUT_CONFIG_WARNING, model, ) else: diff --git a/litellm/llms/bedrock/messages/invoke_transformations/anthropic_claude3_transformation.py b/litellm/llms/bedrock/messages/invoke_transformations/anthropic_claude3_transformation.py index a44d5b0ba9..aae2bc5e28 100644 --- a/litellm/llms/bedrock/messages/invoke_transformations/anthropic_claude3_transformation.py +++ b/litellm/llms/bedrock/messages/invoke_transformations/anthropic_claude3_transformation.py @@ -16,7 +16,10 @@ import litellm from litellm.anthropic_beta_headers_manager import filter_and_transform_beta_headers from litellm.constants import BEDROCK_MIN_THINKING_BUDGET_TOKENS from litellm.litellm_core_utils.litellm_logging import verbose_logger -from litellm.llms.anthropic.chat.transformation import AnthropicConfig +from litellm.llms.anthropic.chat.transformation import ( + DROP_UNSUPPORTED_OUTPUT_CONFIG_WARNING, + AnthropicConfig, +) from litellm.llms.anthropic.common_utils import AnthropicModelInfo from litellm.llms.anthropic.experimental_pass_through.messages.transformation import ( AnthropicMessagesConfig, @@ -588,9 +591,7 @@ class AmazonAnthropicClaudeMessagesConfig( and not AnthropicConfig._model_supports_effort_param(model) ): verbose_logger.warning( - "Dropping unsupported `output_config` for model=%s " - "(drop_params=True). Effort is only supported on Opus 4.5+, " - "Sonnet 4.6+, and Mythos Preview.", + DROP_UNSUPPORTED_OUTPUT_CONFIG_WARNING, model, ) anthropic_messages_request.pop("output_config", None)