Skip to navigation

nemoguardrails.library.language_detector.actions

View as MarkdownOpen in Claude

Module Contents

Functions

NameDescription
_get_language_detector_configReturn the typed language_detector rail config, if available.
language_detector_check_inputGate user messages by language, via an allowlist or a blocklist.

Data

log

API

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.

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 = {}
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.

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