responses.parse() with background=True returns unparseable Response from retrieve() - missing ParsedResponse support for background mode
Confirm this is an issue with the Python library and not an underlying OpenAI API
- [x] 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
Interested
i can say that this would really ease things