Skip to content
Open
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 completion output is null

When a streamed Responses request ends with response.completed carrying output: null after earlier output item/content events, this fallback parses the completion payload as an empty ParsedResponse. ResponseStreamState.accumulate_event passes event.response directly into parse_response, and get_final_response()/the completed event then expose _completed_response, so callers receive empty output/output_text even though the accumulated snapshot contains the generated items. The null case needs to reuse or merge the accumulated stream snapshot instead of coercing it to [] here.

Useful? React with 👍 / 👎.

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