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

Juliagomes/add on fail default response #10

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
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: 1 addition & 1 deletion validator/benchmark_guard_on_dataset.py
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ def benchmark_arize_jailbreak_embeddings_validator(train_prompts: List[str], jai
# Set up Guard
guard = Guard.from_string(
validators=[
JailbreakEmbeddings(threshold=0.2, validation_method="full", on_fail="refrain", sources=train_prompts)
JailbreakEmbeddings(threshold=0.2, validation_method="full", on_fail="fix", sources=train_prompts)
],
)

Expand Down
1 change: 1 addition & 0 deletions validator/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,7 @@ def validate(self, value: Any, metadata: Dict[str, Any]) -> ValidationResult:
error_message=(
f"The following text in your response is similar to our dataset of jailbreaks prompts:\n{value}"
),
fix_value="I'm sorry, I cannot respond. The Arize Guard flagged this message as a Jailbreak attempt."
)
# All chunks exceeded the cosine distance threshold
return PassResult(metadata=metadata)
Expand Down