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

responses.parse() with background=True returns unparseable Response from retrieve() - missing ParsedResponse support for background mode

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

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

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

2026年3月1日 から。

  • #2909 @shouryamaanjain による — オープン

評価

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

調査の方向性

エントリポイント responses.parse() と responses.retrieve() から始め、background=True と MySchema を使って提供された AsyncOpenAI の再現コードを実行します。各呼び出しがどのように response を構築するかを追跡し、完了を、取得時に解析済みの出力を保持すること、またはサポートされていないワークフローを明確に拒否することのいずれかとして定義し、選択した動作をカバーするテストを追加します。

索引モデルが 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

When using responses.parse() with background=True and a text_format (structured output), the initial call returns a ParsedResponse wrapper. However, when polling for completion using responses.retrieve(), a plain Response object is returned instead of ParsedResponse.

This means output_parsed is not available on the retrieved response, and users must manually parse output_text using their schema's model_validate_json().

The SDK accepts background=True in parse() without warning, but doesn't provide a way to complete the workflow with proper parsing.

Expected behavior:
Either:

  • retrieve() should accept a text_format parameter to return ParsedResponse
    A new retrieve_parsed() method should exist
  • Or parse() should raise an error/warning when background=True is used
To Reproduce

from openai import AsyncOpenAI
from pydantic import BaseModel

class MySchema(BaseModel):
name: str
value: int

client = AsyncOpenAI()

Start background request with structured output

response = await client.responses.parse(
model="gpt-4.1",
input="Generate a name and value",
text_format=MySchema,
background=True
)

Poll for completion

while response.status in ("in_progress", "queued"):
await asyncio.sleep(0.5)
response = await client.responses.retrieve(response.id)

This fails - Response has no output_parsed attribute

print(response.output_parsed) # AttributeError: 'Response' object has no attribute 'output_parsed'

Workaround required:

result = MySchema.model_validate_json(response.output_text)

Code snippets

OS

macOS

Python version

Python v3.12

Library version

openai v2.15.0

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

環境構築

Codespaces で開く

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

はじめの一歩

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

openai/openai-python のほかの issue

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

似ている issue

Python の issue をもっと見る

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

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