> This page is for version Latest (default).
> For other versions, use one of these documentation indexes:
> - Latest (default): https://docs.nvidia.com/nemo/guardrails/latest/llms.txt
> - v0.25.0: https://docs.nvidia.com/nemo/guardrails/v0.25.0/llms.txt
> - v0.24.1: https://docs.nvidia.com/nemo/guardrails/v0.24.1/llms.txt
> - v0.24.0: https://docs.nvidia.com/nemo/guardrails/v0.24.0/llms.txt
> - v0.23.0: https://docs.nvidia.com/nemo/guardrails/v0.23.0/llms.txt
> - v0.22.0: https://docs.nvidia.com/nemo/guardrails/v0.22.0/llms.txt

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

# nemoguardrails.library.language_detector.actions

## Module Contents

### Functions

| Name                                                                                                               | Description                                                      |
| ------------------------------------------------------------------------------------------------------------------ | ---------------------------------------------------------------- |
| [`_get_language_detector_config`](#nemoguardrails-library-language_detector-actions-_get_language_detector_config) | Return the typed `language_detector` rail config, if available.  |
| [`language_detector_check_input`](#nemoguardrails-library-language_detector-actions-language_detector_check_input) | Gate user messages by language, via an allowlist or a blocklist. |

### Data

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

### API

```python
nemoguardrails.library.language_detector.actions._get_language_detector_config(
    config: typing.Any
) -> typing.Optional[typing.Any]
```

Return the typed `language_detector` rail config, if available.

```python
nemoguardrails.library.language_detector.actions.language_detector_check_input(
    context: typing.Optional[dict] = None,
    config: typing.Optional[typing.Any] = None,
    user_message: typing.Optional[str] = None,
    kwargs = {}
) -> nemoguardrails.actions.rail_outcome.RailOutcome
```

async

Gate user messages by language, via an allowlist or a blocklist.

Blocked messages are refused in the user's own language whenever a refusal
message is available, falling back to English. When language detection
fails, `fail_open` explicitly controls whether the message is allowed or
blocked; the unknown language is never reported as English.

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