File tree Expand file tree Collapse file tree
src/strands_evals/redteam Expand file tree Collapse file tree Original file line number Diff line number Diff line change 88import logging
99import random
1010from collections .abc import Callable
11+ from typing import cast
1112
1213from pydantic import BaseModel , Field
1314from strands import Agent
@@ -85,7 +86,8 @@ def _generate_attack_goals(
8586 )
8687 agent = Agent (model = model , callback_handler = None )
8788 result = agent (prompt , structured_output_model = _AttackGoals )
88- return {g .attack_type : g for g in result .structured_output .goals }
89+ goals = cast (_AttackGoals , result .structured_output )
90+ return {g .attack_type : g for g in goals .goals }
8991
9092
9193def generate_cases (
@@ -217,7 +219,7 @@ def task_fn(case: Case) -> dict:
217219 max_turns = max_turns ,
218220 )
219221
220- conversation = []
222+ conversation : list [ dict [ str , str ]] = []
221223 attacker_message = case .input
222224
223225 while simulator .has_next ():
You can’t perform that action at this time.
0 commit comments