nemoguardrails.library.regex.actions
Module Contents
Classes
Functions
Data
API
Bases: typing.TypedDict
detections
is_match
text
Return True (blocked) when a regex match was found.
async
Checks whether the provided text matches any forbidden regex pattern.
Parameters:
source
The source for the text, i.e. “input”, “output”, “retrieval”.
text
The text to check.
config
The rails configuration object.
Returns: RegexDetectionResult
A TypedDict containing:
- is_match (bool): Whether any pattern matched.
- text (str): The original text that was checked.
- detections (List[str]): List of pattern strings that matched.