NVIDIA-NeMo / NVIDIA-NeMo/Guardrails
bug: Fix Pydantic compatibility for OpenAI chat message validator
@tanushriya910 is already working on this.
Since Aug 17, 2026.
- Dominant language
- Python
- Stars
- 7.2k
- Forks
- 842
- Avg merge
- 3d 1h
- Merged PRs (30d)
- 25
Description
Summary
nemoguardrails/server/schemas/openai.py uses BeforeValidator(..., json_schema_input_type=...) for OpenAIChatMessage.
The project declares pydantic>=2.5,<3.0. Pydantic 2.5.0 does not support the json_schema_input_type argument on BeforeValidator. Importing the server schema can therefore raise TypeError for a supported dependency version.
Required change
Keep the OpenAI chat-message validator compatible with the declared Pydantic range. Either remove or replace the unsupported json_schema_input_type argument, or raise the minimum supported Pydantic version and regenerate uv.lock with the project tooling.
Affected area
nemoguardrails/server/schemas/openai.py- Pydantic dependency declaration and lockfile, if the minimum version changes
Acceptance criteria
- The server schema imports successfully with every supported Pydantic version.
- The OpenAI chat-message validation still requires a string
role. - JSON Schema generation remains correct for the request model.
- Tests cover the selected compatibility approach.
Backlinks
- Pull request: https://github.com/NVIDIA-NeMo/Guardrails/pull/2266
- Review comment: https://github.com/NVIDIA-NeMo/Guardrails/pull/2266#discussion_r3795104541
- Requested by: @Pouyanpi
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Assessment
This issue has not been assessed yet.