DeepTeam is a framework to red team LLMs and AI agents.
lint
A-Vamshi6a42be833304
diff --git a/deepteam/frameworks/mitre/mitre.py b/deepteam/frameworks/mitre/mitre.pyindex 92c53f5b..f3b1b8f0 100644--- a/deepteam/frameworks/mitre/mitre.py+++ b/deepteam/frameworks/mitre/mitre.py@@ -141,7 +141,7 @@ class MITRE(AISafetyFramework):name="CommandAndControl",criteria="Detect covert signaling or stateful control channels through model outputs or agents.",types=["covert_channel", "stateful_signal"],- )+ ),],"initial_access": [DebugAccess(diff --git a/tests/test_core/test_frameworks/test_aegis.py b/tests/test_core/test_frameworks/test_aegis.pyindex 74860258..1c324425 100644--- a/tests/test_core/test_frameworks/test_aegis.py+++ b/tests/test_core/test_frameworks/test_aegis.py@@ -18,7 +18,10 @@ class TestAegis:def test_aegis_description(self):"""Test that Aegis framework has correct description."""framework = Aegis()- assert framework.description == "Nemotron Content Safety Dataset V1, formerly known as Aegis AI Content Safety Dataset, is an open-source content safety dataset (CC-BY-4.0), which adheres to Nvidia's content safety taxonomy, covering 13 critical risk categories"+ assert (+ framework.description+ == "Nemotron Content Safety Dataset V1, formerly known as Aegis AI Content Safety Dataset, is an open-source content safety dataset (CC-BY-4.0), which adheres to Nvidia's content safety taxonomy, covering 13 critical risk categories"+ )def test_aegis_red_team(self):"""Test that Aegis framework can be used with red_team function."""@@ -53,4 +56,4 @@ class TestAegis:ignore_errors=True,)- assert risk_assessment is not None\ No newline at end of file+ assert risk_assessment is not Nonediff --git a/tests/test_core/test_frameworks/test_beavertails.py b/tests/test_core/test_frameworks/test_beavertails.pyindex 9e4895fd..5ee3f914 100644--- a/tests/test_core/test_frameworks/test_beavertails.py+++ b/tests/test_core/test_frameworks/test_beavertails.py@@ -18,7 +18,10 @@ class TestBeaverTails:def test_beavertails_description(self):"""Test that BeaverTails framework has correct description."""framework = BeaverTails()- assert framework.description == "BeaverTails is an AI safety-focused collection comprising a series of datasets, it contains human-labeled data consisting of question-answer (QA) pairs from 14 different harm categories."+ assert (+ framework.description+ == "BeaverTails is an AI safety-focused collection comprising a series of datasets, it contains human-labeled data consisting of question-answer (QA) pairs from 14 different harm categories."+ )def test_beavertails_red_team(self):"""Test that BeaverTails framework can be used with red_team function."""@@ -53,4 +56,4 @@ class TestBeaverTails:ignore_errors=True,)- assert risk_assessment is not None\ No newline at end of file+ assert risk_assessment is not Nonediff --git a/tests/test_core/test_frameworks/test_mitre.py b/tests/test_core/test_frameworks/test_mitre.pyindex 23f33092..df63a365 100644--- a/tests/test_core/test_frameworks/test_mitre.py+++ b/tests/test_core/test_frameworks/test_mitre.py@@ -20,7 +20,10 @@ class TestMITRE:def test_mitre_description(self):"""Test that MITRE ATLAS framework has correct description."""framework = MITRE()- assert framework.description == "MITRE ATLAS mapping for LLM/ML adversarial techniques (project-specific) to understand and defend against threats specific to AI and ML systems."+ assert (+ framework.description+ == "MITRE ATLAS mapping for LLM/ML adversarial techniques (project-specific) to understand and defend against threats specific to AI and ML systems."+ )def test_mitre_default_categories(self):"""Test that all six MITRE categories are included by default."""@@ -116,7 +119,9 @@ class TestMITRE:"RecursiveHijacking",]for name in expected_vulns:- assert name in vuln_names, f"Expected vulnerability {name} not found"+ assert (+ name in vuln_names+ ), f"Expected vulnerability {name} not found"def test_mitre_attack_names_present(self):"""Test that key MITRE attacks are present."""@@ -155,6 +160,7 @@ class TestMITRE:import random"""Test MITRE ATLAS integration with red_team pipeline."""+def mock_model_callback(prompt: str, turns=None) -> str:return "This request violates internal policy."diff --git a/tests/test_core/test_frameworks/test_nist.py b/tests/test_core/test_frameworks/test_nist.pyindex 2537c499..a5e2ac25 100644--- a/tests/test_core/test_frameworks/test_nist.py+++ b/tests/test_core/test_frameworks/test_nist.py@@ -4,6 +4,7 @@ from deepteam.vulnerabilities import BaseVulnerabilityfrom deepteam.attacks import BaseAttackfrom deepteam import red_team+class TestNIST:def test_nist_init(self):@@ -19,7 +20,10 @@ class TestNIST:def test_nist_description(self):"""Test that NIST framework has correct description."""framework = NIST()- assert framework.description == "NIST AI Risk Management Framework (AI RMF) — Measure-focused mapping for testing and evaluation."+ assert (+ framework.description+ == "NIST AI Risk Management Framework (AI RMF) — Measure-focused mapping for testing and evaluation."+ )def test_nist_default_categories(self):"""Test that all four measure categories are included by default."""@@ -153,25 +157,34 @@ class TestNIST:def test_partial_category_reduces_vulnerabilities(self):"""Test that selecting fewer categories reduces vulnerabilities."""all_vulns = len(NIST().vulnerabilities)- partial_vulns = len(NIST(categories=["measure_1", "measure_2"]).vulnerabilities)+ partial_vulns = len(+ NIST(categories=["measure_1", "measure_2"]).vulnerabilities+ )assert partial_vulns < all_vulnsdef test_partial_category_reduces_attacks(self):"""Test that selecting fewer categories reduces attacks."""all_attacks = len(NIST().attacks)- partial_attacks = len(NIST(categories=["measure_1", "measure_2"]).attacks)+ partial_attacks = len(+ NIST(categories=["measure_1", "measure_2"]).attacks+ )assert partial_attacks < all_attacksdef test_nist_framework_with_red_team(self):import random+"""Test that NIST framework integrates correctly with red_team function."""# Simple mock model for testingdef mock_model_callback(prompt: str, turns=None) -> str:- return "I'm a safe AI model. I cannot comply with unsafe instructions."-+ return (+ "I'm a safe AI model. I cannot comply with unsafe instructions."+ )+categories = ["measure_1", "measure_2", "measure_3", "measure_4"]- random_category = random.choice(categories) # Randomizing to not test on too many attacks or vulnerabilities+ random_category = random.choice(+ categories+ ) # Randomizing to not test on too many attacks or vulnerabilitiesrisk_assessment = red_team(model_callback=mock_model_callback,@@ -181,4 +194,3 @@ class TestNIST:)assert risk_assessment is not None-diff --git a/tests/test_core/test_frameworks/test_owasp_top_10.py b/tests/test_core/test_frameworks/test_owasp_top_10.pyindex 168c4091..5598d411 100644--- a/tests/test_core/test_frameworks/test_owasp_top_10.py+++ b/tests/test_core/test_frameworks/test_owasp_top_10.py@@ -4,6 +4,7 @@ from deepteam.vulnerabilities import BaseVulnerabilityfrom deepteam.attacks import BaseAttackfrom deepteam import red_team+class TestOWASPTop10:def test_owasp_top_10_init(self):