---
title: Gliner (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-21'
featured: false
origin: official
language: en
description: >-
  GLiNER PII DETECTION RAILS INPUT RAILS flow gliner detect pii on input
  """Check if the user input has PII using GLiNER.""" $has_pii = await
  GlinerDete
---

```coffee
#### GLiNER PII DETECTION RAILS ####

# INPUT RAILS

flow gliner detect pii on input
  """Check if the user input has PII using GLiNER."""
  $has_pii = await GlinerDetectPiiAction(source="input", text=$user_message)

  if $has_pii
    bot refuse to respond
    abort


# OUTPUT RAILS

flow gliner detect pii on output
  """Check if the bot output has PII using GLiNER."""
  $has_pii = await GlinerDetectPiiAction(source="output", text=$bot_message)

  if $has_pii
    bot refuse to respond
    abort


# RETRIEVAL RAILS

flow gliner detect pii on retrieval
  """Check if the relevant chunks from the knowledge base have any PII using GLiNER."""
  $has_pii = await GlinerDetectPiiAction(source="retrieval", text=$relevant_chunks)

  if $has_pii
    bot refuse to respond
    abort


#######################################################


#### GLiNER PII MASKING RAILS ####

# INPUT RAILS

flow gliner mask pii on input
  """Mask any detected PII in the user input using GLiNER."""
  $masked_input = await GlinerMaskPiiAction(source="input", text=$user_message)

  global $user_message
  $user_message = $masked_input


# OUTPUT RAILS

flow gliner mask pii on output
  """Mask any detected PII in the bot output using GLiNER."""
  $bot_message = await GlinerMaskPiiAction(source="output", text=$bot_message)


# RETRIEVAL RAILS

flow gliner mask pii on retrieval
  """Mask any detected PII in the relevant chunks from the knowledge base using GLiNER."""
  $relevant_chunks = await GlinerMaskPiiAction(source="retrieval", text=$relevant_chunks)
```
