Skip to content

DeepTeam is a framework to red team LLMs and AI agents.

Added target purpose

penguinece01cf9c2957
diff --git a/deepteam/red_team.py b/deepteam/red_team.py
index a4d6101a..81b80974 100644
--- a/deepteam/red_team.py
+++ b/deepteam/red_team.py
@@ -1,4 +1,4 @@
-from typing import List
+from typing import List, Optional
from deepteam.vulnerabilities import BaseVulnerability
from deepteam.attacks import BaseAttack
@@ -14,10 +14,12 @@ def red_team(
ignore_errors: bool = False,
run_async: bool = True,
max_concurrent: int = 10,
+ target_purpose: Optional[str] = None,
):
red_teamer = RedTeamer(
async_mode=run_async,
max_concurrent=max_concurrent,
+ target_purpose=target_purpose,
)
risk_assessment = red_teamer.red_team(
model_callback=model_callback,
diff --git a/docs/docs/red-teaming-introduction.mdx b/docs/docs/red-teaming-introduction.mdx
index bd7dbae4..e13638b1 100644
--- a/docs/docs/red-teaming-introduction.mdx
+++ b/docs/docs/red-teaming-introduction.mdx
@@ -397,7 +397,7 @@ prompt_injection = PromptInjection()
risk_assessment = red_team(model_callback=model_callback, vulnerabilities=[bias], attacks=[prompt_injection])
```
-There are **THREE** mandatory and **FOUR** optional arguments when calling the `red_team()` function:
+There are **THREE** mandatory and **FIVE** optional arguments when calling the `red_team()` function:
- `model_callback`: a callback of type `Callable[[str], str]` that wraps around the target LLM system you wish to red team.
- `vulnerabilities`: a list of type `BaseVulnerability`s that determines the weaknesses to detect for.
@@ -406,6 +406,7 @@ There are **THREE** mandatory and **FOUR** optional arguments when calling the `
- [Optional] `ignore_errors`: a boolean which when set to `True`, ignores all exceptions raised during red teaming. Defaulted to `False`.
- [Optional] `run_async`: a boolean which when set to `True`, enables concurrent red teaming on all vulnerabilities, attacks, generations, **AND** evaluations. Defaulted to `True`.
- [Optional] `max_concurrent`: an integer that determines the maximum number of coroutines that can be ran in parallel. You can decrease this value if your models are running into rate limit errors. Defaulted to `10`.
+- [Optional] `target_purpose`: a string specifying your target LLM application's intended purpose. This affects the passing and failing of simulated attacks that are evaluated. Defaulted to `None`.
Don't forget to save the results (or at least print it):
@@ -435,8 +436,9 @@ from deepteam.red_teaming import RedTeamer
red_teamer = RedTeamer()
```
-There are **THREE** optional parameters when creating a `RedTeamer`:
+There are **FIVE** optional parameters when creating a `RedTeamer`:
+- [Optional] `target_purpose`: a string specifying your target LLM application's intended purpose. This affects the passing and failing of simulated attacks that are evaluated. Defaulted to `None`.
- [Optional] `simulator_model`: a string specifying which of OpenAI's GPT models to use, **OR** [any custom LLM model](https://docs.confident-ai.comhttps://docs.confident-ai.com/guides/guides-using-custom-llms) of type `DeepEvalBaseLLM` for simulating attacks. Defaulted to `"gpt-3.5-turbo-0125"`.
- [Optional] `evaluation_model`: a string specifying which of OpenAI's GPT models to use, **OR** [any custom LLM model](https://docs.confident-ai.comhttps://docs.confident-ai.com/guides/guides-using-custom-llms) of type `DeepEvalBaseLLM` for evaluation. Defaulted to `"gpt-4o"`.
- [Optional] `async_mode`: a boolean specifying whether to enable async mode. Defaulted to `True`.