Update Model JSON Validation to Pydantic V2 Style
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.
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