|
155 | 155 | "cell_type": "markdown", |
156 | 156 | "id": "3", |
157 | 157 | "metadata": {}, |
| 158 | + "source": [ |
| 159 | + "## Target and dataset requirements\n", |
| 160 | + "\n", |
| 161 | + "Declare `TechniqueRequirements` on a factory. The attack class's `TARGET_REQUIREMENTS` also apply.\n", |
| 162 | + "\n", |
| 163 | + "```python\n", |
| 164 | + "from pyrit.executor.attack import PromptSendingAttack\n", |
| 165 | + "from pyrit.models import SeedGroupRequirements\n", |
| 166 | + "from pyrit.prompt_target import CapabilityName, TargetRequirements\n", |
| 167 | + "from pyrit.scenario import AttackTechniqueFactory, TechniqueRequirements\n", |
| 168 | + "\n", |
| 169 | + "factory = AttackTechniqueFactory(\n", |
| 170 | + " name=\"native_history\",\n", |
| 171 | + " attack_class=PromptSendingAttack,\n", |
| 172 | + " requirements=TechniqueRequirements(\n", |
| 173 | + " objective_target=TargetRequirements(native_required=frozenset({CapabilityName.MULTI_TURN})),\n", |
| 174 | + " seed_group=SeedGroupRequirements(objective_only=True),\n", |
| 175 | + " ),\n", |
| 176 | + ")\n", |
| 177 | + "```\n", |
| 178 | + "\n", |
| 179 | + "| Requirement | Behavior |\n", |
| 180 | + "|-------------|----------|\n", |
| 181 | + "| `required` | Native target support, or an `ADAPT` policy with a configured adapter. |\n", |
| 182 | + "| `native_required` | Native target support only. |\n", |
| 183 | + "| `objective_only=True` | Only the objective before technique seeds are added. |\n", |
| 184 | + "| `objective_only=True, try_adapt=True` | Permit removal of extra dataset seeds from an execution copy. |\n", |
| 185 | + "\n", |
| 186 | + "Required modality combinations must be supported together. Simulated-conversation factories\n", |
| 187 | + "default to objective-only input. Source groups stay unchanged; applied adaptation is recorded\n", |
| 188 | + "in result metadata.\n", |
| 189 | + "\n", |
| 190 | + "Incompatible inputs raise `IncompatibleTechniqueError`. Scenarios can\n", |
| 191 | + "[skip them](./1_common_scenario_parameters.ipynb#incompatible-techniques).\n", |
| 192 | + "Changes to requirements or permitted adaptation can prevent older runs from resuming." |
| 193 | + ] |
| 194 | + }, |
| 195 | + { |
| 196 | + "cell_type": "markdown", |
| 197 | + "id": "4", |
| 198 | + "metadata": {}, |
158 | 199 | "source": [ |
159 | 200 | "## Executing a single technique\n", |
160 | 201 | "\n", |
|
176 | 217 | { |
177 | 218 | "cell_type": "code", |
178 | 219 | "execution_count": null, |
179 | | - "id": "4", |
| 220 | + "id": "5", |
180 | 221 | "metadata": {}, |
181 | 222 | "outputs": [ |
182 | 223 | { |
|
595 | 636 | }, |
596 | 637 | { |
597 | 638 | "cell_type": "markdown", |
598 | | - "id": "5", |
| 639 | + "id": "6", |
599 | 640 | "metadata": {}, |
600 | 641 | "source": [ |
601 | 642 | "## How techniques are selected\n", |
|
619 | 660 | }, |
620 | 661 | { |
621 | 662 | "cell_type": "markdown", |
622 | | - "id": "6", |
| 663 | + "id": "7", |
623 | 664 | "metadata": { |
624 | 665 | "class": "col-page-right" |
625 | 666 | }, |
|
637 | 678 | }, |
638 | 679 | { |
639 | 680 | "cell_type": "markdown", |
640 | | - "id": "7", |
| 681 | + "id": "8", |
641 | 682 | "metadata": {}, |
642 | 683 | "source": [ |
643 | 684 | "## Relationship to single-turn attacks\n", |
|
0 commit comments