OpenPrompts
← Back to catalog
NVIDIAGuardrailsSafety & Moderation

Content Safety (NeMo Guardrail)

flow content safety check input $model $response = await ContentSafetyCheckInputAction(model_name=$model) global $allowed $allowed = $response["allowe

flow content safety check input $model
  $response = await ContentSafetyCheckInputAction(model_name=$model)

  global $allowed
  $allowed = $response["allowed"]
  global $policy_violations
  $policy_violations = $response["policy_violations"]

  if not $allowed
    if $system.config.enable_rails_exceptions
      send ContentSafetyCheckInputException(message="Input not allowed. The input was blocked by the 'content safety check input $model='{$model}'' flow.")
    else
      if $system.config.rails.config.content_safety.multilingual.enabled
        $lang_result = await DetectLanguageAction()
        $refusal_message = $lang_result["refusal_message"]
        bot $refusal_message
      else
        bot refuse to respond
    abort

flow content safety check output $model
  $response = await ContentSafetyCheckOutputAction(model_name=$model)
  global $allowed
  $allowed = $response["allowed"]
  global $policy_violations
  $policy_violations = $response["policy_violations"]

  if not $allowed
    if $system.config.enable_rails_exceptions
      send ContentSafetyCheckOuputException(message="Output not allowed. The output was blocked by the 'content safety check output $model='{$model}'' flow.")
    else
      if $system.config.rails.config.content_safety.multilingual.enabled
        $lang_result = await DetectLanguageAction()
        $refusal_message = $lang_result["refusal_message"]
        bot $refusal_message
      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
2025-11-06
#guardrail#nemo#rails#colang