litellm/tests/unit/completion_extras
zoveki e6220e82b8
fix(responses): replay phase on the azure route and tag streamed text deltas with phase (#51059)
* fix(responses): replay phase on the azure route and tag streamed text deltas with phase

* test(integration): expect phase and replay on azure responses bridge chat cases

* test(responses): expect phase and the replay record in the Azure translation cases

Azure now joins the replay path, so its bridged tool turns carry phase and openai_responses_replay. Follow-up requests replay the previous turn without its record, and the streamed_phases docstring names the event that sets it

* fix(responses): label each cached stream chunk with its own message's phase

A cache hit replayed as a stream put the whole message's phase on the first
text chunk and none on the rest. The replay now splits the cached content by
the replay record's message lengths, so each chunk carries its message's phase
like a fresh stream. The undefined-phase tests also run on Azure now.

* fix(responses): carry each stream chunk's phase at chunk level so the OpenAI SDK keeps one phase

The OpenAI SDK's client.chat.completions.stream() joins every string in a delta, so a phase on every text delta assembled as "commentarycommentary..." and LiteLLM rejected the next turn. The phase now goes in the chunk's own provider_specific_fields on live and cached streams, and the final chunk's delta carries the turn's phase and replay record once, as on main

* fix(responses): build the replay chunk's empty default with a factory so the module imports on Python 3.11

---------

Co-authored-by: mateo-berri <277851410+mateo-berri@users.noreply.github.com>
2026-11-17 21:54:33 +00:00
..
litellm_responses_transformation fix(responses): replay phase on the azure route and tag streamed text deltas with phase (#51059) 2026-11-17 21:54:33 +00:00
__init__.py test: add __init__.py to migrated tests/unit packages 2026-09-20 11:53:49 +00:00
test_litellm_responses_transformation_transformation.py test: migrate wave 1 phase 1 legacy tests to tests/unit 2026-09-20 09:17:57 +00:00
test_responses_bridge_provider_propagation.py fix(responses): honor request cache controls on chat completions bridged to the Responses API (#44676) 2026-10-05 17:52:44 -07:00