> 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.library.jailbreak_detection.rail_config

## Module Contents

### Classes

| Name                                                                                                           | Description                                 |
| -------------------------------------------------------------------------------------------------------------- | ------------------------------------------- |
| [`JailbreakDetectionConfig`](#nemoguardrails-library-jailbreak_detection-rail_config-JailbreakDetectionConfig) | Configuration data for jailbreak detection. |

### Functions

| Name                                                                                             | Description |
| ------------------------------------------------------------------------------------------------ | ----------- |
| [`build_config_spec`](#nemoguardrails-library-jailbreak_detection-rail_config-build_config_spec) | -           |

### Data

[`log`](#nemoguardrails-library-jailbreak_detection-rail_config-log)

### API

```python
class nemoguardrails.library.jailbreak_detection.rail_config.JailbreakDetectionConfig()
```

**Bases:** [RailConfigBaseModel](/guardrails-python-sdk/nemoguardrails/manifests/config_schema#nemoguardrails-manifests-config_schema-RailConfigBaseModel)

Configuration data for jailbreak detection.

**`api_key`** `Optional[SecretStr]`

---

**`api_key_env_var`** `Optional[str]`

---

**`embedding`** `Optional[str]`

---

**`length_per_perplexity_threshold`** `float`

---

**`nim_base_url`** `Optional[str]`

---

**`nim_port`** `Optional[int]`

---

**`nim_server_endpoint`** `Optional[str]`

---

**`nim_url`** `Optional[str]`

---

**`prefix_suffix_perplexity_threshold`** `float`

---

**`server_endpoint`** `Optional[str]`

---

```python
nemoguardrails.library.jailbreak_detection.rail_config.JailbreakDetectionConfig.get_api_key() -> typing.Optional[str]
```

Helper to return an API key (if it exists) from a Jailbreak configuration.
This can come from (in descending order of priority):

1. The `api_key` field, a Pydantic SecretStr from which we extract the full string.
2. The `api_key_env_var` field, a string stored in this environment variable.

If neither is found, None is returned.

```python
nemoguardrails.library.jailbreak_detection.rail_config.JailbreakDetectionConfig.migrate_deprecated_fields() -> nemoguardrails.library.jailbreak_detection.rail_config.JailbreakDetectionConfig
```

Migrate deprecated nim\_url/nim\_port fields to nim\_base\_url format.

```python
nemoguardrails.library.jailbreak_detection.rail_config.JailbreakDetectionConfig.validate_urls() -> nemoguardrails.library.jailbreak_detection.rail_config.JailbreakDetectionConfig
```

Validate URL formats for endpoints.

```python
nemoguardrails.library.jailbreak_detection.rail_config.build_config_spec() -> nemoguardrails.manifests.config_schema.RailConfigSpec
```

```python
nemoguardrails.library.jailbreak_detection.rail_config.log = logging.getLogger(__name__)
```