litellm/litellm/responses
Sameer Kankute 21a21e01f7
fix(responses): use OpenAI SSEDecoder for Responses API streaming (#28566)
* fix(responses): use OpenAI SSEDecoder for Responses API streaming

httpx aiter_lines() uses str.splitlines(), which splits on U+2028 inside
JSON payloads and silently drops response.completed (no spend log). Use
openai._streaming.SSEDecoder (bytes.splitlines before decode) instead.

Co-authored-by: Cursor <cursoragent@cursor.com>

* fix(responses): drop redundant SSE prefix strip after SSEDecoder switch

SSEDecoder already strips the 'data:' field prefix from each event, so the
extra call to _strip_sse_data_from_chunk on sse.data was redundant and could
incorrectly mangle payloads whose actual content starts with 'data:'.

Co-authored-by: Yassin Kortam <yassin@berri.ai>

---------

Co-authored-by: Cursor <cursoragent@cursor.com>
Co-authored-by: Yassin Kortam <yassin@berri.ai>
2026-05-22 10:03:36 -07:00
..
file_search fix(ci): resolve mypy and ruff lint failures 2026-04-15 21:12:51 -07:00
litellm_completion_transformation Litellm oss staging 1 (#28337) 2026-05-20 17:27:03 -07:00
mcp style: run black formatter on files from main merge 2026-04-17 13:02:59 -07:00
main.py Litellm oss staging 1 (#28337) 2026-05-20 17:27:03 -07:00
sse_output_recovery.py Litellm oss staging 04 21 2026 2 (#26569) 2026-05-20 21:25:19 -07:00
streaming_iterator.py fix(responses): use OpenAI SSEDecoder for Responses API streaming (#28566) 2026-05-22 10:03:36 -07:00
utils.py style: run black formatter on files from main merge 2026-04-17 13:02:59 -07:00