fix(json schema): support recursive BaseModels in Pydantic v1#1623
Merged
RobertCraigie merged 2 commits intoopenai:nextfrom Aug 8, 2024
Merged
fix(json schema): support recursive BaseModels in Pydantic v1#1623RobertCraigie merged 2 commits intoopenai:nextfrom
RobertCraigie merged 2 commits intoopenai:nextfrom
Conversation
Collaborator
|
Thanks! We actually did have a test case for this but it looks like we aren't running our Pydantic v1 tests in the CI for this repo, in the meantime, can you run this command and update and push the results? |
Contributor
Author
|
@RobertCraigie Done. |
Merged
stainless-bot
pushed a commit
that referenced
this pull request
Aug 8, 2024
megamanics
pushed a commit
to devops-testbed/openai-python
that referenced
this pull request
Aug 14, 2024
cgayapr
pushed a commit
to cgayapr/openai-python
that referenced
this pull request
Dec 14, 2024
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.
Pydantic 2 introduced
$defsand removeddefinitions. The latter is not handled during json parsing in "Structured Outputs" mode, soadditionalProperties: Falseis not set and the request fails with pydantic<2 with nested objects in the schema, as they are not getting the flag set.Added
definitionsin_ensure_strict_json_schemato correctly parse the schema with pydantic<2 and not fail on requests with nested objects.Steps to reproduce the error:
openai==1.40.1
pydantic==1.10.12