Guardrails
NeMo Guardrails is an open-source toolkit for easily adding programmable guardrails to LLM-based conversational systems.
What is Guardrails?
NeMo Guardrails is an open-source toolkit for easily adding programmable guardrails to LLM-based conversational systems.
Overview of Guardrails
What it is
NVIDIA NeMo Guardrails is an open-source toolkit for adding programmable guardrails to LLM-based conversational systems. Guardrails (or "rails") control the output of a large language model, such as avoiding certain topics, following predefined dialog paths, using a specific language style, or extracting structured data.
Key features
- Building Trustworthy, Safe, and Secure LLM-based Applications: define rails to guide and safeguard conversations, prevent unwanted topics.
- Connecting models, chains, and other services securely: seamlessly and securely link an LLM to other services (tools).
- Controllable dialog: steer the LLM to follow pre-defined conversational paths, enforce standard operating procedures.
- Five types of guardrails: Input rails, Dialog rails, Retrieval rails, Execution rails, and Output rails.
- Protection against common LLM vulnerabilities such as jailbreaks and prompt injections.
- Supports multiple LLMs including OpenAI GPT-3.5, GPT-4, LLaMa-2, Falcon, Vicuna, or Mosaic.
Use cases
- Question Answering over a set of documents (Retrieval Augmented Generation): enforce fact-checking and output moderation.
- Domain-specific Assistants (chatbots): ensure the assistant stays on topic and follows designed conversational flows.
- LLM Endpoints: add guardrails to custom LLMs for safer customer interaction.
- LangChain Chains (optional): add a guardrails layer around LangChain chains.
Getting started
Install using pip:
pip install nemoguardrails
Example usage with Python API:
from nemoguardrails import LLMRails, RailsConfig
config = RailsConfig.from_path("PATH/TO/CONFIG")
rails = LLMRails(config)
completion = rails.generate(
messages=[{"role": "user", "content": "Hello world!"}]
)
License and pricing
The license is not stated (NOASSERTION). The project is open source.
Based on the project's public README and repository metadata.