You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
*[Review the safety evaluation results](#review-the-safety-evaluation-results)
7
+
*[Run red teaming agent](#run-red-teaming-agent)
8
+
*[Review the red teaming results](#review-the-red-team-results)
9
9
10
10
## Deploy an Azure AI project
11
11
@@ -45,25 +45,27 @@ In order to use the Red Teaming agent, you need an Azure AI project inside Azure
45
45
.evalenv\Scripts\activate
46
46
```
47
47
48
-
1. Install the dependencies for the safety evaluation script:
48
+
3. Install the dependencies for the safety evaluation script:
49
49
50
50
```bash
51
51
pip install uv
52
52
uv pip install -r evals/requirements.txt
53
53
```
54
54
55
-
## Simulate and evaluate adversarial users
55
+
## Run the red teaming agent
56
56
57
-
Run the following command to simulate adversarial queries and evaluate the safety of the answers generated in response to those queries:
57
+
To run the red teaming agent, you need to have the RAG app running at a deployed URL or local URL. Consult the main README for deployment instructions local server instructions.
58
+
59
+
In the same terminal where you activated `.evalenv`, run this command to perform a red teaming scan:
*`--target_url`: The target URL forthe callback. Default is `http://127.0.0.1:8000/chat`, so make sure that the RAG app is running locally. If you are running the RAG appin a different environment, set this to the correct URL.
65
+
*`--target_url`: The target URL for the callback. Default is `http://127.0.0.1:8000/chat`, which assumes the RAG app is running locally. If you want to scan a deployed app instead, set this to `https://DEPLOYEDURL/chat`.
64
66
*`--questions_per_category`: The number of questions per risk category to ask during the scan. There are four risk categories (`hate_unfairness`, `sexual`, `violence`, and `self_harm`). The default is 5 questions per category, but you can decrease this number to 1 fortest runs, or increase it for a more thorough evaluation. Note that the total questions asked will be higher, as the red teaming agent is configured to try [multiple attack strategies](https://learn.microsoft.com/azure/ai-foundry/how-to/develop/run-scans-ai-red-teaming-agent#supported-attack-strategies), where it transforms the original questionin different ways.
65
67
66
-
## Review the red team results
68
+
## Review the red teaming results
67
69
68
70
That command will save results both in Azure AI Foundry and in the local`evals/redteams` directory.
69
71
@@ -80,10 +82,25 @@ Then you can dig into the data and see the questions and answers received from y
80
82
81
83
Note that the questions are intentionally adversarial, so you should mentally prepare for that before looking at the results. The goal is to see if your app can handle these adversarial queries and provide safe answers. Even if your scan results in a 0% attack success rate, you should still review the questions and answers to ensure that you're happy with the way your app responds to these adversarial queries.
82
84
85
+
Learn more in the [Red Teaming Agent documentation](https://learn.microsoft.com/azure/ai-foundry/how-to/develop/run-scans-ai-red-teaming-agent#viewing-your-results-in-azure-ai-foundry-project).
86
+
87
+
## Review results locally
88
+
89
+
In addition to the results in Azure AI Foundry, you can also review the results locally in the `evals/redteams` directory. The results are saved in JSON format.
90
+
91
+
Each file in this directory corresponds to a single red teaming scan, and contains the following fields:
92
+
93
+
*`redteaming_scorecard`: A summary of the scan results, including the attack success rate and the number of questions asked.
94
+
*`redteaming_parameters`: The parameters used for the scan, including the risk categories and attack strategies.
95
+
*`redteaming_data`: A list of the questions asked during the scan, along with the answers received from your app.
96
+
*`studio_url`: A link to the Azure AI Foundry studio where you can view the results in more detail.
97
+
98
+
Learn more in the [Red Teaming Agent documentation](https://learn.microsoft.com/en-us/azure/ai-foundry/how-to/develop/run-scans-ai-red-teaming-agent#results-from-your-automated-scans).
99
+
83
100
## Resources
84
101
85
-
To learn more about the Azure AI services used in this project, look through the script, documentation, and videos below:
102
+
To learn more about the red team scanning, look through the script, documentation, and videos below:
0 commit comments