Skip to content

The fastest, litest AI Gateway. Rust core with Python SDK. Call 100+ LLM APIs in OpenAI (or native) format with cost tracking, guardrails, load balancing, and logging [Bedrock, Azure, OpenAI, Anthropic, OpenAI, VertexAI, vLLM, Nvidia NIM]

fix(databricks): upgrade legacy thinking to adaptive on adaptive-only Claude models

mateo-berri9bd870d47a70
diff --git a/litellm/llms/databricks/chat/transformation.py b/litellm/llms/databricks/chat/transformation.py
index c587146005f..65622d62af2 100644
--- a/litellm/llms/databricks/chat/transformation.py
+++ b/litellm/llms/databricks/chat/transformation.py
@@ -330,6 +330,10 @@ class DatabricksConfig(DatabricksBase, OpenAILikeChatConfig, AnthropicConfig):
) -> dict:
is_thinking_enabled: Final = self.is_thinking_enabled(non_default_params)
mapped_params: Final = super().map_openai_params(non_default_params, optional_params, model, drop_params)
+ if "claude" in model:
+ AnthropicConfig.translate_legacy_thinking_for_adaptive_model(
+ model=model, optional_params=mapped_params, custom_llm_provider="databricks"
+ )
if "tools" in mapped_params:
mapped_params["tools"] = self._map_openai_to_dbrx_tool(model=model, tools=mapped_params["tools"])
if "max_completion_tokens" in non_default_params and replace_max_completion_tokens_with_max_tokens:
diff --git a/tests/test_litellm/llms/databricks/chat/test_databricks_chat_transformation.py b/tests/test_litellm/llms/databricks/chat/test_databricks_chat_transformation.py
index 41fb2589655..71661cc532b 100644
--- a/tests/test_litellm/llms/databricks/chat/test_databricks_chat_transformation.py
+++ b/tests/test_litellm/llms/databricks/chat/test_databricks_chat_transformation.py
@@ -422,6 +422,27 @@ def test_databricks_config_probes_capabilities_under_databricks_namespace():
assert DatabricksConfig().custom_llm_provider == "databricks"
+ "model, expected_thinking, expected_output_config",
+ [
+ ("databricks-claude-opus-4-8", {"type": "adaptive"}, {"effort": "high"}),
+ ("databricks-claude-opus-4-6", {"type": "enabled", "budget_tokens": 4096}, None),
+ ],
+ ids=["adaptive_only_upgrades_to_adaptive", "legacy_capable_forwards_verbatim"],
+)
+def test_map_openai_params_upgrades_legacy_thinking_on_adaptive_only_claude(
+ model, expected_thinking, expected_output_config
+):
+ mapped = DatabricksConfig().map_openai_params(
+ non_default_params={"thinking": {"type": "enabled", "budget_tokens": 4096}},
+ optional_params={},
+ model=model,
+ drop_params=False,
+ )
+ assert mapped["thinking"] == expected_thinking
+ assert mapped.get("output_config") == expected_output_config
+
+
def _streaming_chunk(usage=None, choices=None):
base = {
"id": "chatcmpl-test",