> For clean Markdown of any page, append .md to the page URL.
> For a complete documentation index, see https://docs.nvidia.com/nemo/guardrails/llms.txt.
> For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://docs.nvidia.com/nemo/guardrails/_mcp/server.

# nemoguardrails.eval.eval

## Module Contents

### Functions

| Name                                                                                     | Description                                                         |
| ---------------------------------------------------------------------------------------- | ------------------------------------------------------------------- |
| [`_extract_interaction_log`](#nemoguardrails-eval-eval-_extract_interaction_log)         | Extracts an `InteractionLog` object from an `GenerationLog` object. |
| [`_extract_interaction_outputs`](#nemoguardrails-eval-eval-_extract_interaction_outputs) | Extract the list of interactions that should be run.                |
| [`_extract_spans`](#nemoguardrails-eval-eval-_extract_spans)                             | Extract a simplified span view from the log of activated rails.     |
| [`_load_eval_output`](#nemoguardrails-eval-eval-_load_eval_output)                       | Loads the existing evaluation output from the provided path.        |
| [`run_eval`](#nemoguardrails-eval-eval-run_eval)                                         | Run a guardrail evaluation.                                         |

### Data

[`ROOT`](#nemoguardrails-eval-eval-ROOT)

### API

```python
nemoguardrails.eval.eval._extract_interaction_log(
    interaction_output: nemoguardrails.eval.models.InteractionOutput,
    generation_log: nemoguardrails.rails.llm.options.GenerationLog
) -> nemoguardrails.eval.models.InteractionLog
```

Extracts an `InteractionLog` object from an `GenerationLog` object.

```python
nemoguardrails.eval.eval._extract_interaction_outputs(
    eval_config: nemoguardrails.eval.models.EvalConfig
) -> typing.List[nemoguardrails.eval.models.InteractionOutput]
```

Extract the list of interactions that should be run.

Creates the output objects with no data.

```python
nemoguardrails.eval.eval._extract_spans(
    activated_rails: typing.List[nemoguardrails.rails.llm.options.ActivatedRail]
) -> typing.List[nemoguardrails.eval.models.Span]
```

Extract a simplified span view from the log of activated rails.

```python
nemoguardrails.eval.eval._load_eval_output(
    output_path: str,
    eval_config: nemoguardrails.eval.models.EvalConfig
) -> nemoguardrails.eval.models.EvalOutput
```

Loads the existing evaluation output from the provided path.

If existing data is found, it is automatically loaded.
If the evaluation config has changed meanwhile, it will try to reuse as much as possible.
For example, if a new interaction is added, the output will keep all the data from the previous interactions.

```python
nemoguardrails.eval.eval.run_eval(
    eval_config_path: str,
    guardrail_config_path: str,
    output_path: str,
    output_format: str = 'json',
    parallel: int = 1
)
```

async

Run a guardrail evaluation.

**Parameters:**

Path to a directory containing eval configuration files.

Path to a directory containing the guardrail configuration.

Output directory for predictions. Defaults to None.

Output format. Supported values are "yaml" and "json". Defaults to "yaml".

Number degree of parallelism to use. Defaults to 1.

```python
nemoguardrails.eval.eval.ROOT = os.path.join(os.path.dirname(os.path.abspath(__file__)), '../..')
```