Skip to content

feat(api): Support input guardrail checks when role: 'system'#47

Merged
christinaexyou merged 1 commit into
trustyai-explainability:developfrom
christinaexyou:support-role-system
May 1, 2026
Merged

feat(api): Support input guardrail checks when role: 'system'#47
christinaexyou merged 1 commit into
trustyai-explainability:developfrom
christinaexyou:support-role-system

Conversation

@christinaexyou
Copy link
Copy Markdown

Description

This PR adds support for input guardrail checks for system messages. Currently, system is not included as a supported role for guardrail checks, however, this could be a glaring opportunity for prompt injection attacks.

Related Issue(s)

Checklist

  • I've read the CONTRIBUTING guidelines.
  • I've updated the documentation if applicable.
  • I've added tests if applicable.
  • @mentions of the person or team responsible for reviewing proposed changes.

@christinaexyou
Copy link
Copy Markdown
Author

cc: @nirrozenbaum @liavweiss

)

result = response.json()
assert result["status"] == "success"

result = response.json()
assert result["status"] == "success"
assert len(result["messages"]) == 1
result = response.json()
assert result["status"] == "success"
assert len(result["messages"]) == 1
assert result["messages"][0]["role"] == "system"
assert result["status"] == "success"
assert len(result["messages"]) == 1
assert result["messages"][0]["role"] == "system"
assert result["messages"][0]["index"] == 0
@codecov-commenter
Copy link
Copy Markdown

⚠️ Please install the 'codecov app svg image' to ensure uploads and comments are reliably processed by Codecov.

Codecov Report

❌ Patch coverage is 83.33333% with 1 line in your changes missing coverage. Please review.
⚠️ Please upload report for BASE (develop@03cd8ba). Learn more about missing BASE report.

Files with missing lines Patch % Lines
nemoguardrails/server/api.py 83.33% 1 Missing ⚠️
❗ Your organization needs to install the Codecov GitHub app to enable full functionality.
Additional details and impacted files
@@            Coverage Diff             @@
##             develop      #47   +/-   ##
==========================================
  Coverage           ?   76.88%           
==========================================
  Files              ?      200           
  Lines              ?    20416           
  Branches           ?        0           
==========================================
  Hits               ?    15697           
  Misses             ?     4719           
  Partials           ?        0           
Flag Coverage Δ
python 76.88% <83.33%> (?)

Flags with carried forward coverage won't be shown. Click here to find out more.

Files with missing lines Coverage Δ
nemoguardrails/server/api.py 75.04% <83.33%> (ø)
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

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.

Nemo guardrails: support system role in /v1/guardrail/checks endpoint

4 participants