DeepTeam is a framework to red team LLMs and AI agents.
udpated docs
penguine364a889864d6
diff --git a/deepteam/attacks/multi_turn/crescendo_jailbreaking/crescendo_jailbreaking.py b/deepteam/attacks/multi_turn/crescendo_jailbreaking/crescendo_jailbreaking.pyindex 5b3c15e6..719826cb 100644--- a/deepteam/attacks/multi_turn/crescendo_jailbreaking/crescendo_jailbreaking.py+++ b/deepteam/attacks/multi_turn/crescendo_jailbreaking/crescendo_jailbreaking.py@@ -50,12 +50,10 @@ class CrescendoJailbreaking(BaseAttack):def __init__(self,- model_callback: CallbackType,weight: int = 1,max_rounds: int = 10,max_backtracks: int = 10,):- self.model_callback = model_callbackself.weight = weightself.memory = MemorySystem()@@ -64,8 +62,14 @@ class CrescendoJailbreaking(BaseAttack):self.max_rounds = max_roundsself.max_backtracks = max_backtracks- def enhance(self, attack: str, simulator_model: DeepEvalBaseLLM) -> str:+ def enhance(+ self,+ attack: str,+ model_callback: CallbackType,+ simulator_model: DeepEvalBaseLLM,+ ) -> str:self.simulator_model = simulator_model+ self.model_callback = model_callbackround_num = 0backtrack_count = 0@@ -144,9 +148,13 @@ class CrescendoJailbreaking(BaseAttack):return enhanced_attackasync def a_enhance(- self, attack: str, simulator_model: DeepEvalBaseLLM+ self,+ attack: str,+ model_callback: CallbackType,+ simulator_model: DeepEvalBaseLLM,) -> str:self.simulator_model = simulator_model+ self.model_callback = model_callbackround_num = 0backtrack_count = 0diff --git a/deepteam/attacks/single_turn/prompt_injection/prompt_injection.py b/deepteam/attacks/single_turn/prompt_injection/prompt_injection.pyindex 351822cb..1189a84d 100644--- a/deepteam/attacks/single_turn/prompt_injection/prompt_injection.py+++ b/deepteam/attacks/single_turn/prompt_injection/prompt_injection.py@@ -11,7 +11,6 @@ class PromptInjection(BaseAttack):self.weight = weightdef enhance(self, attack: str) -> str:- """Enhance the attack input using prompt injection techniques."""return random.choice([PromptInjectionTemplate.enhance_1(attack),diff --git a/docs/docs/red-teaming-adversarial-attacks-base64-encoding.mdx b/docs/docs/red-teaming-adversarial-attacks-base64-encoding.mdxindex c1bdc596..3f392b93 100644--- a/docs/docs/red-teaming-adversarial-attacks-base64-encoding.mdx+++ b/docs/docs/red-teaming-adversarial-attacks-base64-encoding.mdx@@ -14,7 +14,7 @@ from deepteam.attacks.single_turn import Base64base64 = Base64()```-There are **ONE** optional parameters when creating a `Base64` attack:+There are **ONE** optional parameter when creating a `Base64` attack:- [Optional] `weight`: an integer that determines this attack method's selection probability, proportional to the total weight sum of all `attacks` during red teaming. Defaulted to `1`.diff --git a/docs/docs/red-teaming-adversarial-attacks-gray-box-attack.mdx b/docs/docs/red-teaming-adversarial-attacks-gray-box-attack.mdxindex ee1c5479..7a471d4b 100644--- a/docs/docs/red-teaming-adversarial-attacks-gray-box-attack.mdx+++ b/docs/docs/red-teaming-adversarial-attacks-gray-box-attack.mdx@@ -14,9 +14,10 @@ from deepteam.attacks.single_turn import GrayBoxgray_box = GrayBox()```-There are **ONE** optional parameters when creating a `GrayBox` attack:+There are **TWO** optional parameters when creating a `GrayBox` attack:- [Optional] `weight`: an integer that determines this attack method's selection probability, proportional to the total weight sum of all `attacks` during red teaming. Defaulted to `1`.+- [Optional] `max_retries`: an integer that specifies the number of times to retry simulating a `GrayBox` attack for any error that occurs. Defaulted to `5`.To use the `GrayBox` attack method, supply it to the `red_team()` method:diff --git a/docs/docs/red-teaming-adversarial-attacks-leetspeak.mdx b/docs/docs/red-teaming-adversarial-attacks-leetspeak.mdxindex 878f16d0..db81517c 100644--- a/docs/docs/red-teaming-adversarial-attacks-leetspeak.mdx+++ b/docs/docs/red-teaming-adversarial-attacks-leetspeak.mdx@@ -14,7 +14,7 @@ from deepteam.attacks.single_turn import Leetspeakleetspeak = Leetspeak()```-There are **ONE** optional parameters when creating a `GrayBox` attack:+There are **ONE** optional parameter when creating a `GrayBox` attack:- [Optional] `weight`: an integer that determines this attack method's selection probability, proportional to the total weight sum of all `attacks` during red teaming. Defaulted to `1`.diff --git a/docs/docs/red-teaming-adversarial-attacks-linear-jailbreaking.mdx b/docs/docs/red-teaming-adversarial-attacks-linear-jailbreaking.mdxindex 1726cf87..a3a6fac0 100644--- a/docs/docs/red-teaming-adversarial-attacks-linear-jailbreaking.mdx+++ b/docs/docs/red-teaming-adversarial-attacks-linear-jailbreaking.mdx@@ -31,7 +31,25 @@ The process continues until the attacker LLM generates a **non-compliant attack*## Usage-_to be documented..._+```python+from deepteam.attacks.multi_turn import LinearJailbreaking++linear_jailbreaking = LinearJailbreaking()+```++There are **TWO** optional parameters when creating a `LinearJailbreaking` attack:++- [Optional] `weight`: an integer that determines this attack method's selection probability, proportional to the total weight sum of all `attacks` during red teaming. Defaulted to `1`.+- [Optional] `turns`: an integer that specifies the number of turns to use in attempt to jailbreak your LLM system. Defaulted to `5`.++To use the `LinearJailbreaking` attack method, supply it to the `red_team()` method:++```python+from deepteam import red_team+...++red_team(attacks=[linear_jailbreaking], model_callback=..., vulnerabilities=...)+```## Examplediff --git a/docs/docs/red-teaming-adversarial-attacks-math-problem.mdx b/docs/docs/red-teaming-adversarial-attacks-math-problem.mdxindex 7bd9cf17..ba6cb893 100644--- a/docs/docs/red-teaming-adversarial-attacks-math-problem.mdx+++ b/docs/docs/red-teaming-adversarial-attacks-math-problem.mdx@@ -14,9 +14,10 @@ from deepteam.attacks.single_turn import MathProblemmath_problem = MathProblem()```-There are **ONE** optional parameters when creating a `MathProblem` attack:+There are **TWO** optional parameters when creating a `MathProblem` attack:- [Optional] `weight`: an integer that determines this attack method's selection probability, proportional to the total weight sum of all `attacks` during red teaming. Defaulted to `1`.+- [Optional] `max_retries`: an integer that specifies the number of times to retry simulating a `MathProblem` attack for any error that occurs. Defaulted to `5`.To use the `MathProblem` attack method, supply it to the `red_team()` method:diff --git a/docs/docs/red-teaming-adversarial-attacks-multilingual.mdx b/docs/docs/red-teaming-adversarial-attacks-multilingual.mdxindex fc34235b..0b482141 100644--- a/docs/docs/red-teaming-adversarial-attacks-multilingual.mdx+++ b/docs/docs/red-teaming-adversarial-attacks-multilingual.mdx@@ -14,9 +14,10 @@ from deepteam.attacks.single_turn import Multilingualmultilingual = Multilingual()```-There are **ONE** optional parameters when creating a `Multilingual` attack:+There are **TWO** optional parameters when creating a `Multilingual` attack:- [Optional] `weight`: an integer that determines this attack method's selection probability, proportional to the total weight sum of all `attacks` during red teaming. Defaulted to `1`.+- [Optional] `max_retries`: an integer that specifies the number of times to retry simulating a `Multilingual` attack for any error that occurs. Defaulted to `5`.To use the `Multilingual` attack method, supply it to the `red_team()` method:diff --git a/docs/docs/red-teaming-adversarial-attacks-prompt-injection.mdx b/docs/docs/red-teaming-adversarial-attacks-prompt-injection.mdxindex 48d9b537..96330157 100644--- a/docs/docs/red-teaming-adversarial-attacks-prompt-injection.mdx+++ b/docs/docs/red-teaming-adversarial-attacks-prompt-injection.mdx@@ -14,7 +14,7 @@ from deepteam.attacks.single_turn import PromptInjectionprompt_injection = PromptInjection()```-There are **ONE** optional parameters when creating a `PromptInjection` attack:+There are **ONE** optional parameter when creating a `PromptInjection` attack:- [Optional] `weight`: an integer that determines this attack method's selection probability, proportional to the total weight sum of all `attacks` during red teaming. Defaulted to `1`.diff --git a/docs/docs/red-teaming-adversarial-attacks-rot13-encoding.mdx b/docs/docs/red-teaming-adversarial-attacks-rot13-encoding.mdxindex c366202e..1a126b31 100644--- a/docs/docs/red-teaming-adversarial-attacks-rot13-encoding.mdx+++ b/docs/docs/red-teaming-adversarial-attacks-rot13-encoding.mdx@@ -14,7 +14,7 @@ from deepteam.attacks.single_turn import ROT13rot_13 = ROT13()```-There are **ONE** optional parameters when creating a `ROT13` attack:+There are **ONE** optional parameter when creating a `ROT13` attack:- [Optional] `weight`: an integer that determines this attack method's selection probability, proportional to the total weight sum of all `attacks` during red teaming. Defaulted to `1`.diff --git a/docs/docs/red-teaming-adversarial-attacks-tree-jailbreaking.mdx b/docs/docs/red-teaming-adversarial-attacks-tree-jailbreaking.mdxindex 32312840..404707e7 100644--- a/docs/docs/red-teaming-adversarial-attacks-tree-jailbreaking.mdx+++ b/docs/docs/red-teaming-adversarial-attacks-tree-jailbreaking.mdx@@ -33,7 +33,26 @@ The search continues until the most successful path is found within the specifie## Usage-_to be documented..._+```python+from deepteam.attacks.multi_turn import CrescendoJailbreaking++crescendo_jailbreaking = CrescendoJailbreaking()+```++There are **THREE** optional parameters when creating a `CrescendoJailbreaking` attack:++- [Optional] `weight`: an integer that determines this attack method's selection probability, proportional to the total weight sum of all `attacks` during red teaming. Defaulted to `1`.+- [Optional] `max_rounds`: an integer that specifies the number of rounds to use in attempt to jailbreak your LLM system. Defaulted to `10`.+- [Optional] `max_backtracks`: an integer that specifies the number of rounds to use in attempt to jailbreak your LLM system. Defaulted to `10`.++To use the `CrescendoJailbreaking` attack method, supply it to the `red_team()` method:++```python+from deepteam import red_team+...++red_team(attacks=[crescendo_jailbreaking], model_callback=..., vulnerabilities=...)+```## Example