Skip to content

Commit

Permalink
Merge branch 'main' into users/nina-msft/3427-remove-aria2c
Browse files Browse the repository at this point in the history
  • Loading branch information
nina-msft committed Nov 9, 2024
2 parents 0788a73 + d8c32d1 commit edb93fe
Show file tree
Hide file tree
Showing 283 changed files with 7,572 additions and 4,243 deletions.
3 changes: 3 additions & 0 deletions .github/check_links.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@
"https://platform.openai.com/docs/api-reference/introduction", # blocks python requests
]

custom_myst_references = ["notebook_tests"]

# Updated regex pattern to capture URLs from Markdown and HTML
URL_PATTERN = re.compile(r'\[.*?\]\((.*?)\)|href="([^"]+)"|src="([^"]+)"')

Expand Down Expand Up @@ -56,6 +58,7 @@ def check_url(url, retries=2, delay=2):
if (
"http://localhost:" in url
or url in skipped_urls
or any(url.endswith(reference) for reference in custom_myst_references)
or os.path.isfile(url)
or os.path.isdir(url)
or url.startswith("mailto:")
Expand Down
44 changes: 44 additions & 0 deletions .github/workflows/docs.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
name: build-book

on:
push:
branches:
- "main"
pull_request:
branches:
- "main"
- "release/**"
workflow_dispatch:

# This job installs dependencies, builds the book, and pushes it to `gh-pages`
jobs:
deploy-book:
runs-on: ubuntu-latest
permissions:
pages: write
id-token: write
steps:
- uses: actions/checkout@v4

# Install dependencies
- name: Set up Python 3.11
uses: actions/setup-python@v5
with:
python-version: 3.11

- name: Install PyRIT with pip
run: pip install .[dev]
# Build the book
- name: Build the book
run: |
make docs-build
# Upload the book's HTML as an artifact
- name: Upload artifact
uses: actions/upload-pages-artifact@v3
with:
path: "doc/_build/html"

# Deploy the book's HTML to GitHub Pages
# - name: Deploy to GitHub Pages
# id: deployment
# uses: actions/deploy-pages@v4
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -167,6 +167,10 @@ cython_debug/
doc/generate_docs/cache/*
!doc/generate_docs/cache/.gitkeep

# Jupyterbook build files
doc/_build/
doc/_autosummary/

# ignore all VSCode settings
.vscode/*

Expand Down
3 changes: 3 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,9 @@ pre-commit:
mypy:
$(CMD) mypy $(PYMODULE) $(TESTS)

docs-build:
jb build -n -v ./doc

test:
$(CMD) pytest --cov=$(PYMODULE) $(TESTS)

Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ protect against prompt injection attacks.
Microsoft Learn has a
[dedicated page on AI Red Teaming](https://learn.microsoft.com/en-us/security/ai-red-team).

Check out our [docs](https://github.com/Azure/PyRIT/blob/main/doc/README.md) for more information
Check out our [docs](https://github.com/Azure/PyRIT/blob/main/doc/index.md) for more information
on how to [install PyRIT](https://github.com/Azure/PyRIT/blob/main/doc/setup/install_pyrit.md),
our [How to Guide](https://github.com/Azure/PyRIT/blob/main/doc/how_to_guide.ipynb),
and more, as well as our [demos](https://github.com/Azure/PyRIT/tree/main/doc/code).
Expand Down
19 changes: 0 additions & 19 deletions doc/README.md

This file was deleted.

51 changes: 51 additions & 0 deletions doc/_config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
# Book settings
# Learn more at https://jupyterbook.org/customize/config.html

title: PyRIT Documentation
author: Microsoft AI Red Team
copyright: Copyright 2024, Microsoft AI Red Team
logo: roakey.jpg

# Force re-execution of notebooks on each build.
# See https://jupyterbook.org/content/execute.html
execute:
execute_notebooks: 'off'

# Define the name of the latex output file for PDF builds
latex:
latex_documents:
targetname: book.tex

# Add a bibtex file so that we can create citations
bibtex_bibfiles:
- references.bib

# Information about where the book exists on the web
repository:
url: https://github.com/Azure/PyRIT
path_to_book: doc
branch: main

# Add GitHub buttons to your book
# See https://jupyterbook.org/customize/config.html#add-a-link-to-your-repository
html:
use_issues_button: true
use_repository_button: true
use_edit_page_button: true

sphinx:
extra_extensions:
- 'sphinx.ext.autodoc'
- 'sphinx.ext.napoleon'
- 'sphinx.ext.viewcode'
- 'sphinx.ext.autosummary'
config:
autosummary_generate: true
add_module_names: false
suppress_warnings: ["etoc.toctree"]
myst_heading_anchors: 4
autodoc_default_options:
members: true
show-inheritance: true
undoc-members: true
private-members: false
101 changes: 101 additions & 0 deletions doc/_toc.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,101 @@
format: jb-book
root: index
chapters:
- file: how_to_guide
- file: setup/install_pyrit
sections:
- file: setup/jupyter_setup
- file: setup/populating_secrets
- file: setup/use_azure_sql_db
- file: contributing/README
sections:
- file: contributing/exception
- file: contributing/git
- file: contributing/incorporating_research
- file: contributing/installation
- file: contributing/release_process
- file: contributing/style_guide
- file: contributing/tests
- file: code/architecture
- file: code/user_guide
sections:
- file: code/orchestrators/1_orchestrator
sections:
- file: code/orchestrators/2_prompt_sending_orchestrator
- file: code/orchestrators/3_red_teaming_orchestrator
- file: code/orchestrators/4_xpia_orchestrator
- file: code/orchestrators/5_scoring_orchestrator
- file: code/orchestrators/6_crescendo_orchestrator
- file: code/orchestrators/7_skeleton_key_attack
- file: code/orchestrators/advbench_prompt_sending_orchestrator
- file: code/orchestrators/benchmark_orchestrator
- file: code/orchestrators/decoding_trust_stereotype_testing
- file: code/orchestrators/fetch_tdc23_redteaming_dataset_testing
- file: code/orchestrators/flip_orchestrator
- file: code/orchestrators/forbidden_questions_df_testing
- file: code/orchestrators/fuzzing_jailbreak_templates
- file: code/orchestrators/harmbench_testing
- file: code/orchestrators/hf_harmful_dataset_testing
- file: code/orchestrators/many_shot_jailbreak
- file: code/orchestrators/pair_orchestrator
- file: code/orchestrators/pku_safe_rlhf_testing
- file: code/orchestrators/seclists_bias_testing
- file: code/orchestrators/tree_of_attacks_with_pruning
- file: code/orchestrators/use_huggingface_chat_target
- file: code/orchestrators/violent_durian
- file: code/orchestrators/xstest_bias_testing
- file: code/targets/1_prompt_targets
sections:
- file: code/targets/2_openai_chat_target
- file: code/targets/3_custom_targets
- file: code/targets/4_non_open_ai_chat_targets
- file: code/targets/5_non_llm_targets
- file: code/targets/6_multi_modal_targets
- file: code/targets/7_rate_limiting
- file: code/targets/8_http_target
- file: code/targets/open_ai_completions
- file: code/targets/prompt_shield_target
- file: code/converters/1_converters
sections:
- file: code/converters/2_llm_converters
- file: code/converters/3_using_converters
- file: code/converters/4_audio_converters
- file: code/converters/5_image_converters
- file: code/converters/6_selectively_converting
- file: code/converters/7_human_converter
- file: code/converters/char_swap_attack_generator
- file: code/converters/math_prompt_converter
- file: code/scoring/1_scoring
sections:
- file: code/scoring/2_azure_content_safety_scorers
- file: code/scoring/3_true_false_scorers
- file: code/scoring/4_classification_scorers
- file: code/scoring/5_likert_scorers
- file: code/scoring/6_human_scorers
- file: code/scoring/7_refusal_scorer
- file: code/scoring/prompt_shield_scorer
- file: code/memory/0_memory
sections:
- file: code/memory/1_duck_db_memory
- file: code/memory/2_basic_memory_programming
- file: code/memory/3_prompt_request
- file: code/memory/4_manually_working_with_memory
- file: code/memory/5_resending_prompts
- file: code/memory/6_azure_sql_memory
- file: code/memory/7_azure_sql_memory_orchestrators
- file: code/memory/8_seed_prompt_database
- file: code/memory/9_exporting_data
- file: code/memory/azure_embeddings
- file: code/memory/chat_message
- file: code/auxiliary_attacks/1_auxiliary_attacks
sections:
- file: code/auxiliary_attacks/2_gcg_azure_ml
- file: deployment/README
sections:
- file: deployment/deploy_hf_model_aml
- file: deployment/download_and_register_hf_model_aml
- file: deployment/hf_aml_model_endpoint_guide
- file: deployment/score_aml_endpoint
- file: deployment/troubleshooting_guide_hf_azureml
- file: api.rst
- file: blog/README
Loading

0 comments on commit edb93fe

Please sign in to comment.