fix(databricks): narrow reasoning_effort_value to str for mypy

`non_default_params.get("reasoning_effort")` returns `Any | None`,
but `REASONING_EFFORT_TO_OUTPUT_CONFIG_EFFORT.get()` expects `str`.
Mypy flagged this on the strict pass. Narrow with `isinstance` before
the lookup; non-strings fall through to the existing `BadRequestError`
below with a clean validation message, so behavior is unchanged.

Fixes a regression introduced by 1a10746e95 in this PR.
This commit is contained in:
mateo-berri
2026-05-04 00:52:09 -07:00
parent f8f07c5cb7
commit 2c9166c4f3
@@ -359,9 +359,15 @@ class DatabricksConfig(DatabricksBase, OpenAILikeChatConfig, AnthropicConfig):
if AnthropicConfig._is_claude_4_6_model(
model
) or AnthropicConfig._is_claude_4_7_model(model):
mapped_effort = REASONING_EFFORT_TO_OUTPUT_CONFIG_EFFORT.get(
reasoning_effort_value
)
# ``reasoning_effort_value`` comes from ``non_default_params``
# so its static type is ``Any | None``. Narrow to ``str`` for
# the mapping lookup; non-strings fall through to the
# ``BadRequestError`` below with a clean validation message.
mapped_effort: Optional[str] = None
if isinstance(reasoning_effort_value, str):
mapped_effort = REASONING_EFFORT_TO_OUTPUT_CONFIG_EFFORT.get(
reasoning_effort_value
)
if mapped_effort is None:
raise litellm.exceptions.BadRequestError(
message=(