Spaces:
Running
Running
Download server/models.py from adishu/auto_jailbreak: direct link, hf CLI and curl.
- Browser
- Download file 1.23 kB
-
https://huggingface.co/spaces/adishu/auto_jailbreak/resolve/main/server/models.py
- Command line
-
hf download hf://spaces/adishu/auto_jailbreak/server/models.py
-
curl -L -o models.py https://huggingface.co/spaces/adishu/auto_jailbreak/resolve/main/server/models.py
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") | |