> 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 full documentation content, see https://docs.nvidia.com/nemo/guardrails/llms-full.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.server

## Module Contents

### Classes

| Name                                                                                                        | Description                                                                                                                  |
| ----------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------- |
| [`JailbreakHeuristicRequest`](#nemoguardrails-library-jailbreak_detection-server-JailbreakHeuristicRequest) | prompt (str): User utterance to the model                                                                                    |
| [`JailbreakModelRequest`](#nemoguardrails-library-jailbreak_detection-server-JailbreakModelRequest)         | Since the embedding model corresponds exactly to the classifier, we only need to provide the embedding model in the request. |

### Functions

| Name                                                                                                  | Description |
| ----------------------------------------------------------------------------------------------------- | ----------- |
| [`hello_world`](#nemoguardrails-library-jailbreak_detection-server-hello_world)                       | -           |
| [`lp_heuristic_check`](#nemoguardrails-library-jailbreak_detection-server-lp_heuristic_check)         | -           |
| [`ps_ppl_heuristic_check`](#nemoguardrails-library-jailbreak_detection-server-ps_ppl_heuristic_check) | -           |
| [`run_all_heuristics`](#nemoguardrails-library-jailbreak_detection-server-run_all_heuristics)         | -           |
| [`run_model_check`](#nemoguardrails-library-jailbreak_detection-server-run_model_check)               | -           |
| [`start`](#nemoguardrails-library-jailbreak_detection-server-start)                                   | -           |

### Data

[`app`](#nemoguardrails-library-jailbreak_detection-server-app)

[`cli_app`](#nemoguardrails-library-jailbreak_detection-server-cli_app)

[`device`](#nemoguardrails-library-jailbreak_detection-server-device)

### API

```python
class nemoguardrails.library.jailbreak_detection.server.JailbreakHeuristicRequest()
```

**Bases:** `BaseModel`

prompt (str): User utterance to the model
lp\_threshold (float): Threshold value for length-perplexity heuristic. Default: 89.79
ps\_ppl\_threshold (float): Threshold value for prefix/suffix perplexity heuristic. Default: 1845.65

```python
class nemoguardrails.library.jailbreak_detection.server.JailbreakModelRequest()
```

**Bases:** `BaseModel`

Since the embedding model corresponds exactly to the classifier, we only need to provide the embedding model in the request.

prompt (str): User utterance to the model

```python
nemoguardrails.library.jailbreak_detection.server.hello_world()
```

```python
nemoguardrails.library.jailbreak_detection.server.lp_heuristic_check(
    request: nemoguardrails.library.jailbreak_detection.server.JailbreakHeuristicRequest
)
```

```python
nemoguardrails.library.jailbreak_detection.server.ps_ppl_heuristic_check(
    request: nemoguardrails.library.jailbreak_detection.server.JailbreakHeuristicRequest
)
```

```python
nemoguardrails.library.jailbreak_detection.server.run_all_heuristics(
    request: nemoguardrails.library.jailbreak_detection.server.JailbreakHeuristicRequest
)
```

```python
nemoguardrails.library.jailbreak_detection.server.run_model_check(
    request: nemoguardrails.library.jailbreak_detection.server.JailbreakModelRequest
)
```

```python
nemoguardrails.library.jailbreak_detection.server.start(
    port: int = typer.Option(default=1337, ...,
    host: str = typer.Option(default='0.0.0...
)
```

```python
nemoguardrails.library.jailbreak_detection.server.app = FastAPI()
```

```python
nemoguardrails.library.jailbreak_detection.server.cli_app = typer.Typer()
```

```python
nemoguardrails.library.jailbreak_detection.server.device = os.environ.get('JAILBREAK_CHECK_DEVICE', 'cpu')
```