fix: keep AmazonConverseConfig.map_openai_params signature-compatible with BaseConfig

CI's basedpyright budget gate flagged reportIncompatibleMethodOverride: adding
base_model as a map_openai_params parameter changed its signature away from
BaseConfig's abstract declaration, which the repo's strict type-checking
budget (ratchet-only, never raised) does not allow.

Thread base_model via a declared instance attribute (configured_base_model,
set by get_optional_params before the call) instead of a method parameter, so
the override signature is unchanged. Every other touched method
(_handle_reasoning_effort_parameter, _process_tools_and_beta,
_transform_request_helper) is AmazonConverseConfig's own private helper, never
declared on BaseConfig, so their added base_model parameters were never an
override-compatibility issue.
This commit is contained in:
Arbin 2026-09-07 19:46:07 +08:00
parent 48ffa103df
commit 6245e1441b
No known key found for this signature in database
GPG key ID: 17A013CB6AD55FD9
2 changed files with 20 additions and 3 deletions

View file

@ -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():

View file

@ -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(