Hacktoberfest 2026: le issue che i maintainer hanno segnato per ottobre, aperte e adatte ai principianti. Sfoglia le issue Hacktoberfest

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

Aperta
#2,830 2 commenti 1 reazione 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 1 giorno

@shouryamaanjain ci sta già lavorando.

Dal 1/3/2026.

  • #2909 di @shouryamaanjain — aperta

Valutazione

Difficoltà
3/5
Tempo stimato
1-2 giorni
Idoneità per principianti
52/100
Tipo di issue
Bug
Chiarezza
Abbastanza chiara
Stato di attività
Ferma
Stack tecnologico
python
Ambito
api

Direzione di ricerca

Inizia con gli entry point responses.parse() e responses.retrieve() ed esegui la riproduzione fornita di AsyncOpenAI usando background=True e MySchema. Traccia il modo in cui ogni chiamata costruisce la propria response e definisci il completamento come la conservazione dell’output analizzato durante il recupero oppure come un rifiuto chiaro del workflow non supportato, con una coverage per il comportamento scelto.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

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

Lingua principale
Python
Stelle
31.8k
Fork
7.3k
Merge medio
1g 3h
PR unite (30g)
131

Preparare l'ambiente

Apri in Codespaces

Avvia il container di sviluppo del progetto nel browser, con il tuo account GitHub.

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di openai/openai-python

Tutte le issue di openai/openai-python

Issue simili

Altre issue su Python

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.