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

HuggingFace classifier-based detection actions.

## Module Contents

### Functions

| Name                                                                                                           | Description                                                    |
| -------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------- |
| [`_classify_and_check`](#nemoguardrails-library-hf_classifier-actions-_classify_and_check)                     | Classify *text* and check against blocked labels.              |
| [`_extract_text`](#nemoguardrails-library-hf_classifier-actions-_extract_text)                                 | -                                                              |
| [`_hf_classifier_output_mapping`](#nemoguardrails-library-hf_classifier-actions-_hf_classifier_output_mapping) | Map action result to streaming blocked semantic: True=blocked. |
| [`hf_classifier_check_input`](#nemoguardrails-library-hf_classifier-actions-hf_classifier_check_input)         | -                                                              |
| [`hf_classifier_check_output`](#nemoguardrails-library-hf_classifier-actions-hf_classifier_check_output)       | -                                                              |
| [`hf_classifier_check_retrieval`](#nemoguardrails-library-hf_classifier-actions-hf_classifier_check_retrieval) | -                                                              |

### Data

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

### API

```python
nemoguardrails.library.hf_classifier.actions._classify_and_check(
    classifier_name: str,
    text: str,
    config: typing.Optional[nemoguardrails.RailsConfig]
) -> bool
```

async

Classify *text* and check against blocked labels.

Returns `True` if allowed, `False` if blocked.

```python
nemoguardrails.library.hf_classifier.actions._extract_text(
    context: typing.Optional[dict],
    key: str
) -> str
```

```python
nemoguardrails.library.hf_classifier.actions._hf_classifier_output_mapping(
    result: bool
) -> bool
```

Map action result to streaming blocked semantic: True=blocked.

```python
nemoguardrails.library.hf_classifier.actions.hf_classifier_check_input(
    classifier: str,
    config: typing.Optional[nemoguardrails.RailsConfig] = None,
    context: typing.Optional[dict] = None,
    kwargs = {}
) -> bool
```

async

```python
nemoguardrails.library.hf_classifier.actions.hf_classifier_check_output(
    classifier: str,
    config: typing.Optional[nemoguardrails.RailsConfig] = None,
    context: typing.Optional[dict] = None,
    model_name: typing.Optional[str] = None,
    kwargs = {}
) -> bool
```

async

```python
nemoguardrails.library.hf_classifier.actions.hf_classifier_check_retrieval(
    classifier: str,
    config: typing.Optional[nemoguardrails.RailsConfig] = None,
    context: typing.Optional[dict] = None,
    kwargs = {}
) -> bool
```

async

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