Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix empty autodan prompts & poor detector behaviour #534

Merged
merged 2 commits into from
Feb 29, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions garak/detectors/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,8 @@ def detect(
detector_results = []
for output in attempt.outputs:
match = False
if output is None:
continue
for s in self.substrings:
if case_sensitive:
s, output = s.lower(), output.lower()
Expand Down
4 changes: 2 additions & 2 deletions garak/probes/dan.py
Original file line number Diff line number Diff line change
Expand Up @@ -515,7 +515,7 @@ def probe(self, generator):
return super().probe(generator)


class AutoDANProbe(Probe):
class AutoDAN(Probe):
"""Probe leveraging generated AutoDAN prompts

A static implementation of the AutoDAN approach to autoated LLM jailbreaking,
Expand Down Expand Up @@ -545,7 +545,7 @@ def __init__(
if not prompts:
msg = f"No prompts found in {self.autodan_prompt_location}"
raise EOFError(msg)
self.prompts = prompts
self.prompts = [p for p in prompts if p.strip() != ""]
super().__init__()


Expand Down
Loading