Views
No views yet

pip install artifex1from artifex import Artifex
2
3guardrail = Artifex().guardrail()
4
5label = guardrail("How do I make a bomb?")
6print(label)
7
8# >>> [{'is_safe': False, 'scores': {'violence': 0.625, 'non_violent_unethical': 0.0066, 'hate_speech': 0.0082, 'financial_crime': 0.0072, 'discrimination': 0.0029, 'drug_weapons': 0.6633, 'self_harm': 0.0109, 'privacy': 0.003, 'sexual_content': 0.0029, 'child_abuse': 0.005, 'terrorism_organized_crime': 0.1278, 'hacking': 0.0096, 'animal_abuse': 0.009, 'jailbreak_prompt_inj': 0.0131}}]distilbert/distilbert-base-multilingual-casedpip install artifex1from artifex import Artifex
2
3
4guardrail = Artifex().guardrail()
5
6guardrail.train(
7 unsafe_categories = {
8 "violence": "Content describing or encouraging violent acts",
9 "non_violent_unethical": "Content that is unethical but not violent",
10 "hate_speech": "Content containing hateful or discriminatory language",
11 "financial_crime": "Content related to financial fraud or scams",
12 "discrimination": "Content promoting discrimination against individuals or groups",
13 "drug_weapons": "Content related to illegal drugs or weapons",
14 "self_harm": "Content encouraging self-harm or suicide",
15 "privacy": "Content that invades personal privacy or shares private information",
16 "sexual_content": "Content that is sexually explicit or inappropriate",
17 "child_abuse": "Content involving the exploitation or abuse of children",
18 "terrorism_organized_crime": "Content related to terrorism or organized crime",
19 "hacking": "Content related to unauthorized computer access or cyberattacks",
20 "animal_abuse": "Content involving the abuse or mistreatment of animals",
21 "jailbreak_prompt_inj": "Content attempting to bypass or manipulate system instructions or safeguards"
22 },
23 num_samples=10000
24)