asofter commited on
Commit
05bf37a
1 Parent(s): b3e5cf7

* upgrade of the version

Browse files
Files changed (3) hide show
  1. output.py +25 -2
  2. prompt.py +23 -1
  3. requirements.txt +4 -4
output.py CHANGED
@@ -20,6 +20,7 @@ logger = logging.getLogger("llm-guard-playground")
20
 
21
  def init_settings() -> (List, Dict):
22
  all_scanners = [
 
23
  "BanCompetitors",
24
  "BanSubstrings",
25
  "BanTopics",
@@ -31,7 +32,7 @@ def init_settings() -> (List, Dict):
31
  "LanguageSame",
32
  "MaliciousURLs",
33
  "NoRefusal",
34
- "ReadingTime",
35
  "FactualConsistency",
36
  "Gibberish",
37
  "Regex",
@@ -51,6 +52,24 @@ def init_settings() -> (List, Dict):
51
 
52
  settings = {}
53
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
54
  if "BanCompetitors" in st_enabled_scanners:
55
  st_bc_expander = st.sidebar.expander(
56
  "Ban Competitors",
@@ -303,6 +322,9 @@ def init_settings() -> (List, Dict):
303
 
304
  settings["NoRefusal"] = {"threshold": st_no_ref_threshold}
305
 
 
 
 
306
  if "ReadingTime" in st_enabled_scanners:
307
  st_rt_expander = st.sidebar.expander(
308
  "Reading Time",
@@ -436,7 +458,7 @@ def init_settings() -> (List, Dict):
436
  with st_sent_expander:
437
  st_sent_threshold = st.slider(
438
  label="Threshold",
439
- value=-0.1,
440
  min_value=-1.0,
441
  max_value=1.0,
442
  step=0.1,
@@ -515,6 +537,7 @@ def get_scanner(scanner_name: str, vault: Vault, settings: Dict):
515
  settings["vault"] = vault
516
 
517
  if scanner_name in [
 
518
  "BanTopics",
519
  "Bias",
520
  "Code",
 
20
 
21
  def init_settings() -> (List, Dict):
22
  all_scanners = [
23
+ "BanCode",
24
  "BanCompetitors",
25
  "BanSubstrings",
26
  "BanTopics",
 
32
  "LanguageSame",
33
  "MaliciousURLs",
34
  "NoRefusal",
35
+ "NoRefusalLight" "ReadingTime",
36
  "FactualConsistency",
37
  "Gibberish",
38
  "Regex",
 
52
 
53
  settings = {}
54
 
55
+ if "BanCode" in st_enabled_scanners:
56
+ st_bc_expander = st.sidebar.expander(
57
+ "Ban Code",
58
+ expanded=False,
59
+ )
60
+
61
+ with st_bc_expander:
62
+ st_bc_threshold = st.slider(
63
+ label="Threshold",
64
+ value=0.95,
65
+ min_value=0.0,
66
+ max_value=1.0,
67
+ step=0.05,
68
+ key="ban_code_threshold",
69
+ )
70
+
71
+ settings["BanCode"] = {"threshold": st_bc_threshold}
72
+
73
  if "BanCompetitors" in st_enabled_scanners:
74
  st_bc_expander = st.sidebar.expander(
75
  "Ban Competitors",
 
322
 
323
  settings["NoRefusal"] = {"threshold": st_no_ref_threshold}
324
 
325
+ if "NoRefusalLight" in st_enabled_scanners:
326
+ settings["NoRefusalLight"] = {}
327
+
328
  if "ReadingTime" in st_enabled_scanners:
329
  st_rt_expander = st.sidebar.expander(
330
  "Reading Time",
 
458
  with st_sent_expander:
459
  st_sent_threshold = st.slider(
460
  label="Threshold",
461
+ value=-0.5,
462
  min_value=-1.0,
463
  max_value=1.0,
464
  step=0.1,
 
537
  settings["vault"] = vault
538
 
539
  if scanner_name in [
540
+ "BanCode",
541
  "BanTopics",
542
  "Bias",
543
  "Code",
prompt.py CHANGED
@@ -20,6 +20,7 @@ logger = logging.getLogger("llm-guard-playground")
20
  def init_settings() -> (List, Dict):
21
  all_scanners = [
22
  "Anonymize",
 
23
  "BanCompetitors",
24
  "BanSubstrings",
25
  "BanTopics",
@@ -107,6 +108,26 @@ def init_settings() -> (List, Dict):
107
  "threshold": st_anon_threshold,
108
  }
109
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
110
  if "BanCompetitors" in st_enabled_scanners:
111
  st_bc_expander = st.sidebar.expander(
112
  "Ban Competitors",
@@ -369,7 +390,7 @@ def init_settings() -> (List, Dict):
369
  with st_sent_expander:
370
  st_sent_threshold = st.slider(
371
  label="Threshold",
372
- value=-0.1,
373
  min_value=-1.0,
374
  max_value=1.0,
375
  step=0.1,
@@ -442,6 +463,7 @@ def get_scanner(scanner_name: str, vault: Vault, settings: Dict):
442
 
443
  if scanner_name in [
444
  "Anonymize",
 
445
  "BanTopics",
446
  "Code",
447
  "Gibberish",
 
20
  def init_settings() -> (List, Dict):
21
  all_scanners = [
22
  "Anonymize",
23
+ "BanCode",
24
  "BanCompetitors",
25
  "BanSubstrings",
26
  "BanTopics",
 
108
  "threshold": st_anon_threshold,
109
  }
110
 
111
+ if "BanCode" in st_enabled_scanners:
112
+ st_bc_expander = st.sidebar.expander(
113
+ "Ban Code",
114
+ expanded=False,
115
+ )
116
+
117
+ with st_bc_expander:
118
+ st_bc_threshold = st.slider(
119
+ label="Threshold",
120
+ value=0.95,
121
+ min_value=0.0,
122
+ max_value=1.0,
123
+ step=0.05,
124
+ key="ban_code_threshold",
125
+ )
126
+
127
+ settings["BanCode"] = {
128
+ "threshold": st_bc_threshold,
129
+ }
130
+
131
  if "BanCompetitors" in st_enabled_scanners:
132
  st_bc_expander = st.sidebar.expander(
133
  "Ban Competitors",
 
390
  with st_sent_expander:
391
  st_sent_threshold = st.slider(
392
  label="Threshold",
393
+ value=-0.5,
394
  min_value=-1.0,
395
  max_value=1.0,
396
  step=0.1,
 
463
 
464
  if scanner_name in [
465
  "Anonymize",
466
+ "BanCode",
467
  "BanTopics",
468
  "Code",
469
  "Gibberish",
requirements.txt CHANGED
@@ -1,5 +1,5 @@
1
- llm-guard==0.3.10
2
- llm-guard[onnxruntime]==0.3.10
3
- pandas==2.2.1
4
- streamlit==1.32.1
5
  streamlit-tags==1.2.8
 
1
+ llm-guard==0.3.12
2
+ llm-guard[onnxruntime]==0.3.12
3
+ pandas==2.2.2
4
+ streamlit==1.33.0
5
  streamlit-tags==1.2.8