NVIDIA NeMo Guardrails Library Developer Guide#

PyPI GitHub

The NeMo Guardrails library is an open-source Python package for adding programmable guardrails to LLM-based applications. It intercepts inputs and outputs, applies configurable safety checks, and blocks or modifies content based on defined policies.

About the NeMo Guardrails Library#

Learn about the library and its capabilities in the following sections.

Overview

Add programmable guardrails to LLM applications with this open-source Python library.

Overview of NVIDIA NeMo Guardrails Library
Guardrail Types

Apply input, retrieval, dialog, execution, and output rails to protect LLM applications.

Guardrail Types
How It Works

High level explanation of how Guardrails works.

How It Works
Supported LLMs

Connect to NVIDIA NIM, OpenAI, Azure, Anthropic, HuggingFace, and LangChain providers.

Supported LLMs

Get Started#

Follow these steps to start using the NeMo Guardrails library.

Installation

Install NeMo Guardrails with pip, configure your environment, and verify the installation.

Install the NeMo Guardrails Library
Tutorials

Follow hands-on tutorials to deploy Nemotron Content Safety, Nemotron Topic Control, and Nemotron Jailbreak Detect

Tutorials

Next Steps#

Once you’ve completed the get-started tutorials, explore the following areas to deepen your understanding.

About Configuring Guardrails

Configure YAML files, Colang flows, custom actions, and other components to control LLM behavior.

About Configuring Guardrails
About Running Guardrailed Inference

Run guardrailed inference using the Python API or Guardrails API server.

About Running Guardrailed Inference Using the NeMo Guardrails Library Tools
Evaluate

Measure accuracy and performance of dialog, fact-checking, moderation, and hallucination rails.

evaluation/README
Logging

Debug guardrails with verbose mode, explain method, and generation log options.

Logging and Debugging Guardrails Generated Responses
Deployment Options

Deploy guardrails using the local API server, Docker containers, or production microservices.

About Deployment Options
LangChain Frameworks

Integrate NeMo Guardrails with LangChain chains, runnables, and LangGraph workflows.

LangChain Frameworks