Bug
nemoguard_parse_prompt_safety and nemoguard_parse_response_safety in nemoguardrails/llm/output_parsers.py look for key \"Safety Categories\" when extracting violation categories from the NemoGuard model response, but the NemoGuard ContentSafety model actually returns key \"Violated Categories\" (as documented in each function's own docstring).
Impact
Every unsafe response from the NemoGuard model silently loses its violation categories. Callers receive [False] with an empty category list instead of [False, \"violence\", \"hate\"] (or whichever categories were flagged). This affects:
- Audit logging that records which policy categories were violated
- Downstream guardrail logic that acts differently based on violation type
- Compliance reporting
Reproduction
from nemoguardrails.llm.output_parsers import nemoguard_parse_prompt_safety
# NemoGuard model output (format documented in the function's own docstring)
response = '{"User Safety": "unsafe", "Violated Categories": "violence, hate_speech"}'
result = nemoguard_parse_prompt_safety(response)
print(result)
# Got: [False] ← categories silently dropped
# Expect: [False, 'violence', 'hate_speech']
Root Cause
nemoguardrails/llm/output_parsers.py lines 163 and 202:
# Both functions check for wrong key "Safety Categories"
if "Safety Categories" in parsed_json_result:
safety_categories = [...]
else:
safety_categories = [] # ← always falls here
The NemoGuard model returns "Violated Categories" (documented in the same functions' docstrings), not "Safety Categories".
Fix
Change "Safety Categories" → "Violated Categories" on lines 163 and 202 of output_parsers.py.
Bug
nemoguard_parse_prompt_safetyandnemoguard_parse_response_safetyinnemoguardrails/llm/output_parsers.pylook for key\"Safety Categories\"when extracting violation categories from the NemoGuard model response, but the NemoGuard ContentSafety model actually returns key\"Violated Categories\"(as documented in each function's own docstring).Impact
Every unsafe response from the NemoGuard model silently loses its violation categories. Callers receive
[False]with an empty category list instead of[False, \"violence\", \"hate\"](or whichever categories were flagged). This affects:Reproduction
Root Cause
nemoguardrails/llm/output_parsers.pylines 163 and 202:The NemoGuard model returns
"Violated Categories"(documented in the same functions' docstrings), not"Safety Categories".Fix
Change
"Safety Categories"→"Violated Categories"on lines 163 and 202 ofoutput_parsers.py.