Skip to content
Open
Show file tree
Hide file tree
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/types/beta/beta_response_output_text.py
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ class BetaResponseOutputText(BaseModel):
annotations: List[Annotation]
"""The annotations of the text output."""

text: str
text: Optional[str] = None
"""The text output from the model."""

type: Literal["output_text"]
Expand Down
2 changes: 1 addition & 1 deletion src/openai/types/responses/response_output_text.py
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ class ResponseOutputText(BaseModel):
annotations: List[Annotation]
"""The annotations of the text output."""

text: str
text: Optional[str] = None

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 Guard null values when aggregating output text

When the API returns the exact text: null payload this change is intended to accept, deserialization now succeeds, but accessing the common Response.output_text convenience property still appends that None value and passes it to "".join(...), raising TypeError. Update the aggregator to skip or normalize null text in the same change so callers can safely consume these responses.

Useful? React with 👍 / 👎.

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 Avoid parsing null as structured JSON

For client.responses.parse(..., text_format=...), a response containing this newly accepted null value is passed unconditionally from parse_response to parse_text, which then gives None to Pydantic's JSON parser and fails before returning the response. Guard the null case and leave parsed as None; otherwise the structured-response API still rejects the payload this change is meant to support.

Useful? React with 👍 / 👎.

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 Initialize null streaming text before applying deltas

If a streaming response initializes an output_text content part with the newly valid null value and then emits a response.output_text.delta, the response accumulator executes content.text += event.delta, so None + str raises TypeError and terminates the stream. Normalize a null initial value to an empty string before accumulating deltas.

Useful? React with 👍 / 👎.

"""The text output from the model."""

type: Literal["output_text"]
Expand Down