Skip to content

Latest commit

 

History

History
163 lines (112 loc) · 4.28 KB

File metadata and controls

163 lines (112 loc) · 4.28 KB
title
page nav
Install the NeMo Guardrails Library
Installation
description Install NeMo Guardrails with pip, configure your environment, and verify the installation.
topics
Get Started
AI Safety
tags
Installation
Python
pip
Docker
Setup
content
type difficulty audience
get_started
technical_beginner
engineer
AI Engineer

Install the NeMo Guardrails Library

Follow these steps to install the NeMo Guardrails library.

Prerequisites

Verify your system meets the following requirements before installation.

Requirement Details
Operating System Windows, Linux, MacOS
Python 3.10, 3.11, 3.12, or 3.13
Hardware 1 CPU with 4GB RAM. The NeMo Guardrails library runs on CPU. External models may require GPUs, which may be deployed separately to the library

Quick Start

Use the following steps to install the NeMo Guardrails library in a virtual environment.

  1. Create and activate a virtual environment:

    ::::{tab-set}

    :::{tab-item} Linux/macOS

    python3 -m venv .venv
    source .venv/bin/activate

    :::

    :::{tab-item} Windows (Git Bash)

    python -m venv .venv
    source .venv/Scripts/activate

    :::

    ::::

  2. Install the NeMo Guardrails library with support for NVIDIA-hosted models. Set NVIDIA_API_KEY to your personal API key generated on build.nvidia.com.

    pip install "nemoguardrails[nvidia]"
  3. Set up an environment variable for your NVIDIA API key.

    export NVIDIA_API_KEY="your-nvidia-api-key"

    This is required to access NVIDIA-hosted models on build.nvidia.com. The tutorials and example configurations (examples/configs) in this library include configurations that use NVIDIA-hosted models.

Alternative Installation Methods

Install the NeMo Guardrails library from source using pip or Poetry. Choose this method if you want to contribute to the library or use the latest development version.

::::{tab-set}

:::{tab-item} pip

git clone https://github.com/NVIDIA-NeMo/Guardrails.git nemoguardrails
cd nemoguardrails
python -m venv .venv
source .venv/bin/activate
pip install -e .

:::

:::{tab-item} Poetry

git clone https://github.com/NVIDIA-NeMo/Guardrails.git nemoguardrails
cd nemoguardrails
python -m venv .venv
source .venv/bin/activate
poetry install --extras "nvidia"

When using Poetry, prefix CLI commands with poetry run:

poetry run nemoguardrails server --config examples/configs

:::

::::

Extra Dependencies

You can install the NeMo Guardrails library with optional extra packages to add useful functionalities. The table below shows a comprehensive list.

Extra Description
nvidia NVIDIA-hosted model integration through build.nvidia.com
openai OpenAI-hosted model integration
sdd Sensitive data detection using Presidio
eval Evaluation tools for testing guardrails
tracing OpenTelemetry tracing support
gcp Google Cloud Platform language services
jailbreak YARA-based jailbreak detection heuristics
multilingual Language detection for multilingual content
all All optional packages

Some features such as AlignScore have additional requirements. See the feature documentation for details.

Docker

You can run the NeMo Guardrails library in a Docker container. For containerized deployment, see NeMo Guardrails with Docker.

Troubleshooting Installation Issues

Use the following information to resolve common installation issues.

C++ Runtime Errors

The library uses annoy, which requires a C++ compiler. If installation fails:

::::{tab-set}

:::{tab-item} Linux/macOS

apt-get install gcc g++ python3-dev

:::

:::{tab-item} Windows

Install Microsoft C++ Build Tools (version 14.0 or greater).

:::

::::