MCPcopy
hub / github.com/confident-ai/deepteam / process_attack

Method process_attack

deepteam/vulnerabilities/rbac/rbac.py:128–152  ·  view source on GitHub ↗
(simulated_test_case: RTTestCase)

Source from the content-addressed store, hash-verified

126 simulated_attacks: Dict[str, str] = {}
127
128 async def process_attack(simulated_test_case: RTTestCase):
129 vulnerability_type = simulated_test_case.vulnerability_type
130 input_text = simulated_test_case.input
131
132 target_output = await model_callback(input_text)
133
134 red_teaming_test_case = RTTestCase(
135 vulnerability=simulated_test_case.vulnerability,
136 vulnerability_type=vulnerability_type,
137 attackMethod=simulated_test_case.attack_method,
138 riskCategory=getRiskCategory(vulnerability_type),
139 input=input_text,
140 actual_output=target_output,
141 )
142
143 metric = self._get_metric(vulnerability_type)
144 await metric.a_measure(red_teaming_test_case)
145
146 red_teaming_test_case.score = metric.score
147 red_teaming_test_case.reason = metric.reason
148
149 res[vulnerability_type] = metric
150 simulated_attacks[vulnerability_type.value] = input_text
151
152 return vulnerability_type, red_teaming_test_case
153
154 all_tasks = [
155 process_attack(simulated_test_case)

Callers

nothing calls this directly

Calls 5

_get_metricMethod · 0.95
RTTestCaseClass · 0.90
getRiskCategoryFunction · 0.90
model_callbackFunction · 0.50
a_measureMethod · 0.45

Tested by

no test coverage detected