-
Stefy Lanza (nextime / spora ) authored
The chunked-request handler always returns a complete chat.completion dict ("Streaming is not supported for chunked rotation requests"), but stream=true callers still wrap it in the SSE stream generator, which iterated the dict and emitted its KEYS as string chunks (data: "id", data: "choices", ...). Clients crashed with "'str' object has no attribute 'choices'". Previously masked: chunked requests died earlier on the null-content TypeError, so this path was unreachable. When the streaming wrapper receives a plain dict, emit one well-formed chat.completion.chunk instead - delta carrying content and/or tool_calls (with the per-entry index streaming requires), the real finish_reason, usage attached - followed by data: [DONE]. Co-Authored-By:Claude Opus 4.8 (1M context) <noreply@anthropic.com>
5255a04e