chore: Reformat docstrings to reduce docs issues#1268
Conversation
f5e7932 to
d20ae19
Compare
jmartin-tech
left a comment
There was a problem hiding this comment.
Revisions to attempt.py look valid, there is ongoing work in #1254 that may expand or change typical use soon.
One minor request noted.
garak/probes/visual_jailbreak.py
Outdated
| active = False | ||
|
|
||
| __doc__ = FigStepFull.__doc__ + " - Tiny version" | ||
| __doc__ = FigStepFull.__doc__ + "- Tiny version" |
There was a problem hiding this comment.
Minor quibble, the leading space here matches other suffix values used to indicate reduced, tiny or non_full versions.
| __doc__ = FigStepFull.__doc__ + "- Tiny version" | |
| __doc__ = FigStepFull.__doc__ + " - Tiny version" |
garak/garak/probes/latentinjection.py
Line 86 in cfa7e33
There was a problem hiding this comment.
The space triggers this warning:
/home/local/repos/garak/docs/source/../../garak/probes/visual_jailbreak.py:docstring of garak.probes.visual_jailbreak.FigStep:6: ERROR: Unexpected indentation. [docutils]
Let me look for another alternative. (Thanks for the review, btw!)
There was a problem hiding this comment.
Did some snooping. Seems NVIDIA tech docs should use the Chicago style for citing works. Revised as best as I could muster.
d20ae19 to
ebfb48c
Compare
garak/attempt.py
Outdated
| * An attempt tracks a seed prompt and responses to the prompt. | ||
| * There is a 1:1 relationship between an attempt and a source prompt. | ||
| * Attempts track all generations. | ||
| This means messages tracks many histories, one per generation. |
There was a problem hiding this comment.
| This means messages tracks many histories, one per generation. | |
| This means ``messages`` tracks many histories, one per generation. |
ebfb48c to
78e54ec
Compare
erickgalinkin
left a comment
There was a problem hiding this comment.
Left some minor tweaks. Some are my own opinions and thoughts or minor nits, but the ones for Single and Multiple are actually important. Provided suggestions there.
garak/generators/function.py
Outdated
|
|
||
| class Multiple(Single): | ||
| """pass a module#function to be called as generator, with format function(prompt:str, generations:int, **kwargs)->List[Union(str, None)]""" | ||
| """pass a module function to call as a generator, with format ``function(prompt:str, generations:int, **kwargs)->List[Union(str, None)]``""" |
There was a problem hiding this comment.
| """pass a module function to call as a generator, with format ``function(prompt:str, generations:int, **kwargs)->List[Union(str, None)]``""" | |
| """Pass a function to call as a generator. Function must have the signature ``function(prompt:str, generations:int, **kwargs)->List[Union(str, None)]`` and should be supplied via cli or config in the format ``module#function``""" |
Similar to the above. One must pass it in the config or on the cli as mymodule#myfunction. Perhaps this is an indication to improve this docstring more broadly -- suggestion above.
There was a problem hiding this comment.
Appreciate the clarification, thanks very much!
garak/generators/function.py
Outdated
| """pass a module function to call as generator, with format ``function(prompt:str, **kwargs)->List[Union(str, None)]``. | ||
| The parameter `name` is reserved | ||
| """ |
There was a problem hiding this comment.
| """pass a module function to call as generator, with format ``function(prompt:str, **kwargs)->List[Union(str, None)]``. | |
| The parameter `name` is reserved | |
| """ | |
| """Pass a function to call as a generator. Function should be supplied via cli or config in the format ``module#function`` and must have the signature ``function(prompt:str, **kwargs)->List[Union(str, None)]``. | |
| The parameter `name` is reserved. | |
| """ |
The module#function syntax is deliberate. Adding a suggestion here.
garak/probes/phrasing.py
Outdated
| of-the-art LLMs | ||
| Refusal training is widely used to prevent LLMs from generating harmful, undesirable, or illegal outputs. | ||
| We reveal a curious generalization gap in the current refusal training approaches: | ||
| simply reformulating a harmful request in the past tense is often sufficient to jailbreak many state- of-the-art LLMs |
There was a problem hiding this comment.
| simply reformulating a harmful request in the past tense is often sufficient to jailbreak many state- of-the-art LLMs | |
| simply reformulating a harmful request in the past tense is often sufficient to jailbreak many state-of-the-art LLMs |
Could alternatively remove the dashes in state-of-the-art entirely.
garak/probes/visual_jailbreak.py
Outdated
| """Using another modal - image to assist jailbreak. | ||
| Refer to the following paper for more detail: | ||
|
|
||
| Yichen Gong, Delong Ran, Jinyuan Liu, Conglei Wang, Tianshuo Cong, Anyu Wang, Sisi Duan, and Xiaoyun Wang. 2023. | ||
| "FigStep: Jailbreaking Large Vision-language Models via Typographic Visual Prompts." | ||
| ArXiv. https://arxiv.org/pdf/2311.05608 |
There was a problem hiding this comment.
| """Using another modal - image to assist jailbreak. | |
| Refer to the following paper for more detail: | |
| Yichen Gong, Delong Ran, Jinyuan Liu, Conglei Wang, Tianshuo Cong, Anyu Wang, Sisi Duan, and Xiaoyun Wang. 2023. | |
| "FigStep: Jailbreaking Large Vision-language Models via Typographic Visual Prompts." | |
| ArXiv. https://arxiv.org/pdf/2311.05608 | |
| """Using image modality to assist jailbreak. | |
| Refer to the following paper for more detail: | |
| Yichen Gong, Delong Ran, Jinyuan Liu, Conglei Wang, Tianshuo Cong, Anyu Wang, Sisi Duan, and Xiaoyun Wang. 2023. | |
| "FigStep: Jailbreaking Large Vision-language Models via Typographic Visual Prompts." | |
| ArXiv. https://arxiv.org/pdf/2311.05608 |
- detectors.ansiescape file reffed detectors.always - revise docstring in attempt.py -- needs SME review - do we want basic.rst to include _plugins API? - format comments in function.py as RST - reformat docstring in litellm as RST instead of MD - Use Chicago style to ref arXiv papers - Incorp review feedback Signed-off-by: Mike McKiernan <mmckiernan@nvidia.com>
78e54ec to
e4a7075
Compare
Change docstring-related docs build errors and warnings.
Verification
Building the docs produces three remaining build warnings about documents that are not included in any toctree. That's the next PR.