[Bugfix][Responses API] Build streamed final response from streamed items (#59307)

Signed-off-by: sfeng33 <4florafeng@gmail.com>
This commit is contained in:
Flora Feng
2026-09-30 00:16:05 +00:00
committed by GitHub
parent 4e0a414c44
commit 7ca31ef599
5 changed files with 151 additions and 75 deletions
@@ -194,6 +194,9 @@ class SimpleContext(ConversationContext):
self._accumulated_text: str = ""
self._accumulated_token_ids: list[int] = []
self._accumulated_logprobs: list = []
# Items already sent as output_item.done events; the final
# streaming response reuses them instead of reparsing.
self.streamed_output_items: list[ResponseOutputItem] | None = None
self.num_prompt_tokens = 0
self.num_output_tokens = 0