Skip to content

Add OpenAI structured output schema support#468

Merged
aksg87 merged 1 commit into
mainfrom
aksg87/openai-structured-output-schema
May 15, 2026
Merged

Add OpenAI structured output schema support#468
aksg87 merged 1 commit into
mainfrom
aksg87/openai-structured-output-schema

Conversation

@aksg87
Copy link
Copy Markdown
Collaborator

@aksg87 aksg87 commented May 11, 2026

Fixes #59

Summary

  • Add an OpenAI provider schema that maps examples to OpenAI Chat Completions
    response_format={"type": "json_schema", ...} payloads.
  • Wire OpenAI schema constraints through the provider/factory path while keeping
    runtime response_format overrides explicit and warned.
  • Enforce JSON-only structured outputs for OpenAI, with clear errors for YAML.
  • Add unit and live coverage for OpenAI schema generation, schema application,
    runtime overrides, schema clearing, YAML rejection, and strict structured
    output behavior.

Testing

  • tox -e format
  • tox -e lint-src
  • tox -e lint-tests
  • pytest tests/ -ra -m 'not live_api'
  • pytest tests/test_kwargs_passthrough.py tests/schema_test.py tests/factory_schema_test.py tests/provider_schema_test.py -q
  • tox -e live-api

@aksg87 aksg87 force-pushed the aksg87/openai-structured-output-schema branch from 2b67490 to 2c1c598 Compare May 15, 2026 07:02
@aksg87 aksg87 marked this pull request as ready for review May 15, 2026 07:03
@aksg87 aksg87 self-assigned this May 15, 2026
@aksg87 aksg87 merged commit d610889 into main May 15, 2026
15 checks passed
@aksg87 aksg87 deleted the aksg87/openai-structured-output-schema branch May 15, 2026 07:14
@aksg87 aksg87 mentioned this pull request May 15, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Schema constraints for OpenAI not supported

1 participant