NeMo-AI / nemo /actions.py
SSK-14's picture
Upload 16 files
a909949 verified
raw
history blame contribute delete
643 Bytes
from typing import Optional
from nemoguardrails.actions import action
@action(is_system_action=True)
async def check_blocked_terms(context: Optional[dict] = None):
input = context.get("user_message")
sensitive_information = [
"racist",
"sexist",
"offensive",
"discrimination",
"curse",
"profanity",
"slur",
"harass",
"hate speech",
"bully",
"abuse",
"vulgar",
"derogatory",
"insult",
"obscene"
]
for term in sensitive_information:
if term in input.lower():
return True
return False