Skip to content

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

Add CLI argument and config file option for specifying folder location to save assessment results

fullmetalcache2ab9bfc8ccbe
diff --git a/README.md b/README.md
index ed82609b..0a9d863b 100644
--- a/README.md
+++ b/README.md
@@ -158,6 +158,7 @@ deepteam run config.yaml -c 20 -a 5
**Options:**
- `-c, --max-concurrent`: Maximum concurrent operations (overrides config)
- `-a, --attacks-per-vuln`: Number of attacks per vulnerability type (overrides config)
+- `-o, --output`: Path to the output folder for saving risk assessment results (overrides config)
Use `deepteam --help` to see all available commands and options.
@@ -213,6 +214,7 @@ system_config:
attacks_per_vulnerability_type: 3
run_async: true
ignore_errors: false
+ output_folder: "results"
default_vulnerabilities:
- name: "Bias"
diff --git a/deepteam/cli/main.py b/deepteam/cli/main.py
index 42f4bc9a..4e721ab2 100644
--- a/deepteam/cli/main.py
+++ b/deepteam/cli/main.py
@@ -168,6 +168,12 @@ def run(
"--attacks-per-vuln",
help="Number of attacks per vulnerability type (overrides config)",
),
+ output_folder: str = typer.Option(
+ None,
+ "-o",
+ "--output",
+ help="Path to the output folder for saving risk assessment results (overrides config)",
+ ),
):
"""Run a red teaming execution based on a YAML configuration"""
cfg = _load_config(config_file)
@@ -193,6 +199,11 @@ def run(
if attacks_per_vuln is not None
else system_config.get("attacks_per_vulnerability_type", 1)
)
+ final_output_folder = (
+ output_folder
+ if output_folder is not None
+ else system_config.get("output_folder", None)
+ )
# Parse target configuration
target_cfg = cfg.get("target", {})
@@ -254,6 +265,11 @@ def run(
)
red_teamer._print_risk_assessment()
+
+ # Save risk assessment if output folder is specified
+ if final_output_folder:
+ red_teamer.risk_assessment.save(to=final_output_folder)
+
return risk
diff --git a/examples/example_config.yaml b/examples/example_config.yaml
index 0b06a151..ee07738e 100644
--- a/examples/example_config.yaml
+++ b/examples/example_config.yaml
@@ -41,6 +41,7 @@ system_config:
attacks_per_vulnerability_type: 3 # Number of attacks per vulnerability type
run_async: true # Whether to run operations asynchronously
ignore_errors: false # Whether to continue on errors
+ output_folder: "results" # Folder to save results
# Vulnerabilities to test
default_vulnerabilities: