Skip to content
This repository was archived by the owner on Feb 11, 2026. It is now read-only.

Support OpenAI's structured outputs mode #703

@transitive-bullshit

Description

@transitive-bullshit
  • currently only JSON mode is supported
  • there are quite a few schema constraints when using structured outputs, and many of the AI functions in the stdlib use features like .optional(), .default(), etc which are not supported
  • zod-to-json-schema both openai's vendored version and the official package with openai mode don't support structured outputs
  • see the ai sdk's notes on structured outputs. they explicitly make them opt-in and warn about schema compatibility
  • this will involve changes to the underlying zod-to-json-schema IF the user is using structured outputs, so we'll need to expose a different version of the AI functions in this case

see #702 for a repro

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions