auto_jailbreak / server /models.py
adishu's picture
Upload folder using huggingface_hub
caef4db verified
Raw History Blame Contribute Delete
1.23 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 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(
..., description="Attack prompt generated by Attacker LLM"
)
delete_target_prev_chat: bool = Field(
False, description="Delete target's previous chat history"
)
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")