NVIDIA-NeMo / NVIDIA-NeMo/Guardrails

bug: Fix Pydantic compatibility for OpenAI chat message validator

Open
#2,292 1 comment 0 reactions 1 assignee View on GitHub

@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

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.