fix(databricks): accept Reasoning(effort=..., summary=...) dict for reasoning_effort - #29330
Conversation
Greptile SummaryFixes the Databricks Claude adapter to accept
Confidence Score: 5/5Safe to merge — the change is a minimal, well-tested one-liner that mirrors an identical fix already applied to two sibling adapters. The coercion is isolated to a local variable, does not touch No files require special attention.
|
| Filename | Overview |
|---|---|
| litellm/llms/databricks/chat/transformation.py | Adds dict-to-string coercion for reasoning_effort before passing to AnthropicConfig._map_reasoning_effort, matching the pattern already used in the direct Anthropic and Bedrock Converse adapters. |
| tests/test_litellm/llms/databricks/chat/test_databricks_chat_transformation.py | Adds three new unit tests covering the dict-shape and bare-string paths for reasoning_effort; all tests are mocked with no real network calls, and no existing tests are modified. |
Reviews (1): Last reviewed commit: "fix(databricks): accept Reasoning(effort..." | Re-trigger Greptile
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
|
@hclsys — could you add a screenshot or short video showing a Databricks request with a |
|
@krrish-berri-2 before/after exercised against from litellm.llms.databricks.chat.transformation import DatabricksConfig
cfg = DatabricksConfig()
op = cfg.map_openai_params(
non_default_params={"reasoning_effort": {"effort": "low", "summary": "concise"}},
optional_params={},
model="databricks/databricks-claude-opus-4-7",
drop_params=False,
replace_max_completion_tokens_with_max_tokens=False,
)
print(op.get("thinking"), op.get("output_config"))unpatched main — actually worse than silent-drop here, it raises: this PR: |
1763522 to
2d622fa
Compare
|
branch now starts from internal_staging head. same one-commit change, just clean base. CI should pass. |
|
@krrish-berri-2 best i can offer from this env is the test stdout exercising the Reasoning(effort=..., summary=...) dict path end-to-end through DatabricksConfig.map_openai_params: CI is green. happy to add more coverage if you want it. |
…easoning_effort Same companion fix as bedrock-converse and the direct Anthropic path (BerriAI#25359 / BerriAI#28196). Databricks Claude's `map_openai_params` passed the raw value straight to `AnthropicConfig._map_reasoning_effort`, which compares with string equality (`reasoning_effort == "low"`) so a dict shape was silently dropped and `thinking`/`output_config` never got set. The downstream `isinstance(reasoning_effort_value, str)` check for the adaptive Claude output_config also short-circuited, raising a misleading "invalid reasoning_effort" error from `_raise_invalid_reasoning_effort`. Coerce the dict to its `effort` string before any downstream branch, matching the bedrock + anthropic adapters. Related to BerriAI#28196 (third + final adapter in the same lane).
…ger adaptive in base)
2d622fa to
c2b8927
Compare
Third + final adapter in the #28196 lane — direct Anthropic path was fixed in #25359, Bedrock Converse companion is #29329, this is Databricks Claude.
Same root cause:
map_openai_paramspassed the rawreasoning_effortstraight toAnthropicConfig._map_reasoning_effort, which compares with string equality (reasoning_effort == "low"), so the OpenAI ResponsesReasoning(effort, summary)dict shape returned None → nothinking/output_configset. The downstreamisinstance(reasoning_effort_value, str)adaptive-Claude check would then short-circuit, surfacing a misleadinginvalid reasoning_effortfrom_raise_invalid_reasoning_effort.fix
One-liner coercion before any downstream branch — matches what bedrock + anthropic already do:
proof
sibling tests in the same file (11 pre-existing) still pass.