fix(responses): preserve streamed output items

Keep each message and reasoning item at its announced output index.
Include the answer in completed responses with reasoning or fallback
function calls, and retain reasoning supplied through backend deltas.

Add regression coverage for stream indices, final output, plain text,
and automatic tool parsing.

Assisted-by: Codex:GPT-6
This commit is contained in:
localai-org-maint-bot committed 2026-09-14 16:07:21 +00:00
1 parent f9dab888fe
commit 70938ea3c3
3 files changed
+176 -41

No files matched your search

+9
View File
@@ -340,6 +340,15 @@ curl http://localhost:8080/v1/responses \
}'
```
#### Streaming responses
Set `"stream": true` to receive Server-Sent Events. Each `response.output_item.added` event assigns an `output_index` to an item.
Use that index and the item ID to associate later deltas and completion events with the same item.
If a request without explicit tools produces reasoning, the stream uses separate items for reasoning and answer text.
Each item keeps its original index throughout the stream.
The `response.completed` event includes both items in the same index order, followed by any automatically parsed tool calls.
#### Background Processing
Run requests in the background for long-running tasks: