fix(anthropic): satisfy passthrough type gate

Signed-off-by: Hasnaat Hussain <hasnaat.hussain.2@gmail.com>
This commit is contained in:
Hasnaat Hussain 2026-10-02 14:08:37 +05:00
parent c0d576cdbd
commit d9ed76b1c2

View file

@ -679,26 +679,36 @@ def anthropic_messages_handler(
or kwargs.get("drop_params") is True
)
additional_drop_params: Final[Sequence[str] | None] = (
cast( # cast-ok: kwargs are untyped at this compatibility boundary
Sequence[str] | None,
kwargs.get("additional_drop_params"),
)
)
filtered_anthropic_messages_params: Final = (
_drop_unsupported_anthropic_messages_params(
anthropic_messages_optional_request_params=anthropic_messages_optional_request_params,
model=model,
custom_llm_provider=custom_llm_provider,
additional_drop_params=kwargs.get("additional_drop_params"),
additional_drop_params=additional_drop_params,
)
if should_drop_params
else anthropic_messages_optional_request_params
)
thinking_param: Final = filtered_anthropic_messages_params.get("thinking")
final_anthropic_messages_params: Final = (
final_anthropic_messages_params: Final[Mapping[str, object]] = (
MappingProxyType(
{
**filtered_anthropic_messages_params,
"thinking": {
**thinking_param,
"display": "summarized",
cast( # cast-ok: both request parameter maps use string keys
dict[str, object],
{
**filtered_anthropic_messages_params,
"thinking": {
**thinking_param,
"display": "summarized",
},
},
}
)
)
if is_reasoning_auto_summary_enabled()
and isinstance(thinking_param, dict)