|
114 | 114 | "source": [ |
115 | 115 | "## Simple Example\n", |
116 | 116 | "\n", |
117 | | - "This section goes into each of the three steps mentioned earlier. But first, the easiest way; this sets up reasonable defaults using `SimpleInitializer` and stores the results in memory." |
| 117 | + "This section goes into each of the three steps mentioned earlier. But first, the easiest way; this sets up reasonable defaults using `TargetInitializer` and `ScorerInitializer` and stores the results in memory." |
118 | 118 | ] |
119 | 119 | }, |
120 | 120 | { |
|
138 | 138 | "# E.g. you can put it in .env\n", |
139 | 139 | "\n", |
140 | 140 | "from pyrit.setup import initialize_pyrit_async\n", |
141 | | - "from pyrit.setup.initializers import SimpleInitializer\n", |
| 141 | + "from pyrit.setup.initializers import ScorerInitializer, TargetInitializer\n", |
142 | 142 | "\n", |
143 | | - "await initialize_pyrit_async(memory_db_type=\"InMemory\", initializers=[SimpleInitializer()]) # type: ignore\n", |
| 143 | + "await initialize_pyrit_async(memory_db_type=\"InMemory\", initializers=[TargetInitializer(), ScorerInitializer()]) # type: ignore\n", |
144 | 144 | "\n", |
145 | 145 | "# Now you can run most of our notebooks! Just remove any os.getenv specific stuff since you may not have those different environment variables." |
146 | 146 | ] |
|
505 | 505 | ")\n", |
506 | 506 | "from pyrit.prompt_target import OpenAIChatTarget\n", |
507 | 507 | "from pyrit.setup import initialize_pyrit_async\n", |
508 | | - "from pyrit.setup.initializers import SimpleInitializer\n", |
| 508 | + "from pyrit.setup.initializers import ScorerInitializer, TargetInitializer\n", |
509 | 509 | "\n", |
510 | | - "# This is a way to include the SimpleInitializer class directly\n", |
511 | | - "await initialize_pyrit_async(memory_db_type=\"InMemory\", initializers=[SimpleInitializer()]) # type: ignore\n", |
| 510 | + "# This is a way to include the initializer classes directly\n", |
| 511 | + "await initialize_pyrit_async(memory_db_type=\"InMemory\", initializers=[TargetInitializer(), ScorerInitializer()]) # type: ignore\n", |
512 | 512 | "\n", |
513 | | - "# Alternative approach - you can pass the path to the initializer class.\n", |
514 | | - "# This is how you provide your own file not part of the repo that defines a PyRITInitializer class\n", |
515 | | - "# This is equivalent to loading the class directly as above\n", |
| 513 | + "# Alternative approach - you can pass the path to a file that defines PyRITInitializer classes.\n", |
| 514 | + "# This is how you provide your own file not part of the repo. Here we point at the built-in\n", |
| 515 | + "# targets module, which defines TargetInitializer.\n", |
516 | 516 | "await initialize_pyrit_async(\n", |
517 | | - " memory_db_type=\"InMemory\", initialization_scripts=[f\"{PYRIT_PATH}/setup/initializers/simple.py\"]\n", |
| 517 | + " memory_db_type=\"InMemory\", initialization_scripts=[f\"{PYRIT_PATH}/setup/initializers/targets.py\"]\n", |
518 | 518 | ") # type: ignore\n", |
519 | 519 | "\n", |
520 | | - "# SimpleInitializer is a class that initializes sensible defaults for someone who only has OPENAI_CHAT_ENDPOINT, OPENAI_CHAT_MODEL, and OPENAI_CHAT_KEY configured\n", |
521 | | - "# It is meant to only require these two env vars to be configured\n", |
522 | | - "# It can easily be swapped for another PyRITInitializer, like AIRTInitializer which is better but requires more env configuration\n", |
| 520 | + "# TargetInitializer registers sensible default targets for someone who only has OPENAI_CHAT_ENDPOINT, OPENAI_CHAT_MODEL, and OPENAI_CHAT_KEY configured\n", |
| 521 | + "# It can easily be combined with other PyRITInitializers (like ScorerInitializer) for a fuller setup\n", |
523 | 522 | "# get_info_async() is a class method that shows how this initializer configures defaults and what global variables it sets\n", |
524 | | - "info = await SimpleInitializer.get_info_async() # type: ignore\n", |
| 523 | + "info = await TargetInitializer.get_info_async() # type: ignore\n", |
525 | 524 | "for key, value in info.items():\n", |
526 | 525 | " print(f\"{key}: {value}\")\n", |
527 | 526 | "\n", |
|
0 commit comments