diff --git a/build_scripts/keyword_only_baseline.txt b/build_scripts/keyword_only_baseline.txt index c6b8ac5003..0ea8249b94 100644 --- a/build_scripts/keyword_only_baseline.txt +++ b/build_scripts/keyword_only_baseline.txt @@ -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..run_one_async -pyrit.executor.attack.core.attack_executor:AttackExecutor.execute_attack_from_seed_groups_async..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 diff --git a/pyrit/executor/attack/core/attack_executor.py b/pyrit/executor/attack/core/attack_executor.py index db8a7d88c4..98b873b02c 100644 --- a/pyrit/executor/attack/core/attack_executor.py +++ b/pyrit/executor/attack/core/attack_executor.py @@ -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: @@ -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, ) ) @@ -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: @@ -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