Skip to content

Parse structured outputs when retrieving background Responses #308

Description

@jbeckwith-oai

Carried over from #126 and originally requested by @agrobbin.

Structured-output parsing works when creating a Response synchronously and when resuming a response stream with the model supplied again. It is still not available for the ordinary non-streaming background retrieval path: client.responses.retrieve(response_id) does not accept a structured-output model, so retrieved output cannot be coerced back into that model through content.parsed.

Desired behavior

Allow callers to supply the original structured-output model when retrieving a stored/background Response, for example:

response = client.responses.retrieve(
  response_id,
  text: CalendarEvent
)

The exact API can differ, but it should:

  • parse matching output content into the supplied model;
  • support tool models consistently where applicable;
  • leave retrieval without a model backward-compatible;
  • document the background create/poll/retrieve flow; and
  • include tests for completed and not-yet-completed background responses.

Related partial support: structured-output parsing is already available when resuming streams. Source: #126.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or requestgeneratorTouches generated SDK files

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions