Skip to content

Commit 0dd04cc

Browse files
author
Baur
authored
Merge pull request #27 from ZenGuard-AI/feature/add-toxicity-api
enhancement - add toxicity api to client
2 parents b9483c9 + 8d7f7e6 commit 0dd04cc

File tree

2 files changed

+11
-8
lines changed

2 files changed

+11
-8
lines changed

tests/zenguard_e2e_test.py

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
21
from zenguard.zenguard import Detector
32

43

@@ -42,8 +41,16 @@ def test_keywords(zenguard):
4241
response = zenguard.detect(detectors=detectors, prompt=prompt)
4342
assert_successful_response_not_detected(response)
4443

44+
4545
def test_secrets(zenguard):
4646
prompt = "Simple secrets test"
4747
detectors = [Detector.SECRETS]
4848
response = zenguard.detect(detectors=detectors, prompt=prompt)
4949
assert_successful_response_not_detected(response)
50+
51+
52+
def test_toxicity(zenguard):
53+
prompt = "Simple toxicity test"
54+
detectors = [Detector.TOXICITY]
55+
response = zenguard.detect(detectors=detectors, prompt=prompt)
56+
assert_successful_response_not_detected(response)

zenguard/zenguard.py

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -11,13 +11,8 @@
1111
from tqdm import tqdm
1212

1313
from zenguard.ai_clients.openai import ChatWithZenguard
14-
from zenguard.pentest.prompt_injections import (
15-
config,
16-
prompting,
17-
run,
18-
scoring,
19-
visualization,
20-
)
14+
from zenguard.pentest.prompt_injections import (config, prompting, run,
15+
scoring, visualization)
2116

2217

2318
class SupportedLLMs:
@@ -44,6 +39,7 @@ class Detector(Enum):
4439
BANNED_TOPICS = "v1/detect/topics/banned"
4540
KEYWORDS = "v1/detect/keywords"
4641
SECRETS = "v1/detect/secrets"
42+
TOXICITY = "v1/detect/toxicity"
4743

4844

4945
class Endpoint(Enum):

0 commit comments

Comments
 (0)