Repository navigation
fix: include response.output on /v1/responses response.completed for streamed turns - #120
Merged
Merged
Conversation
…streamed turns Both streaming branches of POST /v1/responses omitted the final `output` array from response.completed, even though response.created always sends one (empty). Client SDKs that aggregate the turn from response.output - e.g. langchainjs-openai, which does `response.output.map(...)` - crashed on undefined. The tool-call branch now collects the completed function_call items it already emits via response.output_item.done and includes them as `output`. The text branch builds the completed assistant message (with its output_text content) and sends it as the single `output` entry; response.output_item.done for the text turn now carries that same content instead of a bare message stub. Updated the stream conformance fixture and added regression tests asserting response.completed.data.response.output for both the text and tool-call paths.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
Both streaming branches of
POST /v1/responsesomitted the finaloutputarray from theresponse.completedevent, even thoughresponse.createdalways sends one (empty).Client SDKs that aggregate the turn from
response.output— e.g.langchainjs-openai, which doesresponse.output.map(...)— crash onundefined.Fix
function_callitems it already emits viaresponse.output_item.doneand includes them asoutput.output_textcontent) and sends it as the singleoutputentry. Itsresponse.output_item.donenow carries that same content instead of a bare message stub.This matches the non-streaming
createResponsesApiResponse()shape, which already includesoutput.Tests
response.completed.data.response.output.openai-responsesto reflect the new payload.Notes
The original attempt at this (branch
fix/responses-output-and-idle-timeout) never landed; its still-relevant half is thisoutputfix. The Bun idle-timeout half is already onmain.