Skip to main content

Commands

The nemoguardrails eval command provides tools for evaluating guardrail configurations.

nemoguardrails eval run

Run interactions for an evaluation.

Options

path
default:"config"
Path to a directory containing eval configuration files. Short flag: -e
path
required
Path to a directory containing guardrail configuration files. Short flag: -g
path
Output directory for the results. Defaults to a folder in the current directory with the same name as the guardrail configuration. Short flag: -o
string
default:"json"
The format for output files: json or yaml.
integer
default:"1"
The degree of parallelism to use when running the checks.

Examples

Basic Evaluation
With Custom Output
Parallel Execution
YAML Output

Evaluation Config Structure

Create an evaluation config directory:
config.yml:
test_cases.yml:
policies.yml:

nemoguardrails eval check-compliance

Check policy compliance using an LLM judge.

Options

string
required
The name of the model to use as a judge. Must be configured in the evaluation config’s models key.
path
default:"config"
Path to eval configuration files. Short flag: -e
array
One or more output directories from evaluation runs. Defaults to folders in the current directory (except config). Short flag: -o
array
IDs of policies to check. If not specified, all policies will be checked. Short flag: -p
boolean
default:"false"
Enable verbose output. Short flag: -v
boolean
default:"false"
Force compliance check even if results exist. Short flag: -f
boolean
default:"false"
Disable LLM caching (enabled by default).
boolean
default:"false"
Reset compliance check data.
integer
default:"1"
Degree of parallelism for running checks.

Examples

Basic Compliance Check
Check Specific Policies
Verbose Mode
Force Re-check
Parallel Checking

nemoguardrails eval ui

Launch the evaluation UI to view results.

Options

path
default:"config"
Path to eval configuration directory.
array
One or more output directories from evaluation runs.

Examples

Launch UI
The UI will open in your browser at http://localhost:8501.

nemoguardrails eval rail

Run specific rail evaluation tasks.
See the rail evaluation documentation for more details.

Complete Evaluation Workflow

1. Setup Evaluation Config

Create your config files (see structure above).

2. Run Evaluation

Output:

3. Check Compliance

Output:

4. View Results in UI

Output Format

Results are saved in the output directory:
interactions.json:
compliance.json:

Best Practices

  1. Start Small: Begin with a small set of test cases and expand
  2. Use Parallelism: Use --parallel to speed up large evaluations
  3. Cache LLM Calls: Keep caching enabled to save API costs
  4. Version Control: Keep eval configs in version control
  5. Regular Testing: Run evaluations as part of CI/CD
  6. Review Failures: Use UI to investigate non-compliant cases

Troubleshooting

No Test Cases Found

Ensure your test_cases.yml is in the eval config directory and properly formatted.

LLM Judge Errors

Make sure the judge model is configured in config.yml:

Out of Memory

Reduce parallelism:

Cache Issues

Reset the cache: