|
164 | 164 | " Default Datasets (1, max 4 per dataset):\n", |
165 | 165 | " airt_malware\n", |
166 | 166 | "\u001b[1m\u001b[36m\n", |
167 | | - " foundry\u001b[0m\n", |
168 | | - " Class: FoundryScenario\n", |
| 167 | + " airt.scam\u001b[0m\n", |
| 168 | + " Class: Scam\n", |
169 | 169 | " Description:\n", |
170 | | - " Deprecated alias for Foundry. This class is deprecated and will be\n", |
171 | | - " removed in version 0.13.0. Use `Foundry` instead.\n", |
| 170 | + " Scam scenario evaluates an endpoint's ability to generate scam-related\n", |
| 171 | + " materials (e.g., phishing emails, fraudulent messages) with primarily\n", |
| 172 | + " persuasion-oriented techniques.\n", |
| 173 | + " Aggregate Strategies:\n", |
| 174 | + " - all, single_turn, multi_turn\n", |
| 175 | + " Available Strategies (3):\n", |
| 176 | + " context_compliance, role_play, persuasive_rta\n", |
| 177 | + " Default Strategy: all\n", |
| 178 | + " Default Datasets (1, max 4 per dataset):\n", |
| 179 | + " airt_scams\n", |
| 180 | + "\u001b[1m\u001b[36m\n", |
| 181 | + " foundry.red_team_agent\u001b[0m\n", |
| 182 | + " Class: RedTeamAgent\n", |
| 183 | + " Description:\n", |
| 184 | + " RedTeamAgent is a preconfigured scenario that automatically generates\n", |
| 185 | + " multiple AtomicAttack instances based on the specified attack\n", |
| 186 | + " strategies. It supports both single-turn attacks (with various\n", |
| 187 | + " converters) and multi-turn attacks (Crescendo, RedTeaming), making it\n", |
| 188 | + " easy to quickly test a target against multiple attack vectors. The\n", |
| 189 | + " scenario can expand difficulty levels (EASY, MODERATE, DIFFICULT) into\n", |
| 190 | + " their constituent attack strategies, or you can specify individual\n", |
| 191 | + " strategies directly. This scenario is designed for use with the Foundry\n", |
| 192 | + " AI Red Teaming Agent library, providing a consistent PyRIT contract for\n", |
| 193 | + " their integration.\n", |
172 | 194 | " Aggregate Strategies:\n", |
173 | 195 | " - all, easy, moderate, difficult\n", |
174 | 196 | " Available Strategies (25):\n", |
|
205 | 227 | "\n", |
206 | 228 | "================================================================================\n", |
207 | 229 | "\n", |
208 | | - "Total scenarios: 4\n" |
| 230 | + "Total scenarios: 5\n" |
209 | 231 | ] |
210 | 232 | } |
211 | 233 | ], |
|
320 | 342 | "Or concretely:\n", |
321 | 343 | "\n", |
322 | 344 | "```shell\n", |
323 | | - "!pyrit_scan foundry --initializers simple openai_objective_target --scenario-strategies base64\n", |
| 345 | + "!pyrit_scan foundry.red_team_agent --initializers simple openai_objective_target --scenario-strategies base64\n", |
324 | 346 | "```\n", |
325 | 347 | "\n", |
326 | 348 | "Example with a basic configuration that runs the Foundry scenario against the objective target defined in `openai_objective_target` (which just is an OpenAIChatTarget with `DEFAULT_OPENAI_FRONTEND_ENDPOINT` and `DEFAULT_OPENAI_FRONTEND_KEY`)." |
|
345 | 367 | "Loaded environment file: C:\\Users\\rlundeen\\.pyrit\\.env\n", |
346 | 368 | "Loaded environment file: C:\\Users\\rlundeen\\.pyrit\\.env.local\n", |
347 | 369 | "\n", |
348 | | - "Running scenario: foundry\n", |
| 370 | + "Running scenario: foundry.red_team_agent\n", |
| 371 | + "\n", |
| 372 | + "\u001b[36m====================================================================================================\u001b[0m\n", |
349 | 373 | "\n", |
350 | | - "Error: SeedGroup at index 0 is missing an objective. Use seed_group.set_objective(value) to set one.\n" |
| 374 | + "Error: 'charmap' codec can't encode character '\\U0001f4ca' in position 43: character maps to <undefined>\n" |
| 375 | + ] |
| 376 | + }, |
| 377 | + { |
| 378 | + "name": "stderr", |
| 379 | + "output_type": "stream", |
| 380 | + "text": [ |
| 381 | + "\n", |
| 382 | + "Executing RedTeamAgent: 0%| | 0/2 [00:00<?, ?attack/s]\n", |
| 383 | + "Executing RedTeamAgent: 50%|##### | 1/2 [00:07<00:07, 7.38s/attack]\n", |
| 384 | + "Executing RedTeamAgent: 100%|##########| 2/2 [00:35<00:00, 19.33s/attack]\n", |
| 385 | + "Executing RedTeamAgent: 100%|##########| 2/2 [00:35<00:00, 17.54s/attack]\n" |
351 | 386 | ] |
352 | 387 | } |
353 | 388 | ], |
354 | 389 | "source": [ |
355 | | - "!pyrit_scan foundry --initializers openai_objective_target --strategies base64" |
| 390 | + "!pyrit_scan foundry.red_team_agent --initializers openai_objective_target --strategies base64" |
356 | 391 | ] |
357 | 392 | }, |
358 | 393 | { |
|
363 | 398 | "Or with all options and multiple initializers and multiple strategies:\n", |
364 | 399 | "\n", |
365 | 400 | "```shell\n", |
366 | | - "pyrit_scan foundry --database InMemory --initializers simple objective_target objective_list --scenario-strategies easy crescendo\n", |
| 401 | + "pyrit_scan foundry.red_team_agent --database InMemory --initializers simple objective_target objective_list --scenario-strategies easy crescendo\n", |
367 | 402 | "```\n", |
368 | 403 | "\n", |
369 | 404 | "You can also override scenario execution parameters:\n", |
370 | 405 | "\n", |
371 | 406 | "```shell\n", |
372 | 407 | "# Override concurrency and retry settings\n", |
373 | | - "pyrit_scan foundry --initializers simple objective_target --max-concurrency 10 --max-retries 3\n", |
| 408 | + "pyrit_scan foundry.red_team_agent --initializers simple objective_target --max-concurrency 10 --max-retries 3\n", |
374 | 409 | "\n", |
375 | 410 | "# Add custom memory labels for tracking (must be valid JSON)\n", |
376 | | - "pyrit_scan foundry --initializers simple objective_target --memory-labels '{\"experiment\": \"test1\", \"version\": \"v2\", \"researcher\": \"alice\"}'\n", |
| 411 | + "pyrit_scan foundry.red_team_agent --initializers simple objective_target --memory-labels '{\"experiment\": \"test1\", \"version\": \"v2\", \"researcher\": \"alice\"}'\n", |
377 | 412 | "```\n", |
378 | 413 | "\n", |
379 | 414 | "Available CLI parameter overrides:\n", |
|
384 | 419 | "You can also use custom initialization scripts by passing file paths. It is relative to your current working directory, but to avoid confusion, full paths are always better:\n", |
385 | 420 | "\n", |
386 | 421 | "```shell\n", |
387 | | - "pyrit_scan encoding_scenario --initialization-scripts ./my_custom_config.py\n", |
| 422 | + "pyrit_scan garak.encoding --initialization-scripts ./my_custom_config.py\n", |
388 | 423 | "```" |
389 | 424 | ] |
390 | 425 | }, |
|
418 | 453 | { |
419 | 454 | "data": { |
420 | 455 | "text/plain": [ |
421 | | - "<__main__.MyCustomScenario at 0x19e7c2a70e0>" |
| 456 | + "<__main__.MyCustomScenario at 0x13c63b4c2f0>" |
422 | 457 | ] |
423 | 458 | }, |
424 | 459 | "execution_count": null, |
|
428 | 463 | ], |
429 | 464 | "source": [ |
430 | 465 | "# my_custom_scenarios.py\n", |
| 466 | + "\n", |
431 | 467 | "from pyrit.common import apply_defaults\n", |
432 | | - "from pyrit.scenario import DatasetConfiguration, Scenario\n", |
433 | | - "from pyrit.scenario.core.scenario_strategy import ScenarioStrategy\n", |
| 468 | + "from pyrit.prompt_target.openai.openai_chat_target import OpenAIChatTarget\n", |
| 469 | + "from pyrit.scenario import DatasetConfiguration, Scenario, ScenarioStrategy\n", |
| 470 | + "from pyrit.score import SelfAskRefusalScorer, TrueFalseInverterScorer\n", |
434 | 471 | "from pyrit.setup import initialize_pyrit_async\n", |
435 | 472 | "\n", |
436 | 473 | "\n", |
|
464 | 501 | " super().__init__(\n", |
465 | 502 | " name=\"My Custom Scenario\",\n", |
466 | 503 | " version=1,\n", |
| 504 | + " objective_scorer=TrueFalseInverterScorer(scorer=SelfAskRefusalScorer(chat_target=OpenAIChatTarget())),\n", |
467 | 505 | " strategy_class=MyCustomStrategy,\n", |
468 | 506 | " scenario_result_id=scenario_result_id,\n", |
469 | 507 | " )\n", |
|
0 commit comments