About Guardrails#
Learn how to add checks and content moderation to a model by making requests to the NVIDIA NeMo Guardrails microservice.
How NeMo Guardrails Interacts with LLMs#
NVIDIA NeMo Guardrails sits between your application and the LLM:
A single NeMo Guardrails microservice instance can serve multiple applications and work with multiple guardrail configurations and LLMs. To use the NeMo Guardrails microservice, you must configure your application to use the NeMo Guardrails microservice endpoint, rather than the original LLM endpoint.
Guardrails Workflow#
Before you get started:
Know the fine-tuned or foundation LLM model that you want to add guardrails to.
Know the roles, such as
user
,assistant
, andsystem
that the model uses.Know the request options, such as
max_tokens
,stream
, andtemperature
for the model.
Develop the guardrails:
Create a guardrails configuration that defines the safety checks for input and output.
Check the guardrails.
Run inference with the guardrails.
Task Guides#
The following guides provide detailed information on how to perform common guardrail operations.
Manage guardrail configurations.
Check content with input and output guardrails.
Run inference and apply safety checks.
Tutorials#
Follow these tutorials to learn how to accomplish common guardrail tasks.
Use NemoGuard NIM for content safety and topic control
Run the NeMo Guardrails container locally
Build an image with custom dependencies
Add custom HTTP headers to requests
Use multiple NIM microservices for LLMs
Send requests to custom LLM providers
Limitations and Restrictions#
The following list identifies the key differences between the NeMo Guardrails microservice and the NeMo Guardrails open-source toolkit.
Certain toolkit server features are unavailable in the microservice, such as threads and the chat user interface.
The microservice supports Colang 1.0 guardrail configurations only.
The microservice supports NVIDIA NIM for LLMs and LLMs with an OpenAI compatible API as LLM providers.
The API is OpenAI compatible, with the addition of the
guardrails
field in the request body and theguardrails_data
field in the response body.In the microservice, the LLM provider is determined by the
model
field that is specified in the HTTP request. In the toolkit, the LLM provider is determined by the guardrail configuration.The microservice supports a default guardrail configuration that is used when no guardrail configuration is specified as part of an HTTP request.