---
title: Content Safety (NeMo Guardrail)
type: guardrail
provider: nvidia
category: safety
source: 'https://github.com/NVIDIA-NeMo/Guardrails'
license: Apache-2.0
tags:
  - guardrail
  - nemo
  - rails
  - colang
dateAdded: '2025-11-06'
featured: false
origin: official
language: en
description: >-
  flow content safety check input $model $response = await
  ContentSafetyCheckInputAction(model_name=$model) global $allowed $allowed =
  $response["allowe
---

```coffee
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
```
