Skip to content

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

@LukeKan

Description

@LukeKan

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions