Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/openai/lib/_parsing/_responses.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ def parse_response(
) -> ParsedResponse[TextFormatT]:
output_list: List[ParsedResponseOutputItem[TextFormatT]] = []

for output in response.output:
for output in (response.output or []):
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Preserve streamed output when final response omits it

When a response.completed event has response.output == null after prior streaming output events, this fallback makes parse_response succeed by returning output=[], and ResponseStreamState.accumulate_event stores that as _completed_response instead of the populated stream snapshot. In that exact null-final-output streaming path, get_final_response() and the emitted response.completed.response silently lose all text/tool output that was already accumulated from earlier events; the guard should preserve or parse the existing snapshot rather than replacing it with an empty output list.

Useful? React with 👍 / 👎.

if output.type == "message":
content_list: List[ParsedContent[TextFormatT]] = []
for item in output.content:
Expand Down