Skip to content

Transform Pydantic output config formats - #1821

Open
uuzzrm wants to merge 2 commits into
anthropics:mainfrom
uuzzrm:codex/fix-output-config-schema-transform
Open

Transform Pydantic output config formats#1821
uuzzrm wants to merge 2 commits into
anthropics:mainfrom
uuzzrm:codex/fix-output-config-schema-transform

Conversation

@uuzzrm

@uuzzrm uuzzrm commented Aug 10, 2026

Copy link
Copy Markdown

Fixes #1819.

output_config.format now accepts the same Pydantic model input that the deprecated output_format parameter accepted, and sends model-generated schemas through the existing transform_schema path before request serialization. Raw JSON schema dictionaries remain unchanged and continue to be sent as provided.

The conversion is applied consistently to the stable and beta Messages APIs for synchronous and asynchronous create, parse, stream, and count_tokens calls. The public OutputConfigParam types now include Pydantic model classes.

The change is intentionally scoped to the Messages API surfaces covered by this issue; Message Batches and refusal fallbacks are unchanged.

Tests

  • uv run pytest tests/lib/_parse/test_transform.py tests/api_resources/test_output_config_format_conversion.py -q — 32 passed, 1 skipped
  • Ruff checks and format checks passed for all changed files
  • git diff --check passed

The repository test wrapper could not start its mock server on this machine because Node is missing libllhttp.9.3.dylib; the targeted tests ran without that wrapper.

AI assistance was used for implementation and validation. The final diff was checked against the issue and the targeted test results before this update.

@uuzzrm
uuzzrm requested a review from a team as a code owner August 10, 2026 16:01
@uuzzrm uuzzrm changed the title fix(messages): transform Pydantic output config formats Transform Pydantic output config formats Aug 11, 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.

output_config.format cannot take the pydantic model that output_format deprecates, and the dict workaround silently skips transform_schema

1 participant