Skip to content

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.py
index 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_callback
self.weight = weight
self.memory = MemorySystem()
@@ -64,8 +62,14 @@ class CrescendoJailbreaking(BaseAttack):
self.max_rounds = max_rounds
self.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_callback
round_num = 0
backtrack_count = 0
@@ -144,9 +148,13 @@ class CrescendoJailbreaking(BaseAttack):
return enhanced_attack
async 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_callback
round_num = 0
backtrack_count = 0
diff --git a/deepteam/attacks/single_turn/prompt_injection/prompt_injection.py b/deepteam/attacks/single_turn/prompt_injection/prompt_injection.py
index 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 = weight
def 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.mdx
index 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 Base64
base64 = 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.mdx
index 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 GrayBox
gray_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.mdx
index 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 Leetspeak
leetspeak = 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.mdx
index 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=...)
+```
## Example
diff --git a/docs/docs/red-teaming-adversarial-attacks-math-problem.mdx b/docs/docs/red-teaming-adversarial-attacks-math-problem.mdx
index 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 MathProblem
math_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.mdx
index 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 Multilingual
multilingual = 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.mdx
index 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 PromptInjection
prompt_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.mdx
index 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 ROT13
rot_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.mdx
index 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