litellm/tests/unit/llms/databricks
paveln83 ea96ea3db5
fix(anthropic): close /v1/messages thinking blocks with a signature and keep bridged output (#52116)
* fix(anthropic): close /v1/messages thinking blocks with a signature and keep bridged output

* fix(anthropic): close rebuilt-stream thinking blocks with a signature_delta

* fix(anthropic): drop unsigned thinking before Claude, stream raw reasoning_text, close rebuilt thinking blocks with signature_delta

A Claude target on /v1/messages now gets unsigned thinking blocks left out of the request, so a switch from a reasoning_content model makes one call and keeps thinking, except when that would leave the final tool turn without its opening thinking block

Raw response.reasoning_text deltas from the Responses bridge stream as thinking, and a stream rebuilt from a full answer or rewritten by a guardrail closes each thinking block with a signature_delta, the real signature or an empty string

* fix(anthropic): stream a whole reasoning item as a closed thinking block

A Responses stream can send a reasoning item whole in output_item.added and output_item.done with no text deltas, as litellm's own stream does for gpt-oss on OpenRouter. The /v1/messages stream now builds that item's thinking block with the same helper the non-streamed response uses, so streamed and non-streamed answers carry the same reasoning

* test(anthropic): mark the new streaming test locals Final

* fix(anthropic): drop unsigned thinking before every Claude call, a pending tool turn included

Anthropic answers 400 to a thinking block with an empty signature but accepts a
tool turn with no thinking, so the strip no longer keeps the block that opens the
pending tool turn. The check now looks for "claude" in the model name, which covers
Claude behind every messages route and the chat adapter, not only four providers

* fix(anthropic): strip unsigned thinking when a deployment's base_model names Claude

* fix(anthropic): drop unsigned thinking for an alias whose base_model names Claude on the native messages path

The chat adapter already read base_model before leaving unsigned thinking out of a Claude request. The native messages transform and the Rust request transform now read it too, so an aliased Claude deployment gets one call instead of a 400 and a retry

* test(anthropic): build the pending tool turn without mutating it in the Rust strip test

The Rust test now builds its expected messages from the same helper instead of editing them afterward, and a doc comment that only restated a helper's name is gone

---------

Co-authored-by: mateo-berri <277851410+mateo-berri@users.noreply.github.com>
2026-11-16 20:44:27 -08:00
..
agent feat(agents): support Databricks Agent Platform agents in the agent gateway (#45681) 2026-10-15 12:42:06 -07:00
chat fix(anthropic): disable optional default thinking for reasoning effort none (#50541) 2026-11-07 12:51:37 -08:00
decisions fix(databricks): reuse base OAuth for decisions (#48395) (#48527) 2026-10-26 20:18:16 -07:00
messages fix(anthropic): close /v1/messages thinking blocks with a signature and keep bridged output (#52116) 2026-11-16 20:44:27 -08: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 fix(databricks): reuse base OAuth for decisions (#48395) (#48527) 2026-10-26 20:18:16 -07:00
test_databricks_cost_calculator.py chore(databricks): price claude-fable-5-2 from the proprietary pricing page (#51232) 2026-11-12 00:43:40 +00: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