Skip to content

feat: add /v1/guardrail/checks to the server#25

Merged
m-misiura merged 1 commit into
trustyai-explainability:developfrom
m-misiura:guardrails-checks
Feb 18, 2026
Merged

feat: add /v1/guardrail/checks to the server#25
m-misiura merged 1 commit into
trustyai-explainability:developfrom
m-misiura:guardrails-checks

Conversation

@m-misiura
Copy link
Copy Markdown
Collaborator

@m-misiura m-misiura commented Feb 17, 2026

Description

Nvidia docs describe a very useful /v1/guardrail/checks endpoint that can be used to perform standalone detections, e.g see this doc. This endpoint seems available within Nim Micorservices, but not in the open source NeMo guardrails server.

This PR adds /v1/guardrail/checks endpoint that validates messages using the configured rails. It supports role-based routing:

  • user messages: evaluated by input rails
  • assistant messages: evaluated by output rails
  • tool messages: evaluated by tool_input rails
  • assistant with tool_calls: evaluated by tool_output rails

The main changes are:

  • added /v1/guardrail/checks endpoint in api.py
  • added GuardrailCheckResponse schema in schemas/openai.py
  • added test coverage in test_guardrail_checks_api.py
  • update llmrails.py to support standalone tool message validation"

Test Plan

  1. ran uni tests
pytest tests/test_guardrail_checks_api.py
================= test session starts ==================
platform darwin -- Python 3.12.11, pytest-8.4.1, pluggy-1.6.0
rootdir: /Users/mmisiura/repos/forked/NeMo-Guardrails
configfile: pytest.ini
plugins: anyio-4.9.0, asyncio-1.3.0, langsmith-0.4.8
asyncio: mode=Mode.STRICT, debug=False, asyncio_default_fixture_loop_scope=function, asyncio_default_test_loop_scope=function
collected 20 items                                     

tests/test_guardrail_checks_api.py ............. [ 65%]
.......                                          [100%]

================== 20 passed in 6.10s ==================
  1. built an image: quay.io/rh-ee-mmisiura/nemo-guardrails:guardrails-checks-pr
podman build --platform linux/amd64 -f Dockerfile.server -t quay.io/rh-ee-mmisiura/nemo-guardrails:guardrails-checks-pr .
  1. used the above image and successfully ran the following demo 1 and demo 2

@m-misiura m-misiura merged commit 86c38e4 into trustyai-explainability:develop Feb 18, 2026
1 of 8 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants