Hacktoberfest 2026:メンテナが10月に向けて印を付けた、オープンで初心者向けの issue。 Hacktoberfest の issue を見る

Response.output_text and responses.parse fail when an output_text item has text: null

オープン
#3,063 コメント 2 件 リアクション 0 件 担当者 0 名 GitHub で見る

メンテナーはふだん 1 日以内に返信

@nightcityblade がすでに取り組んでいます。

2026年4月23日 から。

  • #3099 @MukundaKatta による — マージされずにクローズ
  • #3113 @nightcityblade による — マージされずにクローズ
  • #3400 @he-yufeng による — マージされずにクローズ
  • #3454 @C1-BA-B1-F3 による — マージされずにクローズ
  • #3632 @Xsidz による — マージされずにクローズ

評価

難易度
3/5
見積もり時間
1〜2日
初心者へのやさしさ
35/100
issue の種類
バグ
明瞭さ
おおむね明確
活発さ
停滞
技術スタック
python

調査の方向性

Response.model_validate(data) の再現、Response.output_text、responses.parse(...) から始め、続いてレスポンスの出力テキストモデルとパース経路を調査します。提供された null テキストのペイロードに対する回帰テストのカバレッジを追加し、バリデーションが成功すること、null エントリが無視されること、null でないテキストが引き続きパースされることを確認します。

索引モデルが issue の本文から書いたものです。

説明

bug
Confirm this is an issue with the Python library and not an underlying OpenAI API
  • This is an issue with the Python library
Describe the bug

Response.output_text can fail when a Responses API payload includes an output_text content item whose text field is null.

There are two affected layers:

  • strict response parsing rejects ResponseOutputText.text = null
  • parsed responses can still attempt structured parsing on an output_text item whose text is null

Expected behavior:

  • the SDK should accept nullable output_text.text values from the API
  • Response.output_text should ignore null entries instead of failing
  • responses.parse(...) should skip structured parsing for null output_text items

Related PR: #3062

To Reproduce

Create or receive a Responses API payload where a message contains an output_text item with text: null, for example alongside another normal output_text item.

Code snippets
from openai.types.responses.response import Response

data = {
    "id": "resp_null_output_text",
    "object": "response",
    "created_at": 0,
    "status": "completed",
    "background": False,
    "error": None,
    "incomplete_details": None,
    "instructions": None,
    "max_output_tokens": None,
    "max_tool_calls": None,
    "model": "gpt-4o-mini",
    "output": [
        {
            "id": "msg_null_output_text",
            "type": "message",
            "status": "completed",
            "role": "assistant",
            "content": [
                {
                    "type": "output_text",
                    "annotations": [],
                    "logprobs": [],
                    "text": None,
                },
                {
                    "type": "output_text",
                    "annotations": [],
                    "logprobs": [],
                    "text": '{"message":"hello"}',
                },
            ],
        }
    ],
    "parallel_tool_calls": True,
    "previous_response_id": None,
    "prompt_cache_key": None,
    "reasoning": {"effort": None, "summary": None},
    "safety_identifier": None,
    "service_tier": "default",
    "store": True,
    "temperature": 1.0,
    "text": {"format": {"type": "text"}, "verbosity": "medium"},
    "tool_choice": "auto",
    "tools": [],
    "top_logprobs": 0,
    "top_p": 1.0,
    "truncation": "disabled",
    "usage": {
        "input_tokens": 1,
        "input_tokens_details": {"cached_tokens": 0},
        "output_tokens": 1,
        "output_tokens_details": {"reasoning_tokens": 0},
        "total_tokens": 2,
    },
    "user": None,
    "metadata": {},
}

Response.model_validate(data)
OS

Windows 11

Python version

Python 3.13.12

Library version

openai v2.30.0

主要言語
Python
スター
31.8k
フォーク
7.3k
平均マージ
1日 3時間
マージ済み PR(30日)
131

環境構築

Codespaces で開く

このプロジェクトの開発コンテナを、あなたの GitHub アカウントでブラウザ上に起動します。

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

openai/openai-python のほかの issue

openai/openai-python の issue をすべて見る

似ている issue

Python の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。