diff --git a/litellm/llms/bedrock/chat/converse_transformation.py b/litellm/llms/bedrock/chat/converse_transformation.py index a54251f3dfd..2818d46548a 100644 --- a/litellm/llms/bedrock/chat/converse_transformation.py +++ b/litellm/llms/bedrock/chat/converse_transformation.py @@ -126,6 +126,12 @@ class AmazonConverseConfig(BaseConfig): temperature: int | None topP: int | None topK: int | None + # Opaque-id fallback for adaptive-thinking capability resolution (an + # application inference profile ARN in `model` carries no version + # substring). Set by the caller (get_optional_params) before + # map_openai_params runs; not a constructor param, so map_openai_params's + # override stays signature-compatible with BaseConfig. + configured_base_model: str | None = None def __init__( self, @@ -878,8 +884,15 @@ class AmazonConverseConfig(BaseConfig): optional_params: dict, model: str, drop_params: bool, - base_model: str | None = None, ) -> dict: + # Application inference profile ARNs carry no version substring, so the + # adaptive-thinking capability lookup below resolves nothing for them. + # `configured_base_model` is the opaque-id fallback set by the caller + # (get_optional_params, from litellm_params.base_model) — same role as + # Azure's base_model, threaded via an instance attribute rather than a + # map_openai_params parameter so the override stays compatible with + # BaseConfig's shared signature. + base_model: Final = self.configured_base_model is_thinking_enabled: Final = self.is_thinking_enabled(non_default_params) for param, value in non_default_params.items(): diff --git a/litellm/utils.py b/litellm/utils.py index 8f4da474144..6ffe1d9c003 100644 --- a/litellm/utils.py +++ b/litellm/utils.py @@ -4418,12 +4418,16 @@ def get_optional_params( bedrock_route: Final = BedrockModelInfo.get_bedrock_route(model) bedrock_base_model: Final = BedrockModelInfo.get_base_model(model) if bedrock_route == "converse" or bedrock_route == "converse_like": - optional_params = litellm.AmazonConverseConfig().map_openai_params( + _converse_config: Final = litellm.AmazonConverseConfig() + # Set before the call, read via getattr inside map_openai_params — + # keeps the override signature-compatible with BaseConfig. See the + # comment on that method for why. + _converse_config.configured_base_model = base_model + optional_params = _converse_config.map_openai_params( model=model, non_default_params=non_default_params, optional_params=optional_params, drop_params=(drop_params if drop_params is not None and isinstance(drop_params, bool) else False), - base_model=base_model, ) elif bedrock_route == "openai": optional_params = litellm.AmazonBedrockOpenAIConfig().map_openai_params(