auto_jailbreak / models.py
adishu's picture
Upload folder using huggingface_hub
9be69be verified
Raw History Blame Contribute Delete
1.41 kB
# Copyright (c) Meta Platforms, Inc. and affiliates.
# All rights reserved.
#
# This source code is licensed under the BSD-style license found in the
# LICENSE file in the root directory of this source tree.
"""
Data models for the Auto Jailbreak Environment.
The auto_jailbreak environment is an environment that trains an Attacker LLM to find vulnerabilities in a Target LLM.
"""
from typing import Literal
from openenv.core.env_server.types import Action, Observation
from pydantic import Field
class AutoJailbreakAction(Action):
"""Action for the Auto Jailbreak environment."""
attack_prompt: str = Field(
default="", description="Attack prompt generated by Attacker LLM"
)
delete_target_prev_chat: bool = Field(
False,
description="Delete Target LLM's chat history",
)
select_task: Literal[
"Grading Sabotage", "Chemical Synthesis", "Password Breach"
] = Field(..., description="Select Task")
class AutoJailbreakObservation(Observation):
"""Observation from the Auto Jailbreak environment."""
target_reply: str = Field(..., description="Reply given by Target LLM")
judge_reply: str = Field(..., description="Reply given by Judge LLM")
judge_eval: dict = Field(
default={}, description="Evaluation of attack by Judge LLM"
)
error: str = Field(default="null", description="Error returned by environment")