responses.parse() with background=True returns unparseable Response from retrieve() - missing ParsedResponse support for background mode
I maintainer di solito rispondono entro 1 giorno
Valutazione
- Difficoltà
- 3/5
- Tempo stimato
- 1-2 giorni
- Idoneità per principianti
- 52/100
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
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
Avvia il container di sviluppo del progetto nel browser, con il tuo account GitHub.
- Nessun Dockerfile né file Docker Compose
- Ha un modello di pull request
- Leggi la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di openai/openai-python
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
openai/openai-python#4022 · 19 commenti ·
I maintainer di solito rispondono entro 1 giorno
-
fix(auth): SubjectTokenProviderError drops response and duplicates error message in workload identity providersForse già presa @mohmedmm l’ha presa 9 giorni fa. Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 86/100
openai/openai-python#4017 · 3 commenti ·
I maintainer di solito rispondono entro 1 giorno
-
Querystring drops explicit empty-string scalar valuesForse già presa @sylvesterkaczmarek l’ha presa 32 giorni fa. Apertasdk-breaking-change v4
Difficoltà 2/5 1-3 ore Idoneità per principianti 86/100
openai/openai-python#3837 ·
I maintainer di solito rispondono entro 1 giorno
-
Define + export `ServiceTiers` string literalForse già presa @SparshGarg999 l’ha presa 58 giorni fa. Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 68/100
openai/openai-python#3556 · 3 commenti ·
I maintainer di solito rispondono entro 1 giorno
-
Empty OPENAI_BASE_URL prevents fallback to default API endpointForse già presa @Sehastrajit-S l’ha presa 24 giorni fa. Apertabug
Difficoltà 2/5 1-3 ore Idoneità per principianti 68/100
openai/openai-python#2927 · 6 commenti ·
I maintainer di solito rispondono entro 1 giorno
Tutte le issue di openai/openai-python
Issue simili
-
Broken links found in docsApertadocs pydanty:is-working
Difficoltà 2/5 1-3 ore Idoneità per principianti 68/100
pydantic/pydantic-ai#10113 ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 77/100
GreedyBear-Project/GreedyBear#1727 ·
I maintainer di solito rispondono entro 2 giorni
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 84/100
ARM-software/CMSIS-DSP#354 ·
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 68/100
kiat/codeAssist#391 ·
-
needs triage
Difficoltà 2/5 1-3 ore Idoneità per principianti 83/100
darnitdevorg/darnit#587 ·
I maintainer di solito rispondono entro 1 giorno