Structured outputs guarantee the model's response conforms to a specific JSON schema. Combined with vision, you can extract structured data from PDFs and documents.
Pydantic with Responses API
Structured output schema limits: max 5,000 properties, 10 nesting levels, 1,000 enum values, and 120,000 characters total.
One pipeline replaces three
The pre-input_file pattern was: pdfplumber → text extraction → chunking → embedding → vector search → prompt assembly → JSON parsing. input_file + response_format collapses that into one API call. Pass the PDF; get back a typed Pydantic instance.
Caveat: input_file processes the whole PDF in one pass, so very long documents (100+ pages) hit context-window limits. For those, you still want chunking. For invoices, reports, contracts, single-page forms — input_file is the canonical shape.