> 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.sensitive_data_detection.actions

## Module Contents

### Functions

| Name                                                                                                                      | Description                                                   |
| ------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------- |
| [`_get_ad_hoc_recognizers`](#nemoguardrails-library-sensitive_data_detection-actions-_get_ad_hoc_recognizers)             | Helper to compute the ad hoc recognizers for a config.        |
| [`_get_analyzer`](#nemoguardrails-library-sensitive_data_detection-actions-_get_analyzer)                                 | -                                                             |
| [`detect_sensitive_data`](#nemoguardrails-library-sensitive_data_detection-actions-detect_sensitive_data)                 | Checks whether the provided text contains any sensitive data. |
| [`detect_sensitive_data_mapping`](#nemoguardrails-library-sensitive_data_detection-actions-detect_sensitive_data_mapping) | Mapping for detect\_sensitive\_data.                          |
| [`mask_sensitive_data`](#nemoguardrails-library-sensitive_data_detection-actions-mask_sensitive_data)                     | Checks whether the provided text contains any sensitive data. |

### Data

[`log`](#nemoguardrails-library-sensitive_data_detection-actions-log)

### API

```python
nemoguardrails.library.sensitive_data_detection.actions._get_ad_hoc_recognizers(
    sdd_config: nemoguardrails.rails.llm.config.SensitiveDataDetection
)
```

Helper to compute the ad hoc recognizers for a config.

```python
nemoguardrails.library.sensitive_data_detection.actions._get_analyzer(
    score_threshold: float = 0.4
)
```

```python
nemoguardrails.library.sensitive_data_detection.actions.detect_sensitive_data(
    source: str,
    text: str,
    config: nemoguardrails.RailsConfig,
    kwargs = {}
)
```

async

Checks whether the provided text contains any sensitive data.

Args
source: The source for the text, i.e. "input", "output", "retrieval".
text: The text to check.
config: The rails configuration object.

Returns
True if any sensitive data has been detected, False otherwise.

```python
nemoguardrails.library.sensitive_data_detection.actions.detect_sensitive_data_mapping(
    result: bool
) -> bool
```

Mapping for detect\_sensitive\_data.

Since the function returns True when sensitive data is detected,
we block if result is True.

```python
nemoguardrails.library.sensitive_data_detection.actions.mask_sensitive_data(
    source: str,
    text: str,
    config: nemoguardrails.RailsConfig
)
```

async

Checks whether the provided text contains any sensitive data.

Args
source: The source for the text, i.e. "input", "output", "retrieval".
text: The text to check.
config: The rails configuration object.

Returns
The altered text, if applicable.

```python
nemoguardrails.library.sensitive_data_detection.actions.log = logging.getLogger(__name__)
```