NeMo Guardrails
NVIDIA NeMo Guardrails is an open-source toolkit for adding programmable guardrails to LLM-based conversational applications. It helps developers control LLM output by defining rules for topics, dialog flow, style, and more, ensuring safety and security. It is for developers building LLM-powered chatbots, RAG systems, or any conversational AI.
✨ Key features
- Programmable guardrails for input, dialog, retrieval, execution, and output.
- Supports multiple LLMs including OpenAI GPT-3.5, GPT-4, LLaMa-2, Falcon.
- Includes built-in guardrails for jailbreak detection, fact-checking, hallucination detection.
- Colang modeling language for defining conversational flows and rails.
- Async-first Python API with sync and async methods.
- CLI for chat, server, and evaluation; optional LangChain integration.
🎯 Use cases
- Add safety rails to a customer support chatbot to keep it on topic.
- Enforce fact-checking and output moderation in a RAG question-answering system.
- Protect an LLM endpoint from jailbreaks and prompt injections.
- Guide a domain-specific assistant through predefined conversational flows.
- Wrap LangChain chains with a guardrails layer for safer interactions.
📦 Installation
🧰 Requirements: Python 3.10, 3.11, 3.12, or 3.13. No API keys required for installation, but LLM access (e.g., OpenAI) is needed for actual use.
> pip install nemoguardrails
🚀 Usage
from nemoguardrails import LLMRails, RailsConfig
# Load a guardrails configuration from the specified path.
config = RailsConfig.from_path("PATH/TO/CONFIG")
rails = LLMRails(config)
completion = rails.generate(
messages=[{"role": "user", "content": "Hello world!"}]
)
⚠️ Good to know
The built-in guardrails may not be suitable for all production use cases; developers should ensure they meet industry requirements and address potential misuse.
❓ FAQ
What Python versions are supported?
Python 3.10, 3.11, 3.12, or 3.13 are supported.
How do I enable LangChain integration?
Set the environment variable NEMOGUARDRAILS_LLM_FRAMEWORK=langchain or call set_default_framework("langchain").
Can I use NeMo Guardrails with LLMs other than OpenAI?
Yes, it supports multiple LLMs like LLaMa-2, Falcon, Vicuna, and Mosaic, among others.
What is Colang?
Colang is a modeling language for defining dialogue flows and guardrails, with a Python-like syntax. Both Colang 1.0 and 2.0 are supported.
📊 Repository
🤖 Overview, features, install steps and FAQ were generated from the project's README on Sep 4, 2026. Always check the original source before running commands.