fix: default response_format json_schema strict to false when absent#6113
Open
yashanil98 wants to merge 2 commits into
Open
fix: default response_format json_schema strict to false when absent#6113yashanil98 wants to merge 2 commits into
yashanil98 wants to merge 2 commits into
Conversation
The strict field was stripped during serialization when None, causing providers that require it (e.g. Anthropic's OpenAI-compatible endpoint) to reject the request with a 400. An omitted value is equivalent to false for OpenAI, so default it explicitly. Fixes ogx-ai#6020 Signed-off-by: Yash Anil <yashanil98@gmail.com>
mattf
requested changes
Jun 15, 2026
mattf
left a comment
Collaborator
There was a problem hiding this comment.
since this is an issue w/ anthropic's openai-compat endpoint, the fix needs to live in the anthropic adapter
Move the strict default out of the shared model and into the Anthropic adapter, since the missing-field 400 is specific to Anthropic's OpenAI-compatible endpoint. Other providers are unaffected. Fixes ogx-ai#6020
Author
|
Moved the fix into the Anthropic adapter's |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #6020
The
strictfield was stripped during serialization whenNone, causing providers that require it (Anthropic's OpenAI-compatible endpoint) to reject with a 400. An omitted value is equivalent tofalsefor OpenAI, so it's now defaulted explicitly at the Pydantic layer.Test:
uv run pytest tests/unit/api/test_response_format_models.py(4 passed)