litellm/tests/test_litellm/llms/databricks
devin-ai-integration[bot] 5cf17f9ce8
fix(responses): drop client_metadata and merge system messages for Databricks chat-only models (#42390)
* fix(responses): drop client_metadata before bridging to chat completions

Codex CLI sends client_metadata on every /v1/responses call. For a
provider with no native Responses config the chat-completions bridge
forwarded the raw kwargs, so client_metadata reached the provider as a
chat body field and Databricks rejected the request with an unknown
field 400. The bridge now drops the Responses-only request fields
before calling completion while still passing every other kwarg
through, so deployment-level params such as chat_template_kwargs keep
reaching providers without a native config.

* fix(databricks): merge consecutive system messages for chat-template models

Codex sends instructions plus a leading developer item, which the Responses
bridge and the developer-to-system translation turn into two consecutive
system messages that Databricks chat-template models reject with "System
message must be at the beginning". Each run of consecutive system messages
is now merged into one before the request is built for non-Claude models.

Also keep client_metadata out of the bridged chat request even when
allowed_openai_params names it, so both bridge branches drop the same set.

* fix(databricks): skip empty system messages when merging consecutive ones

Databricks drops empty content before the merge, so a system message in a
run could carry no content key and the merge iterated None. Those messages
are now skipped; a run with no content at all keeps its first message.

---------

Co-authored-by: mateo-berri <277851410+mateo-berri@users.noreply.github.com>
2026-09-21 20:09:54 -07:00
..
chat fix(responses): drop client_metadata and merge system messages for Databricks chat-only models (#42390) 2026-09-21 20:09:54 -07:00
responses test(llms): migrate phase 6 provider unit tests to tests/unit 2026-09-20 07:50:30 +00:00
databricks_config.template.txt feat(databricks): Add enhanced authentication, security features, and custom user-agent support 2025-12-22 12:02:51 -08:00
test_databricks_common_utils.py test: drop the cwd-relative sys.path.insert calls from the test suite (#37802) 2026-08-22 09:25:58 -07:00
test_databricks_cost_calculator.py test: keep tests that survive correct cost-map updates 2026-09-15 22:16:08 +00:00
test_databricks_e2e.py feat(databricks): Add enhanced authentication, security features, and custom user-agent support 2025-12-22 12:02:51 -08:00
test_databricks_partner_integration.py fix(databricks): route Unity model services through AI Gateway (#40492) 2026-09-09 17:15:48 -07:00
test_databricks_streaming_utils.py [internal copy of #28007] Fix/gcp model garden streaming (#28363) 2026-06-10 12:31:00 -07:00