Deploy NemoGuard NIMs
NemoGuard NIMs are specialized models built for specific use cases supported by the Guardrails service. Learn how to deploy NemoGuard NIMs in your environment and apply them to a guardrail configuration.
Prerequisites
Before you begin:
- You have access to a running NeMo Platform.
NMP_BASE_URLis set to the NeMo Platform base URL.- Your infrastructure has 1 GPU available per NIM deployment.
Step 1: Configure the Client
Instantiate the NeMoPlatform SDK.
Step 2: Deploy the NIMs
Use the Platform’s Inference Gateway service to deploy each NIM. This process creates a DeploymentConfig that specifies the NIM image, and a Deployment that runs it.
Enabling KV cache reuse on the LLM-based NIMs could improve inference speed. These examples enable this feature by setting NIM_ENABLE_KV_CACHE_REUSE=1 via the nim_deployment.additional_envs option.
Deploy a Content-Safety NIM
CLI
Python SDK
Deploy a Topic-Control NIM
CLI
Python SDK
Deploy a Jailbreak-Detection NIM
CLI
Python SDK
Step 3: Verify the Model Entity Names
After the content safety and topic control NIMs are deployed, the Inference Gateway discovers the models served by each NIM and registers them as Model Entities in your workspace. Use these entities in guardrail configurations with the workspace/name format.
List all Model Entities in your workspace to find the names:
The NemoGuard NIMs register Model Entities with the following default names:
The jailbreak detection NIM exposes a /v1/classify endpoint rather than an OpenAI-compatible chat completions endpoint, so it does not register a Model Entity. Reference the NIM by setting nim_base_url to its Inference Gateway URL — see Step 4 below.
Step 4: Use the NIMs in Guardrail Configurations
Content Safety and Topic Control
Reference the Model Entities in your guardrail configuration using the workspace/name format. For a complete example combining content safety and topic control rails, see Executing Input and Output Rails in Parallel.
Jailbreak Detection
Configure the jailbreak detection NIM using the rails.config.jailbreak_detection field. Set nim_base_url to the Inference Gateway provider route exposed by the deployment you created in Step 2. The URL follows the pattern /apis/inference-gateway/v2/workspaces/{workspace}/provider/{deployment_name}/-/v1, where deployment_name matches the deployment name from Step 2.
Cleanup
CLI
Python SDK
Next Steps
- Improving Content Safety with NemoGuard NIMs - Full content safety tutorial using
build.nvidia.com-hosted NIMs - Executing Input and Output Rails in Parallel - Combine multiple rails for comprehensive safety coverage