nemoguardrails.library.privateai.actions
PII detection using Private AI.
Module Contents
Functions
Data
API
async
Checks whether the provided text contains any PII.
Args source: The source for the text, i.e. “input”, “output”, “retrieval”. text: The text to check. config: The rails configuration object.
Returns RailOutcome.block() if PII is detected, RailOutcome.allow() otherwise.
Raises:
ValueError: If PAI_API_KEY is missing when using cloud API or if the response is invalid.
async
Masks any detected PII in the provided text.
Parameters:
source
The source for the text, i.e. “input”, “output”, “retrieval”.
text
The text to check.
config
The rails configuration object.
Returns: RailOutcome
RailOutcome.transform() with the altered text if it changed, RailOutcome.allow() otherwise.
Raises:
ValueError: If PAI_API_KEY is missing when using cloud API or if the response is invalid.