DeepTeam is a framework to red team LLMs and AI agents.
Fix ROT13
penguine1d4bc5b239ac
diff --git a/b.py b/b.pyindex f134f1c1..8ddd2255 100644--- a/b.py+++ b/b.py@@ -2,11 +2,17 @@ from deepteam import red_teamfrom deepteam.vulnerabilities import Biasfrom deepteam.attacks.single_turn import PromptInjection+def model_callback(input: str) -> str:# Replace this with your LLM applicationreturn f"I'm sorry but I can't answer this: {input}"+bias = Bias(types=["race"])prompt_injection = PromptInjection()-red_team(model_callback=model_callback, vulnerabilities=[bias], attacks=[prompt_injection])\ No newline at end of file+red_team(+ model_callback=model_callback,+ vulnerabilities=[bias],+ attacks=[prompt_injection],+)diff --git a/deepteam/attacks/multi_turn/tree_jailbreaking/tree_jailbreaking.py b/deepteam/attacks/multi_turn/tree_jailbreaking/tree_jailbreaking.pyindex 9b0ac080..e42632dd 100644--- a/deepteam/attacks/multi_turn/tree_jailbreaking/tree_jailbreaking.py+++ b/deepteam/attacks/multi_turn/tree_jailbreaking/tree_jailbreaking.py@@ -350,14 +350,10 @@ class TreeJailbreaking(BaseAttack):##################################################def _generate_schema(self, prompt: str, schema: BaseModel):- return generate_schema(- prompt, schema, self.simulator_model- )+ return generate_schema(prompt, schema, self.simulator_model)async def _a_generate_schema(self, prompt: str, schema: BaseModel):- return await a_generate_schema(- prompt, schema, self.simulator_model- )+ return await a_generate_schema(prompt, schema, self.simulator_model)def get_name(self) -> str:return "Tree Jailbreaking"diff --git a/deepteam/attacks/single_turn/multilingual/schema.py b/deepteam/attacks/single_turn/multilingual/schema.pyindex e1038a73..cc1f5532 100644--- a/deepteam/attacks/single_turn/multilingual/schema.py+++ b/deepteam/attacks/single_turn/multilingual/schema.py@@ -10,6 +10,7 @@ class ComplianceData(BaseModel):Attributes:non_compliant (bool): True if the prompt is non-compliant, False otherwise."""+non_compliant: bool@@ -18,4 +19,5 @@ class IsTranslation(BaseModel):Attributes:is_translation (bool): True if the prompt is a translation, False otherwise."""+is_translation: booldiff --git a/deepteam/attacks/single_turn/rot13/rot13.py b/deepteam/attacks/single_turn/rot13/rot13.pyindex 37d689a2..df7c8766 100644--- a/deepteam/attacks/single_turn/rot13/rot13.py+++ b/deepteam/attacks/single_turn/rot13/rot13.py@@ -2,6 +2,9 @@ from deepteam.attacks import BaseAttackclass ROT13(BaseAttack):+ def __init__(self, weight: int = 1):+ self.weight = weight+def enhance(self, attack: str) -> str:"""Enhance the attack using ROT13 encoding."""return attack.translate(diff --git a/tests/test_deepteam.py b/tests/test_deepteam.pyindex 7f182be6..58429998 100644--- a/tests/test_deepteam.py+++ b/tests/test_deepteam.py@@ -1,5 +1,5 @@from deepteam import red_team+def test_red_team():assert red_team-