Spaces:
Running
Running
File size: 714 Bytes
7e16d4f 0f0578b 7e16d4f |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 |
from guardrails_genie.guardrails.pii.regex_pii_guardrail import RegexPIIGuardrail
import weave
def run_regex_model():
weave.init("guardrails-genie-pii-regex-model")
# Create the guardrail
pii_guardrail = RegexPIIGuardrail(use_defaults=True, should_anonymize=True)
# Check a prompt
prompt = "Please contact [email protected] or call 123-456-7890"
result = pii_guardrail.guard(prompt)
print(result)
# Result will contain:
# - contains_pii: True
# - detected_pii_types: {"email": ["[email protected]"], "phone_number": ["123-456-7890"]}
# - safe_to_process: False
# - explanation: Detailed explanation of findings
if __name__ == "__main__":
run_regex_model()
|