Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 0 additions & 2 deletions build_scripts/keyword_only_baseline.txt
Original file line number Diff line number Diff line change
Expand Up @@ -100,8 +100,6 @@ pyrit.datasets.seed_datasets.seed_dataset_provider:SeedDatasetProvider.fetch_dat
pyrit.exceptions.exception_classes:_DynamicWaitRandomExponential.__init__
pyrit.exceptions.exception_classes:handle_bad_request_exception
pyrit.exceptions.exception_classes:pyrit_custom_result_retry
pyrit.executor.attack.core.attack_executor:AttackExecutor._execute_with_params_list_async.<locals>.run_one_async
pyrit.executor.attack.core.attack_executor:AttackExecutor.execute_attack_from_seed_groups_async.<locals>.build_params_async
pyrit.executor.attack.multi_turn.crescendo:CrescendoAttack._check_refusal_async
pyrit.executor.benchmark.fairness_bias:FairnessBiasBenchmark._format_experiment_results_async
pyrit.executor.core.strategy:StrategyLogAdapter.process
Expand Down
8 changes: 4 additions & 4 deletions pyrit/executor/attack/core/attack_executor.py
Original file line number Diff line number Diff line change
Expand Up @@ -330,7 +330,7 @@ async def execute_attack_from_seed_groups_async(
# This can take time if the SeedSimulatedConversation generation is included
semaphore = self._get_semaphore()

async def build_params_async(i: int, sg: AttackSeedGroup) -> AttackParameters:
async def build_params_async(*, i: int, sg: AttackSeedGroup) -> AttackParameters:
async with semaphore:
combined_overrides = dict(broadcast_fields)
if field_overrides is not None:
Expand All @@ -344,7 +344,7 @@ async def build_params_async(i: int, sg: AttackSeedGroup) -> AttackParameters:

build_results = list(
await asyncio.gather(
*[build_params_async(i, sg) for i, sg in enumerate(seed_groups)],
*[build_params_async(i=i, sg=sg) for i, sg in enumerate(seed_groups)],
return_exceptions=True,
)
)
Expand Down Expand Up @@ -504,7 +504,7 @@ async def _execute_with_params_list_async(
raise ValueError(f"{name} length ({len(values)}) must match params_list length ({len(params_list)})")
persisted_result_ids: list[str | None] = [None] * len(params_list)

async def run_one_async(index: int, params: AttackParameters) -> AttackStrategyResultT:
async def run_one_async(*, index: int, params: AttackParameters) -> AttackStrategyResultT:
async with semaphore:
context = attack._context_type(params=params)
if atomic_attack_identifiers is not None:
Expand All @@ -529,7 +529,7 @@ async def run_one_async(index: int, params: AttackParameters) -> AttackStrategyR
persisted_result_ids[index] = context._persisted_attack_result_id
self._active_contexts.pop(context_key, None)

tasks = [run_one_async(i, p) for i, p in enumerate(params_list)]
tasks = [run_one_async(index=i, params=p) for i, p in enumerate(params_list)]
# Admitting the batch's Operations once lets every objective finish if one is deleted midway.
operation_ids = {
operation_id for p in params_list if (operation_id := getattr(p, "operation_id", None)) is not None
Expand Down
Loading