Skip to content
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

feature: Update Pydantic to v2.10.5 and remove Deprecated validators #929

Open
1 task done
LukeKan opened this issue Jan 13, 2025 · 1 comment
Open
1 task done
Labels
enhancement New feature or request good first issue Good for newcomers status: help wanted Issues where external contributions are encouraged.

Comments

@LukeKan
Copy link

LukeKan commented Jan 13, 2025

Did you check the docs?

  • I have read all the NeMo-Guardrails docs

Is your feature request related to a problem? Please describe.

I suggest to keep up with the latest Pydantic versions since the model_validators that are used inside the library (e.g. nemoguardrails /rails/llm/config.py:975) are deprecated.

Here is an example of the warnings when using the latest Pydantic version (v2.10.5):
nemoguardrails/rails/llm/config.py:975: PydanticDeprecatedSince20: Pydantic V1 style @root_validator validators are deprecated. You should migrate to Pydantic V2 style @model_validator validators, see the migration guide for more details. Deprecated in Pydantic V2.0 to be removed in V3.0. See Pydantic V2 Migration Guide at https://errors.pydantic.dev/2.9/migration/ @root_validator(pre=True, allow_reuse=True)

Describe the solution you'd like

Update the @root_validator to Pydantic V2 style @model_validator validators.

Describe alternatives you've considered

No relevant alternatives, just update the library.

Additional context

No response

@LukeKan LukeKan added enhancement New feature or request status: needs triage New issues that have not yet been reviewed or categorized. labels Jan 13, 2025
@Pouyanpi Pouyanpi added good first issue Good for newcomers status: help wanted Issues where external contributions are encouraged. and removed status: needs triage New issues that have not yet been reviewed or categorized. labels Jan 20, 2025
@Pouyanpi
Copy link
Collaborator

Thank you @LukeKan 👍🏻 Indeed we should upgrade to v2. I think it was not done completely due to backward compatibility reasons but we should be able to do it now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request good first issue Good for newcomers status: help wanted Issues where external contributions are encouraged.
Projects
None yet
Development

No branches or pull requests

2 participants