litellm/tests/unit/llms/databricks
Mateo Wang edf4097baf
fix(databricks): stream Claude json_schema answers as text on every streaming path (#47424)
* fix(databricks): stream Claude json_schema answers as text on every streaming path

Async and proxy streams on Databricks Claude json_schema returned the
internal json_tool_call tool call with empty text, because the async
stream factory dropped json_mode. Databricks now passes it through, the
json tool's argument fragments stream verbatim as content (a lone {}
fragment was blanked before, corrupting nested empty objects), and the
stream ends with finish_reason stop like the non-stream answer.

* test(databricks): keep the json_schema stream regression tests ahead of the fix

Holds the Databricks transformation at the merge base so the first approval covers the regression tests; the fix commit follows.

* fix(databricks): stream Claude json_schema answers as text on every streaming path

* fix(databricks): keep finish_reason tool_calls when a json_schema stream also calls a user tool

* fix(databricks): drop text beside the json tool and renumber user tools in Claude json_schema streams

With reasoning_effort set, Claude can write prose before json_tool_call or call it next to a user tool.
Streams now hold text until the end and drop it when the json tool was called, renumber user tool
deltas past the dropped json tool so indexes start at 0, and non-stream returns the json tool's
arguments as content next to the user tools.

* fix(databricks): stream JSON-looking text at once and keep prose ahead of user tools in Claude json_schema streams

* fix(databricks): hold a user tool call behind held prose so a later json tool answer does not glue to it

A json_schema stream with thinking on that wrote prose, called a user tool, then called the json tool sent the prose at the user tool call and appended the JSON answer to it, so content did not parse. User tool deltas behind held prose are now held with it and sent merged per index at the json tool or the finish, and a json tool after text already sent is dropped so the answer is not repeated.

* test(databricks): cover json_schema answers on every endpoint in the integration wire cells
2026-10-20 02:41:55 +00:00
..
agent feat(agents): support Databricks Agent Platform agents in the agent gateway (#45681) 2026-10-15 12:42:06 -07:00
chat fix(databricks): stream Claude json_schema answers as text on every streaming path (#47424) 2026-10-20 02:41:55 +00:00
decisions fix(databricks): call the ai_decide AI Function route for decisions and the auto-router (#45722) 2026-10-10 23:58:16 -07:00
messages fix(databricks): use the native Anthropic route for Claude /v1/messages (#46091) 2026-10-18 02:44:38 +00:00
responses test(unit): make every tests/unit directory a package so pytest collection is unique 2026-09-20 11:50:59 +00:00
__init__.py test(unit): make every tests/unit directory a package so pytest collection is unique 2026-09-20 11:50:59 +00:00
test_databricks_common_utils.py test: migrate tests/llm_translation into unit, integration and e2e tiers (#45759) 2026-10-11 07:58:53 +00:00
test_databricks_cost_calculator.py fix(streaming): keep the served service_tier on streamed chunks and spend rows (#42870) 2026-09-29 12:54:17 -07:00
test_databricks_partner_integration.py feat(agents): support Databricks Agent Platform agents in the agent gateway (#45681) 2026-10-15 12:42:06 -07:00
test_databricks_streaming_utils.py fix(vertex_ai): route Model Garden models through the generateContent adapter (#41836) 2026-10-15 08:06:49 -07:00