litellm/tests/test_litellm/llms/databricks
Mateo Wang 20dabb781a
fix(databricks): split parallel tool calls so each tool message follows tool_calls (#31633)
* fix(databricks): split parallel tool calls so each tool message follows tool_calls

Databricks OpenAI-compatible serving (e.g. GPT models) 400s with "messages with
role 'tool' must be a response to a preceeding message with 'tool_calls'" when an
assistant turn makes parallel tool calls. LiteLLM faithfully sends one assistant
message holding all tool_calls followed by one 'tool' message per result, so every
result after the first is preceded by another 'tool' message rather than the
assistant tool_calls message, which Databricks rejects.

Re-emit each result immediately after an assistant message that carries only its
matching tool_call, turning assistant(tool_calls=[A, B]), tool(A), tool(B) into
assistant(tool_calls=[A]), tool(A), assistant(tool_calls=[B]), tool(B). The
rewrite is a no-op when the turn is already valid (single call), the group is
incomplete, or ids don't line up, so no tool call is ever dropped. Scoped to
non-Claude models, matching the existing OpenAI-shaped transformation path.

* style(databricks): use builtin list generics in parallel tool-call split

Switch the List[...] annotations introduced by _split_parallel_tool_calls
to lowercase list[...] so the UP006 strict-rule budget stays within its
ceiling.
2026-06-29 13:46:53 -07:00
..
chat fix(databricks): split parallel tool calls so each tool message follows tool_calls (#31633) 2026-06-29 13:46:53 -07:00
responses Address Greptile review: fix SDK auth fallback and remove unused imports 2026-02-18 15:57:50 +09: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 Litellm fix GitHub action testing (#11163) 2025-05-26 14:41:42 -07: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 style: run black formatter on files from main merge 2026-04-17 13:02:59 -07:00
test_databricks_pricing.py Update Databricks model pricing and add new models (including databricks pricing test). (#17277) 2025-12-01 20:06:47 -08:00
test_databricks_streaming_utils.py [internal copy of #28007] Fix/gcp model garden streaming (#28363) 2026-06-10 12:31:00 -07:00