Skip to content

Update Model JSON Validation to Pydantic V2 Style #1515

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

akaashdash
Copy link

Currently when parsing JSON responses from LLMs into the Pydantic BaseModel, parse_raw is being used. This is deprecated behavior as of Pydantic v2 and is slated to be removed in the future. The new behavior is to use model_validate_json which behaves the same way.

No warnings are observed as all migration warnings are suppressed.

It is best to migrate now before this causes issues. Outlines already depends on Pydantic v2 so there is no need to support any behavior from Pydantic v1.

@RobinPicard
Copy link
Contributor

Hi @akaashdash! Thanks for opening a PR, good catch. Unfortunately we are about to merge the v1.0 branch into main, so I would rather not merge this PR as it would lead to merge conflicts down the road. Instead I've applied the change you've proposed to v1.0 in a different PR #1539

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.

2 participants