Skip to content

Update output's content.text to be nullable.#3105

Open
grace-young wants to merge 1 commit intoopenai:mainfrom
grace-young:fix-output-text-to-be-nullable
Open

Update output's content.text to be nullable.#3105
grace-young wants to merge 1 commit intoopenai:mainfrom
grace-young:fix-output-text-to-be-nullable

Conversation

@grace-young
Copy link
Copy Markdown

@grace-young grace-young commented Apr 20, 2026

  • I understand that this repository is auto-generated and my pull request may not be merged

Changes being requested

Ignore output_text that is None, and make text Optional.

Additional context & links

#3063

@grace-young grace-young requested a review from a team as a code owner April 20, 2026 19:25
Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 13d8b3e256

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

"""The annotations of the text output."""

text: str
text: Optional[str]:
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P0 Badge Remove stray colon from text type annotation

The field declaration text: Optional[str]: is invalid Python syntax, so importing this module raises a SyntaxError before runtime logic can execute. Any code path that imports openai.types.responses.response_output_text (including from openai.types.responses.response import Response) will fail immediately, making the responses types unusable.

Useful? React with 👍 / 👎.

for content in output.content:
if content.type == "output_text":
texts.append(content.text)
if content.text != 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 Keep type guard before reading content.text

This change removes the content.type == "output_text" check and directly accesses content.text, but output.content can include ResponseOutputRefusal entries that do not define a text attribute. In responses containing refusal content, accessing response.output_text will now raise AttributeError instead of returning aggregated text.

Useful? React with 👍 / 👎.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant