From e46fa61681afac165945abc888b48e2ea079c615 Mon Sep 17 00:00:00 2001 From: Kerry Lu Date: Mon, 16 Nov 2026 21:09:07 -0800 Subject: [PATCH] fix(cost-map): declare mid-conversation system support on Databricks Claude Opus 5.5 (#52214) Co-authored-by: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com> --- ...odel_prices_and_context_window_backup.json | 1 + model_prices_and_context_window.json | 1 + .../test_fallback_generalizations.py | 21 +++++++++++++++++++ 3 files changed, 23 insertions(+) diff --git a/litellm/model_prices_and_context_window_backup.json b/litellm/model_prices_and_context_window_backup.json index 7334d83e6ad..3a6ee700821 100644 --- a/litellm/model_prices_and_context_window_backup.json +++ b/litellm/model_prices_and_context_window_backup.json @@ -22092,6 +22092,7 @@ "supports_forced_tool_use": false, "supports_function_calling": true, "supports_max_reasoning_effort": true, + "supports_mid_conversation_system": true, "supports_minimal_reasoning_effort": false, "supports_none_reasoning_effort": false, "supports_output_config": true, diff --git a/model_prices_and_context_window.json b/model_prices_and_context_window.json index 7334d83e6ad..3a6ee700821 100644 --- a/model_prices_and_context_window.json +++ b/model_prices_and_context_window.json @@ -22092,6 +22092,7 @@ "supports_forced_tool_use": false, "supports_function_calling": true, "supports_max_reasoning_effort": true, + "supports_mid_conversation_system": true, "supports_minimal_reasoning_effort": false, "supports_none_reasoning_effort": false, "supports_output_config": true, diff --git a/tests/unit/litellm_core_utils/test_fallback_generalizations.py b/tests/unit/litellm_core_utils/test_fallback_generalizations.py index b22edaa171a..689768c3510 100644 --- a/tests/unit/litellm_core_utils/test_fallback_generalizations.py +++ b/tests/unit/litellm_core_utils/test_fallback_generalizations.py @@ -598,6 +598,27 @@ def test_shipped_rules_are_provider_neutral_for_unmapped_ids(shipped_cost_map, m assert not info.get("output_cost_per_token") +def _shipped_databricks_claude_rows_matching_the_mid_conversation_rule() -> tuple[str, ...]: + document: Final = json.loads((REPO_ROOT / "model_prices_and_context_window.json").read_text()) + rule: Final = next( + rule + for rule in document["fallback_generalizations"]["rules"] + if rule["name"] == "claude-mid-conversation-system" + ) + pattern: Final = re.compile(rule["pattern"], re.IGNORECASE) + return tuple( + key + for key, row in document.items() + if isinstance(row, dict) and row.get("litellm_provider") == "databricks" and pattern.search(key) + ) + + +@pytest.mark.parametrize("model", _shipped_databricks_claude_rows_matching_the_mid_conversation_rule()) +def test_shipped_databricks_claude_rows_agree_with_the_mid_conversation_rule(shipped_cost_map, model): + """The rule does not fill Databricks rows, so a row that omits the flag turns reminders into user turns.""" + assert litellm.utils.supports_mid_conversation_system(model=model, custom_llm_provider="databricks") is True, model + + @pytest.mark.parametrize( "model,provider,adaptive,mid_conversation", [