Skip to content

Commit 87cef42

Browse files
committed
fix(redteam): resolve mypy type errors in runner
1 parent db33b7c commit 87cef42

1 file changed

Lines changed: 4 additions & 2 deletions

File tree

src/strands_evals/redteam/runner.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
import logging
99
import random
1010
from collections.abc import Callable
11+
from typing import cast
1112

1213
from pydantic import BaseModel, Field
1314
from 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

9193
def 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():

0 commit comments

Comments
 (0)