check_policy_violation()
Scans text against a custom list of keywords or rules. This policy is applicable to both prompts and responses.
Signature:
text(str): The input text to scan.interaction_type(InteractionType): The context of the text (PROMPTorRESPONSE).action(Action): The action to take if a rule is matched (BLOCKorFLAG).rules(List[str]): A list of forbidden keywords or phrases to detect.*kwargs: Optional platform overrides (asset_id,session_id,save).
check_secrets_keys()
Scans text for hardcoded secrets and keys. This policy is applicable only to responses.
Signature:
text(str): The input text to scan.action(Action): The action to take (BLOCKorFLAG).patterns(Optional[List[Tuple[str, str]]]): A list of(name, regex_pattern)tuples to whitelist specific patterns, preventing them from being flagged as secrets.*kwargs: Optional platform overrides (asset_id,session_id,save).
check_pii()
Scans text for Personally Identifiable Information. This policy is applicable to both prompts and responses.
Signature:
text(str): The input text to scan.interaction_type(InteractionType): The context of the text (PROMPTorRESPONSE).action(Action): The action to take (BLOCKorFLAG).*kwargs: Optional platform overrides (asset_id,session_id,save).
check_toxicity()
Scans text for toxic content. This policy is applicable to both prompts and responses.
Signature:
text(str): The input text to scan.interaction_type(InteractionType): The context of the text (PROMPTorRESPONSE).action(Action): The action to take (BLOCKorFLAG).*kwargs: Optional platform overrides (asset_id,session_id,save).
check_competitor_mention()
Scans text for mentions of specific competitor names. This policy is applicable to both prompts and responses.
Signature:
text(str): The input text to scan.interaction_type(InteractionType): The context of the text (PROMPTorRESPONSE).action(Action): The action to take (BLOCKorFLAG).competitors(List[str]): A list of competitor names to detect.*kwargs: Optional platform overrides (asset_id,session_id,save).
check_banned_topics()
Scans text for forbidden topics. This policy is applicable only to prompts.
Signature:
prompt(str): The input prompt to scan.action(Action): The action to take (BLOCKorFLAG).topics(List[str]): A list of forbidden topics.*kwargs: Optional platform overrides (asset_id,session_id,save).
check_prompt_injection()
Scans text for prompt injection attacks. This policy is applicable only to prompts.
Signature:
prompt(str): The input prompt to scan.action(Action): The action to take (BLOCKorFLAG).*kwargs: Optional platform overrides (asset_id,session_id,save).
check_unsafe_prompt()
Scans text for requests for harmful or unethical content. This policy is applicable only to prompts.
Signature:
prompt(str): The input prompt to scan.action(Action): The action to take (BLOCKorFLAG).*kwargs: Optional platform overrides (asset_id,session_id,save).
check_unsafe_response()
Scans text to ensure it does not contain harmful or unethical content. This policy is applicable only to responses.
Signature:
text(str): The input response to scan.action(Action): The action to take (BLOCKorFLAG).*kwargs: Optional platform overrides (asset_id,session_id,save).
check_system_prompt_leak()
Scans text for content matching a confidential system prompt. This policy is applicable only to responses.
Signature:
text(str): The input response to scan.action(Action): The action to take (BLOCKorFLAG).system_prompt(str): The system prompt string to check for leakage against.*kwargs: Optional platform overrides (asset_id,session_id,save).

