OpenPrompts
← Back to catalog
NVIDIAGuardrailsSafety & Moderation

Llama Guard (NeMo Guardrail)

flow llama guard check input $llama_guard_response = await LlamaGuardCheckInputAction global $allowed $allowed = $llama_guard_response["allowed"] Poli

flow llama guard check input
  $llama_guard_response = await LlamaGuardCheckInputAction
  global $allowed
  $allowed = $llama_guard_response["allowed"]
  # Policy violations are currently unused, but can be used to better phrase the bot output
  global $llama_guard_policy_violations
  $llama_guard_policy_violations = $llama_guard_response["policy_violations"]

  if not $allowed
    if $system.config.enable_rails_exceptions
      send LlamaGuardInputRailException(message="Input not allowed. The input was blocked by the 'llama guard check input' flow. Please ensure your input meets the required criteria.")
    else
      bot refuse to respond
    abort

flow llama guard check output
  $llama_guard_response = await LlamaGuardCheckOutputAction
  global $allowed
  $allowed = $llama_guard_response["allowed"]
  global $llama_guard_policy_violations
  $llama_guard_policy_violations = $llama_guard_response["policy_violations"]

  if not $allowed
    if $system.config.enable_rails_exceptions
      send LlamaGuardOutputRailException(message="Output not allowed. The output was blocked by the 'llama guard check output' flow. Please ensure your output meets the required criteria.")
    else
      bot refuse to respond
    abort
Automated safety scan: no suspicious patterns found.

Heuristic text scan aligned to the OWASP Agentic Skills Top 10. How we scan

Provider
NVIDIA
Origin
Official
Type
Guardrails
License
Apache-2.0
Language
English
Added
2026-05-04
#guardrail#nemo#rails#colang