File size: 3,462 Bytes
acb544e
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
app:
  name: ${APP_NAME:LLM Guard API}
  log_level: ${LOG_LEVEL:INFO}
  scan_fail_fast: ${SCAN_FAIL_FAST:false}
  scan_prompt_timeout: ${SCAN_PROMPT_TIMEOUT:10}
  scan_output_timeout: ${SCAN_OUTPUT_TIMEOUT:30}
  port: ${APP_PORT:7860}

cache:
  ttl: ${CACHE_TTL:3600}
  #max_size: ${CACHE_MAX_SIZE:1000}

rate_limit:
  enabled: ${RATE_LIMIT_ENABLED:true}
  limit: ${RATE_LIMIT_LIMIT:100/minute}

#auth:
#  type: http_bearer
#  token: ${AUTH_TOKEN:}

tracing:
  exporter: ${TRACING_EXPORTER:console}
  endpoint: ${TRACING_OTEL_ENDPOINT:} # Example: "<traces-endpoint>/v1/traces"

metrics:
  exporter: ${METRICS_TYPE:prometheus}
  endpoint: ${METRICS_ENDPOINT:} # Example: "<metrics-endpoint>/v1/metrics"

# Scanners are applied in the order they are listed here.
input_scanners:
  - type: Anonymize
    params:
      # allowed_names: []
      # hidden_names: []
      # entity_types: []
      # preamble: ""
      use_faker: false
  - type: BanCompetitors
    params:
      competitors: ["facebook"]
      threshold: 0.5
  - type: BanSubstrings
    params:
      substrings: ["test"]
      match_type: "word"
      case_sensitive: false
      redact: false
      contains_all: false
  - type: BanTopics
    params:
      topics: ["violence"]
      threshold: 0.6
  - type: Code
    params:
      languages: ["Python"]
      is_blocked: true
  - type: Gibberish
    params:
      threshold: 0.9
  - type: InvisibleText
    params: {}
  - type: Language
    params:
      valid_languages: ["en"]
  - type: PromptInjection
    params:
      threshold: 0.9
  - type: Regex
    params:
      patterns: ["Bearer [A-Za-z0-9-._~+/]+"]
      is_blocked: true
      match_type: search
      redact: true
  - type: Secrets
    params:
      redact_mode: "all"
  - type: Sentiment
    params:
      # lexicon: "vader_lexicon"
      threshold: -0.1
  - type: TokenLimit
    params:
      limit: 4096
      encoding_name: "cl100k_base"
  - type: Toxicity
    params:
      threshold: 0.5

output_scanners:
  - type: BanCompetitors
    params:
      competitors: ["facebook"]
      threshold: 0.5
  - type: BanSubstrings
    params:
      substrings: ["test"]
      match_type: "word"
      case_sensitive: false
      redact: false
      contains_all: false
  - type: BanTopics
    params:
      topics: ["violence"]
      threshold: 0.6
  - type: Bias
    params:
      threshold: 0.75
  - type: Code
    params:
      languages: ["Python"]
      is_blocked: true
  - type: Deanonymize
    params:
      matching_strategy: "exact"
  - type: FactualConsistency
    params:
      minimum_score: 0.5
  - type: Gibberish
    params:
      threshold: 0.9
  - type: JSON
    params:
      required_elements: 0
      repair: true
  - type: Language
    params:
      valid_languages: ["en"]
  - type: LanguageSame
    params: {}
  - type: MaliciousURLs
    params:
      threshold: 0.75
  - type: NoRefusal
    params:
      threshold: 0.5
  - type: ReadingTime
    params:
      max_time: 5
      truncate: false
  - type: Regex
    params:
      patterns: ["Bearer [A-Za-z0-9-._~+/]+"]
      is_blocked: true
      match_type: search
      redact: true
  - type: Relevance
    params:
      threshold: 0.5
  - type: Sensitive
    params:
      # entity_types:
      redact: false
      threshold: 0.0
  - type: Sentiment
    params:
      threshold: -0.1
      # lexicon: "vader_lexicon"
  - type: Toxicity
    params:
      threshold: 0.5
  - type: URLReachability
    params: {}