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]

refactor(anthropic,bedrock): hoist drop_params output_config warning to module constant

Cursor Agent37ae24dbebc5
diff --git a/litellm/llms/anthropic/chat/transformation.py b/litellm/llms/anthropic/chat/transformation.py
index de021ed0c46..00147b2ec8b 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 dbd55e957fd..3b79d5b5db3 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 a44d5b0ba96..aae2bc5e289 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)