File size: 1,335 Bytes
82f262a
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
{
  "rules": [
    {
      "id": "safety.block_harm",
      "phase": "in",
      "priority": 100,
      "if": {
        "regex": "\\b(how to (kill|hurt|harm)|suicide|self-harm|build a bomb)\\b"
      },
      "then": { "action": "block", "reply": "I can't help with that." }
    },
    {
      "id": "safety.block_lewd",
      "phase": "in",
      "priority": 90,
      "if": {
        "regex": "\\b(child porn|csam|sexualize minors)\\b"
      },
      "then": { "action": "block", "reply": "I can't help with that." }
    },
    {
      "id": "output.mask_emails",
      "phase": "out",
      "priority": 50,
      "if": { "regex": "[A-Za-z0-9._%+-]+@[A-Za-z0-9.-]+\\.[A-Za-z]{2,}" },
      "then": { "action": "mask", "mask_pattern": "[A-Za-z0-9._%+-]+@[A-Za-z0-9.-]+\\.[A-Za-z]{2,}", "mask_replacement": "[EMAIL]" }
    },
    {
      "id": "output.mask_phones",
      "phase": "out",
      "priority": 50,
      "if": { "regex": "\\b\\+?[0-9][0-9 .-]{7,}\\b" },
      "then": { "action": "mask", "mask_pattern": "\\b\\+?[0-9][0-9 .-]{7,}\\b", "mask_replacement": "[PHONE]" }
    },
    {
      "id": "output.block_unsafe_code",
      "phase": "out",
      "priority": 60,
      "if": { "regex": "rm -rf /|format c:|DROP TABLE users" },
      "then": { "action": "block", "reply": "That output was blocked for safety." }
    }
  ]
}