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

Learn the sequence diagrams and architecture for building guardrails.

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.

Install

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 NIMs.

Tutorials

Next Steps#

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

Overview

Learn to write config.yml, Colang flows, and custom actions for guardrails.

NeMo Guardrails Library Configuration Overview
Run Rails

Use RailsConfig and LLMRails classes to load configurations and generate guarded responses.

Run the NeMo Guardrails Library with the Python APIs
Evaluate

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

Evaluate NeMo Guardrails Library Performance
Logging

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

Logging and Debugging Guardrails Generated Responses
Deploy

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

NeMo Guardrails Library Deployment Options
LangChain Frameworks

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

LangChain Frameworks