Skip to content

Commit bdc93eb

Browse files
authored
Merge branch 'main' into fix/initializer-catalog-unavailable
2 parents d291d77 + d5f7347 commit bdc93eb

266 files changed

Lines changed: 18902 additions & 3969 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.env_example

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -83,11 +83,22 @@ AZURE_OPENAI_GPT4O_UNSAFE_CHAT_KEY2="xxxxx"
8383
AZURE_OPENAI_GPT4O_UNSAFE_CHAT_MODEL2="deployment-name"
8484
AZURE_OPENAI_GPT4O_UNSAFE_CHAT_UNDERLYING_MODEL2=""
8585

86-
# Adversarial chat target (used by scenario attack techniques, e.g. role-play, TAP)
87-
# Default endpoint goes here; specialized ones below
86+
# Adversarial chat targets (used by scenario attack techniques, e.g. role-play, TAP).
87+
# When multiple numbered endpoints are configured, adversarial_chat uses them in a round-robin.
8888
ADVERSARIAL_CHAT_ENDPOINT="https://xxxxx.openai.azure.com/openai/v1"
8989
ADVERSARIAL_CHAT_KEY="xxxxx"
9090
ADVERSARIAL_CHAT_MODEL="deployment-name"
91+
ADVERSARIAL_CHAT_UNDERLYING_MODEL=""
92+
93+
ADVERSARIAL_CHAT_ENDPOINT2="https://xxxxx.openai.azure.com/openai/v1"
94+
ADVERSARIAL_CHAT_KEY2="xxxxx"
95+
ADVERSARIAL_CHAT_MODEL2="deployment-name"
96+
ADVERSARIAL_CHAT_UNDERLYING_MODEL2=""
97+
98+
ADVERSARIAL_CHAT_ENDPOINT3="https://xxxxx.openai.azure.com/openai/v1"
99+
ADVERSARIAL_CHAT_KEY3="xxxxx"
100+
ADVERSARIAL_CHAT_MODEL3="deployment-name"
101+
ADVERSARIAL_CHAT_UNDERLYING_MODEL3=""
91102

92103
ADVERSARIAL_CHAT_SINGLETURN_ENDPOINT="https://xxxxxx.westus3.inference.ml.azure.com/score"
93104
ADVERSARIAL_CHAT_SINGLETURN_KEY="xxxxx"

.github/instructions/style-guide.instructions.md

Lines changed: 16 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -175,14 +175,22 @@ paths stay fast.
175175

176176
### Lazy `__init__.py` Exports (PEP 562)
177177

178-
Public API packages (`pyrit.prompt_target`, `pyrit.converter`, `pyrit.score`)
179-
use `__getattr__`-based lazy loading so heavy symbols can be imported from the
180-
package without paying the cost at package load time. See
181-
`pyrit/prompt_target/__init__.py` for the canonical example. Rules:
182-
183-
- Lazy names must remain in `__all__` and have a `TYPE_CHECKING` import for IDE support.
184-
- Internal utility packages (e.g., `pyrit.common`) simply omit heavy submodules
185-
from `__init__.py` — consumers import directly from the specific file.
178+
Public API packages use `__getattr__`-based lazy loading so package imports do
179+
not load every implementation module. Use `pyrit.common.lazy_imports` and follow
180+
the standard contract:
181+
182+
- Add each public export to `_LAZY_EXPORTS`, which is the runtime source of truth.
183+
- Use a module string when the public and source attribute names match. Use the
184+
tuple form only for aliases or module-valued exports.
185+
- Set `__all__ = list(_LAZY_EXPORTS)`.
186+
- Put every public export under `if TYPE_CHECKING:` for editor and static-analysis support.
187+
- Implement `__getattr__` with `resolve_lazy_export` and `__dir__` with `get_lazy_dir`.
188+
- Do not add eager implementation imports to package initializers.
189+
190+
The package contract tests in `tests/unit/common/test_lazy_package_imports.py`
191+
enforce these rules. Internal heavy submodules that are not public exports
192+
should remain omitted from `__init__.py`; consumers import them from the
193+
specific module.
186194

187195
### Import Paths
188196

.github/workflows/docs.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ jobs:
9393
- name: Checkout ${{ matrix.ref }}
9494
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
9595
with:
96-
ref: ${{ matrix.ref }}
96+
ref: ${{ github.event_name == 'pull_request' && matrix.slug == 'latest' && github.event.pull_request.head.sha || matrix.ref }}
9797

9898
- name: Resolve commit SHA
9999
# matrix.ref is a branch name (e.g. "releases/v0.13.0") that can move,

build_scripts/gen_api_md.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -689,7 +689,12 @@ def collect_top_level_modules(api_json_dir: Path) -> list[dict]:
689689
modules: list[dict] = []
690690
for jf in sorted(api_json_dir.glob("*.json")):
691691
data = json.loads(jf.read_text(encoding="utf-8"))
692-
modules.extend(_expand_module(data))
692+
if jf.stem.endswith("_all"):
693+
submodules = [member for member in data.get("members", []) if member.get("kind") == "module"]
694+
for submodule in submodules:
695+
modules.extend(_expand_module(submodule))
696+
else:
697+
modules.extend(_expand_module(data))
693698

694699
# Drop excluded and empty modules
695700
return [

doc/bibliography.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,6 @@ All academic papers, research blogs, and technical reports referenced throughout
55
:::{dropdown} Citation Keys
66
:class: hidden-citations
77

8-
[@aakanksha2024multilingual; @adversaai2023universal; @andriushchenko2024tense; @anthropic2024manyshot; @aqrawi2024singleturncrescendo; @atr2026; @bethany2024mathprompt; @bhardwaj2023harmfulqa; @bhardwaj2024homer; @boucher2023trojan; @brahman2024coconot; @bryan2025agentictaxonomy; @bullwinkel2025airtlessons; @bullwinkel2025repeng; @bullwinkel2026trigger; @chao2023pair; @chao2024jailbreakbench; @choi2026xlsafetybench; @cui2024orbench; @darkbench2025; @derczynski2024garak; @ding2023wolf; @embracethered2024unicode; @embracethered2025sneakybits; @gehman2020realtoxicityprompts; @ghosh2025aegis; @ghosh2025ailuminate; @gong2025figstep; @gupta2024walledeval; @haider2024phi3safety; @han2024medsafetybench; @han2024wildguard; @hiddenlayer2025policypuppetry; @hines2024spotlighting; @inie2025summon; @ji2023beavertails; @ji2024pkusaferlhf; @jiang2025sosbench; @jones2025computeruse; @kingma2014adam; @li2024drattack; @li2024mossbench; @li2024saladbench; @li2024wmdp; @lin2023toxicchat; @liu2024flipattack; @liu2024mmsafetybench; @lopez2024pyrit; @luo2024jailbreakv; @lv2024codechameleon; @mazeika2023tdc; @mazeika2024harmbench; @mckee2024transparency; @mehrotra2023tap; @microsoft2024skeletonkey; @odin2024; @palaskar2025vlsu; @pfohl2024equitymedqa; @promptfoo2025ccp; @robustintelligence2024bypass; @roccia2024promptintel; @rottger2023xstest; @rottger2025msts; @russinovich2024crescendo; @russinovich2025cca; @russinovich2025price; @scheuerman2025transphobia; @shaikh2022second; @shayegani2025computeruse; @shen2023donotanything; @sheshadri2024lat; @souly2024strongreject; @stok2023ansi; @tan2026comicjailbreak; @tang2025multilingual; @tedeschi2024alert; @vantaylor2024socialbias; @vidgen2023simplesafetytests; @wang2023decodingtrust; @wang2023donotanswer; @wang2025siuo; @wang2026visualleakbench; @wei2023jailbroken; @xie2024sorrybench; @yu2023gptfuzzer; @yuan2023cipherchat; @zeng2024persuasion; @zeng2024shieldgemma; @zhang2024cbtbench; @ziems2022mic; @zong2024vlguard; @zou2023gcg]
8+
[@aakanksha2024multilingual; @adversaai2023universal; @andriushchenko2024tense; @anthropic2024manyshot; @aqrawi2024singleturncrescendo; @atr2026; @bethany2024mathprompt; @bhardwaj2023harmfulqa; @bhardwaj2024homer; @boucher2023trojan; @brahman2024coconot; @bryan2025agentictaxonomy; @bullwinkel2025airtlessons; @bullwinkel2025repeng; @bullwinkel2026trigger; @chao2023pair; @chao2024jailbreakbench; @choi2026xlsafetybench; @cui2024orbench; @darkbench2025; @derczynski2024garak; @ding2023wolf; @embracethered2024unicode; @embracethered2025sneakybits; @gehman2020realtoxicityprompts; @ghosh2025aegis; @ghosh2025ailuminate; @gong2025figstep; @gupta2024walledeval; @haider2024phi3safety; @han2024medsafetybench; @han2024wildguard; @hiddenlayer2025policypuppetry; @hines2024spotlighting; @inie2025summon; @ji2023beavertails; @ji2024pkusaferlhf; @jiang2025sosbench; @jones2025computeruse; @kingma2014adam; @li2024drattack; @li2024mossbench; @li2024saladbench; @li2024wmdp; @lin2023toxicchat; @liu2024flipattack; @liu2024mmsafetybench; @lopez2024pyrit; @luo2024jailbreakv; @lv2024codechameleon; @mazeika2023tdc; @mazeika2024harmbench; @mckee2024transparency; @mehrotra2023tap; @microsoft2024skeletonkey; @odin2024; @palaskar2025vlsu; @pfohl2024equitymedqa; @promptfoo2025ccp; @ren2024codeattack; @robustintelligence2024bypass; @roccia2024promptintel; @rottger2023xstest; @rottger2025msts; @russinovich2024crescendo; @russinovich2025cca; @russinovich2025price; @scheuerman2025transphobia; @shaikh2022second; @shayegani2025computeruse; @shen2023donotanything; @sheshadri2024lat; @souly2024strongreject; @stok2023ansi; @tan2026comicjailbreak; @tang2025multilingual; @tedeschi2024alert; @vantaylor2024socialbias; @vidgen2023simplesafetytests; @wang2023decodingtrust; @wang2023donotanswer; @wang2025siuo; @wang2026visualleakbench; @wei2023jailbroken; @xie2024sorrybench; @yu2023gptfuzzer; @yuan2023cipherchat; @zeng2024persuasion; @zeng2024shieldgemma; @zhang2024cbtbench; @ziems2022mic; @zong2024vlguard; @zou2023gcg]
99

1010
:::

0 commit comments

Comments
 (0)