Skip to content

Commit 4998e6d

Browse files
committed
Merge remote-tracking branch 'origin/main' into copilot/standardize-deprecation-calls
# Conflicts: # pyrit/prompt_target/common/prompt_chat_target.py
2 parents b9245af + 561549d commit 4998e6d

25 files changed

Lines changed: 693 additions & 58 deletions

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

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -192,6 +192,33 @@ def calculate_score(
192192
"""
193193
```
194194

195+
### Code references in docstrings
196+
197+
The PyRIT docs build uses **MyST** (Markdown-flavoured), not reStructuredText.
198+
Do **not** use reST cross-reference roles in docstrings or module comments —
199+
they render as raw text under MyST and are inconsistent with the rest of the
200+
codebase, which uses plain double-backtick code spans for symbol names.
201+
202+
```python
203+
# WRONG — reST roles render as literal `:class:\`SeedPrompt\`` under MyST
204+
"""Returns a :class:`SeedPrompt` instance."""
205+
"""Delegate to :func:`download_files_async` (deprecated alias)."""
206+
"""See :meth:`PromptTarget.apply_capabilities` for details."""
207+
208+
# CORRECT — plain double-backtick code span (matches existing convention)
209+
"""Returns a ``SeedPrompt`` instance."""
210+
"""Delegate to ``download_files_async`` (deprecated alias)."""
211+
"""See ``PromptTarget.apply_capabilities`` for details."""
212+
```
213+
214+
Roles to avoid include `:class:`, `:func:`, `:meth:`, `:mod:`, `:attr:`,
215+
`:data:`, `:exc:`, `:obj:`, `:ref:`, and any `:py:*:` variants
216+
(e.g. `:py:class:`, `:py:func:`).
217+
218+
If you genuinely need a Sphinx cross-reference (rare in PyRIT — most
219+
docstrings just name the symbol in backticks), use the MyST role syntax
220+
`` {class}`Name` `` instead. The default, though, is plain double-backticks.
221+
195222
### Class-Level Constants
196223
- Define constants as class attributes, not module-level
197224
- Use UPPER_CASE naming for constants
@@ -454,6 +481,7 @@ Before committing code, ensure:
454481
- [ ] All functions have complete type annotations
455482
- [ ] Functions with >1 parameter use keyword-only arguments
456483
- [ ] Docstrings include parameter types
484+
- [ ] Docstrings use plain double-backtick code spans for symbol references (no reST roles)
457485
- [ ] Enums are used instead of Literals
458486
- [ ] Functions are focused and under 20 lines
459487
- [ ] Error messages are helpful and specific

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; @bethany2024mathprompt; @bhardwaj2023harmfulqa; @bhardwaj2024homer; @bryan2025agentictaxonomy; @bullwinkel2025airtlessons; @bullwinkel2025repeng; @bullwinkel2026trigger; @chao2023pair; @chao2024jailbreakbench; @cui2024orbench; @darkbench2025; @derczynski2024garak; @ding2023wolf; @embracethered2024unicode; @embracethered2025sneakybits; @ghosh2025aegis; @gupta2024walledeval; @haider2024phi3safety; @han2024medsafetybench; @hines2024spotlighting; @ji2023beavertails; @ji2024pkusaferlhf; @jiang2025sosbench; @jones2025computeruse; @kingma2014adam; @li2024saladbench; @li2024wmdp; @lin2023toxicchat; @liu2024flipattack; @lopez2024pyrit; @lv2024codechameleon; @mazeika2023tdc; @mazeika2024harmbench; @mckee2024transparency; @mehrotra2023tap; @microsoft2024skeletonkey; @palaskar2025vlsu; @pfohl2024equitymedqa; @promptfoo2025ccp; @robustintelligence2024bypass; @roccia2024promptintel; @rottger2023xstest; @rottger2025msts; @russinovich2024crescendo; @russinovich2025price; @scheuerman2025transphobia; @shaikh2022second; @shayegani2025computeruse; @shen2023donotanything; @sheshadri2024lat; @stok2023ansi; @tan2026comicjailbreak; @tang2025multilingual; @tedeschi2024alert; @vantaylor2024socialbias; @vidgen2023simplesafetytests; @vidgen2024ailuminate; @wang2023decodingtrust; @wang2023donotanswer; @wei2023jailbroken; @xie2024sorrybench; @yu2023gptfuzzer; @yuan2023cipherchat; @zeng2024persuasion; @zhang2024cbtbench; @zou2023gcg]
8+
[@aakanksha2024multilingual; @adversaai2023universal; @andriushchenko2024tense; @anthropic2024manyshot; @aqrawi2024singleturncrescendo; @bethany2024mathprompt; @bhardwaj2023harmfulqa; @bhardwaj2024homer; @brahman2024coconot; @bryan2025agentictaxonomy; @bullwinkel2025airtlessons; @bullwinkel2025repeng; @bullwinkel2026trigger; @chao2023pair; @chao2024jailbreakbench; @cui2024orbench; @darkbench2025; @derczynski2024garak; @ding2023wolf; @embracethered2024unicode; @embracethered2025sneakybits; @ghosh2025aegis; @gupta2024walledeval; @haider2024phi3safety; @han2024medsafetybench; @hines2024spotlighting; @ji2023beavertails; @ji2024pkusaferlhf; @jiang2025sosbench; @jones2025computeruse; @kingma2014adam; @li2024saladbench; @li2024wmdp; @lin2023toxicchat; @liu2024flipattack; @lopez2024pyrit; @lv2024codechameleon; @mazeika2023tdc; @mazeika2024harmbench; @mckee2024transparency; @mehrotra2023tap; @microsoft2024skeletonkey; @palaskar2025vlsu; @pfohl2024equitymedqa; @promptfoo2025ccp; @robustintelligence2024bypass; @roccia2024promptintel; @rottger2023xstest; @rottger2025msts; @russinovich2024crescendo; @russinovich2025price; @scheuerman2025transphobia; @shaikh2022second; @shayegani2025computeruse; @shen2023donotanything; @sheshadri2024lat; @stok2023ansi; @tan2026comicjailbreak; @tang2025multilingual; @tedeschi2024alert; @vantaylor2024socialbias; @vidgen2023simplesafetytests; @vidgen2024ailuminate; @wang2023decodingtrust; @wang2023donotanswer; @wei2023jailbroken; @xie2024sorrybench; @yu2023gptfuzzer; @yuan2023cipherchat; @zeng2024persuasion; @zhang2024cbtbench; @zou2023gcg]
99

1010
:::

doc/code/datasets/1_loading_datasets.ipynb

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
"BeaverTails [@ji2023beavertails],\n",
2020
"CBT-Bench [@zhang2024cbtbench],\n",
2121
"CategoricalHarmfulQA (CatQA) [@bhardwaj2024homer],\n",
22+
"CoCoNot [@brahman2024coconot],\n",
2223
"DarkBench [@darkbench2025],\n",
2324
"Do Anything Now [@shen2023donotanything],\n",
2425
"Do-Not-Answer [@wang2023donotanswer],\n",
@@ -79,6 +80,8 @@
7980
" 'categorical_harmful_qa',\n",
8081
" 'cbt_bench',\n",
8182
" 'ccp_sensitive_prompts',\n",
83+
" 'coconot_contrast',\n",
84+
" 'coconot_refusal',\n",
8285
" 'comic_jailbreak',\n",
8386
" 'dangerous_qa',\n",
8487
" 'dark_bench',\n",

doc/code/datasets/1_loading_datasets.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323
# BeaverTails [@ji2023beavertails],
2424
# CBT-Bench [@zhang2024cbtbench],
2525
# CategoricalHarmfulQA (CatQA) [@bhardwaj2024homer],
26+
# CoCoNot [@brahman2024coconot],
2627
# DarkBench [@darkbench2025],
2728
# Do Anything Now [@shen2023donotanything],
2829
# Do-Not-Answer [@wang2023donotanswer],

doc/references.bib

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -366,10 +366,10 @@ @misc{embracethered2024unicode
366366

367367
@misc{robustintelligence2024bypass,
368368
title = {Bypassing Meta's {LLaMA} Classifier: A Simple Jailbreak},
369-
author = {{Robust Intelligence}},
369+
author = {Aman Priyanshu},
370370
year = {2024},
371-
url = {https://www.robustintelligence.com/blog-posts/bypassing-metas-llama-classifier-a-simple-jailbreak},
372-
note = {Robust Intelligence Blog},
371+
url = {https://blogs.cisco.com/security/bypassing-metas-llama-classifier-a-simple-jailbreak},
372+
note = {Robust Intelligence (now part of Cisco) Blog},
373373
}
374374

375375
@misc{adversaai2023universal,
@@ -610,3 +610,11 @@ @misc{embracethered2025sneakybits
610610
url = {https://embracethered.com/blog/posts/2025/sneaky-bits-and-ascii-smuggler/},
611611
note = {Embrace The Red Blog},
612612
}
613+
614+
@article{brahman2024coconot,
615+
title = {The Art of Saying No: Contextual Noncompliance in Language Models},
616+
author = {Faeze Brahman and Sachin Kumar and Vidhisha Balachandran and Pradeep Dasigi and Valentina Pyatkin and Abhilasha Ravichander and Sarah Wiegreffe and Nouha Dziri and Khyathi Chandu and Jack Hessel and Yulia Tsvetkov and Noah A. Smith and Yejin Choi and Hannaneh Hajishirzi},
617+
journal = {arXiv preprint arXiv:2407.12043},
618+
year = {2024},
619+
url = {https://arxiv.org/abs/2407.12043},
620+
}

pyrit/auth/azure_auth.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -443,10 +443,10 @@ async def get_speech_config_async(
443443
"""
444444
Get the speech config, resolving a callable token provider if one is provided.
445445
446-
This is the async counterpart to :func:`get_speech_config`. When a callable
446+
This is the async counterpart to ``get_speech_config``. When a callable
447447
``token_provider`` is supplied, it is invoked (and awaited if async) to obtain
448448
a token, which is then used with the ``aad#{resource_id}#{token}`` auth format.
449-
Otherwise, it delegates to the synchronous :func:`get_speech_config`.
449+
Otherwise, it delegates to the synchronous ``get_speech_config``.
450450
451451
Args:
452452
token_provider (Callable | None): An optional sync or async callable that returns a token string.

pyrit/common/data_url_converter.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ async def convert_local_image_to_data_url_async(image_path: str) -> str:
4747

4848
async def convert_local_image_to_data_url(image_path: str) -> str:
4949
"""
50-
Delegate to :func:`convert_local_image_to_data_url_async` (deprecated alias).
50+
Delegate to ``convert_local_image_to_data_url_async`` (deprecated alias).
5151
5252
Returns:
5353
str: A string containing the MIME type and the base64-encoded data of the image, formatted as a data URL.

pyrit/common/display_response.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ async def display_image_response_async(response_piece: MessagePiece) -> None:
5858

5959

6060
async def display_image_response(response_piece: MessagePiece) -> None:
61-
"""Delegate to :func:`display_image_response_async` (deprecated alias)."""
61+
"""Delegate to ``display_image_response_async`` (deprecated alias)."""
6262
print_deprecation_message(
6363
old_item="pyrit.common.display_response.display_image_response",
6464
new_item="pyrit.common.display_response.display_image_response_async",

pyrit/common/download_hf_model.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,7 @@ async def download_with_limit_async(url: str) -> None:
129129

130130

131131
async def download_specific_files(model_id: str, file_patterns: list[str] | None, token: str, cache_dir: Path) -> None:
132-
"""Delegate to :func:`download_specific_files_async` (deprecated alias)."""
132+
"""Delegate to ``download_specific_files_async`` (deprecated alias)."""
133133
print_deprecation_message(
134134
old_item="pyrit.common.download_hf_model.download_specific_files",
135135
new_item="pyrit.common.download_hf_model.download_specific_files_async",
@@ -140,7 +140,7 @@ async def download_specific_files(model_id: str, file_patterns: list[str] | None
140140

141141
async def download_chunk(url: str, headers: dict[str, str], start: int, end: int, client: httpx.AsyncClient) -> bytes:
142142
"""
143-
Delegate to :func:`download_chunk_async` (deprecated alias).
143+
Delegate to ``download_chunk_async`` (deprecated alias).
144144
145145
Returns:
146146
The content of the downloaded chunk.
@@ -154,7 +154,7 @@ async def download_chunk(url: str, headers: dict[str, str], start: int, end: int
154154

155155

156156
async def download_file(url: str, token: str, download_dir: Path, num_splits: int) -> None:
157-
"""Delegate to :func:`download_file_async` (deprecated alias)."""
157+
"""Delegate to ``download_file_async`` (deprecated alias)."""
158158
print_deprecation_message(
159159
old_item="pyrit.common.download_hf_model.download_file",
160160
new_item="pyrit.common.download_hf_model.download_file_async",
@@ -166,7 +166,7 @@ async def download_file(url: str, token: str, download_dir: Path, num_splits: in
166166
async def download_files(
167167
urls: list[str], token: str, download_dir: Path, num_splits: int = 3, parallel_downloads: int = 4
168168
) -> None:
169-
"""Delegate to :func:`download_files_async` (deprecated alias)."""
169+
"""Delegate to ``download_files_async`` (deprecated alias)."""
170170
print_deprecation_message(
171171
old_item="pyrit.common.download_hf_model.download_files",
172172
new_item="pyrit.common.download_hf_model.download_files_async",

pyrit/datasets/seed_datasets/remote/__init__.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,12 @@
2828
from pyrit.datasets.seed_datasets.remote.ccp_sensitive_prompts_dataset import (
2929
_CCPSensitivePromptsDataset,
3030
) # noqa: F401
31+
from pyrit.datasets.seed_datasets.remote.coconot_dataset import (
32+
CoCoNotCategory,
33+
CoCoNotSplit,
34+
_CoCoNotContrastDataset,
35+
_CoCoNotRefusalDataset,
36+
) # noqa: F401
3137
from pyrit.datasets.seed_datasets.remote.comic_jailbreak_dataset import (
3238
COMIC_JAILBREAK_TEMPLATES,
3339
ComicJailbreakTemplateConfig,
@@ -142,6 +148,8 @@
142148
) # noqa: F401
143149

144150
__all__ = [
151+
"CoCoNotCategory",
152+
"CoCoNotSplit",
145153
"HiXSTestLanguage",
146154
"PromptIntelCategory",
147155
"PromptIntelSeverity",
@@ -156,6 +164,8 @@
156164
"_CBTBenchDataset",
157165
"_CCPSensitivePromptsDataset",
158166
"_CategoricalHarmfulQADataset",
167+
"_CoCoNotContrastDataset",
168+
"_CoCoNotRefusalDataset",
159169
"_ComicJailbreakDataset",
160170
"COMIC_JAILBREAK_TEMPLATES",
161171
"ComicJailbreakTemplateConfig",

0 commit comments

Comments
 (0)