PyRIT#
Welcome to the Python Risk Identification Tool for generative AI (PyRIT)! PyRIT is designed to be a flexible and extensible tool that can be used to assess the security and safety issues of generative AI systems in a variety of ways.
Before starting with AI Red Teaming, we recommend reading the following article from Microsoft: “Planning red teaming for large language models (LLMs) and their applications”.
Generative AI systems introduce many categories of risk, which can be difficult to mitigate even with a red teaming plan in place. To quote the article above, “with LLMs, both benign and adversarial usage can produce potentially harmful outputs, which can take many forms, including harmful content such as hate speech, incitement or glorification of violence, or sexual content.” Additionally, a variety of security risks can be introduced by the deployment of an AI system.
Installation Guide#
PyRIT offers flexible installation options to suit different needs. Choose the path that best fits your use case:
Important
Version Compatibility:
User installations (Docker, Pip/Conda) install the latest stable release from PyPI
Contributor installations (DevContainers, Local Development) use the latest development code from the
main
branchAlways match your notebooks to your PyRIT version - download from the corresponding release branch if using a stable release
For Users - Quick Start ⭐
Get started immediately with a pre-configured environment:
✅ All dependencies included
✅ No Python setup needed
✅ JupyterLab built-in
✅ Works on all platforms
For Users - Custom Setup
Install PyRIT directly on your machine:
✅ Full Python environment control
✅ Lighter weight installation
✅ Easy integration with existing workflows
✅ Direct system access
For Contributors ⭐
Standardized development environment:
✅ Pre-configured VS Code setup
✅ Consistent across all contributors
✅ All extensions pre-installed
✅ Zero configuration needed
For Contributors - Custom Dev Setup
Install from source in editable mode:
✅ Full development control
✅ Use any IDE or editor
✅ Customize environment
✅ Advanced configuration options
Recommended Docs Reading Order#
There is no single way to read the documentation, and it’s perfectly fine to jump around. However, here is a recommended reading order. Note that in many sections there are numbered documentation pages. If there is no number attached, it is supplemental and the recommended reading order would be to skip it on a first pass.
This provides an overview of PyRIT in action. A great place to see practical examples and get started quickly.
High-level overview of all PyRIT components. Understanding any single component is easier with knowledge of the others.
Top-level components implementing end-to-end attack techniques. Shows how all PyRIT components fit together.
Building attacks using seed prompts and fetching datasets. The foundation for creating test scenarios.
Endpoints that PyRIT sends prompts to. Essential for nearly any PyRIT scenario - learn what targets are available.
Transform prompts from one format to another. One of the most powerful capabilities within PyRIT.
How PyRIT makes decisions and records output. Essential for evaluating AI system responses.
How PyRIT components communicate state information. Understand the data flow and storage mechanisms.
Attacks and techniques that don’t fit into core PyRIT functionality. Advanced and specialized methods.
Additional Resources#
Code to download, deploy, and score open-source models (such as Hugging Face) on Azure.
Notable new changes and updates. Stay current with the latest PyRIT developments.