Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix hyperlinks and updated package version #58

Merged
merged 9 commits into from
Feb 22, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,17 +28,17 @@ For example, at Microsoft we are using this tool to iterate on different
versions of a product (and its metaprompt) so that we can more effectively
protect against prompt injection attacks.

![PyRIT architecture](./assets/pyrit_architecture.png)
![PyRIT architecture](https://github.com/Azure/PyRIT/blob/main/assets/pyrit_architecture.png)

## Where can I learn more?

Microsoft Learn has a
[dedicated page on AI Red Teaming](https://learn.microsoft.com/en-us/security/ai-red-team).

Check out our [docs](./doc/README.md) for more information
on how to [install PyRIT](./doc/setup/install_pyrit.md),
our [How to Guide](./doc/how_to_guide.ipynb),
and more, as well as our [demos](./doc/demo/) folder.
Check out our [docs](https://github.com/Azure/PyRIT/blob/main/doc/README.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/demo) folder.

## Trademarks

Expand Down
File renamed without changes.
2 changes: 1 addition & 1 deletion doc/code/azure_completions.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
"2. Work with Azure OpenAI Embeddings\n",
"3. Embeddings serialization\n",
"\n",
"Before starting this, make sure you are [set up and authenticated to use Azure OpenAI endpoints](../setup/azure_openai_setup.ipynb)"
"Before starting this, make sure you are [set up and authenticated to use Azure OpenAI endpoints](../setup/setup_azure.md)"
]
},
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
# 2. Work with Azure OpenAI Embeddings
# 3. Embeddings serialization
#
# Before starting this, make sure you are [set up and authenticated to use Azure OpenAI endpoints](../setup/azure_openai_setup.ipynb)
# Before starting this, make sure you are [set up and authenticated to use Azure OpenAI endpoints](../setup/setup_azure.md)

# %%
import os
Expand Down
File renamed without changes.
2 changes: 1 addition & 1 deletion doc/code/azure_openai_chat.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
"\n",
"This Jupyter notebook gives an introduction on how to use `AzureOpenAIChat` to complete chats.\n",
"\n",
"Before starting this, make sure you are [setup to use Azure OpenAI endpoints](../setup/azure_openai_setup.md) and have a chat model, such as GPT-4, deployed. See [How To: Create and deploy an Azure OpenAI Service resource](https://learn.microsoft.com/en-us/azure/ai-services/openai/how-to/create-resource?pivots=web-portal).\n",
"Before starting this, make sure you are [setup to use Azure OpenAI endpoints](../setup/setup_azure.md) and have a chat model, such as GPT-4, deployed. See [How To: Create and deploy an Azure OpenAI Service resource](https://learn.microsoft.com/en-us/azure/ai-services/openai/how-to/create-resource?pivots=web-portal).\n",
"\n",
"In this case, we have one named `gpt-4` deployed. See your deployments at https://oai.azure.com/ `> Management > Deployments`"
]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
#
# This Jupyter notebook gives an introduction on how to use `AzureOpenAIChat` to complete chats.
#
# Before starting this, make sure you are [setup to use Azure OpenAI endpoints](../setup/azure_openai_setup.md) and have a chat model, such as GPT-4, deployed. See [How To: Create and deploy an Azure OpenAI Service resource](https://learn.microsoft.com/en-us/azure/ai-services/openai/how-to/create-resource?pivots=web-portal).
# Before starting this, make sure you are [setup to use Azure OpenAI endpoints](../setup/setup_azure.md) and have a chat model, such as GPT-4, deployed. See [How To: Create and deploy an Azure OpenAI Service resource](https://learn.microsoft.com/en-us/azure/ai-services/openai/how-to/create-resource?pivots=web-portal).
#
# In this case, we have one named `gpt-4` deployed. See your deployments at https://oai.azure.com/ `> Management > Deployments`

Expand Down
File renamed without changes.
2 changes: 1 addition & 1 deletion doc/code/orchestrator.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
"\n",
"Orchestrators can tackle complicated scenarios, but this example is about as simple as it gets (while still being useful). Here, we'll send all prompts in a file, use a transformer to base64-encode the prompts, and send them to a PromptTarget.\n",
"\n",
"Note to run this demo you need to setup your `.env` file to properly authenticate to an Azure OpenAI endpoint as described [here](../setup/azure_openai_setup.ipynb)"
"Note to run this demo you need to setup your `.env` file to properly authenticate to an Azure OpenAI endpoint as described [here](../setup/setup_azure.md)"
]
},
{
Expand Down
2 changes: 1 addition & 1 deletion doc/code/orchestrator.pct.py → doc/code/orchestrator.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
#
# Orchestrators can tackle complicated scenarios, but this example is about as simple as it gets (while still being useful). Here, we'll send all prompts in a file, use a transformer to base64-encode the prompts, and send them to a PromptTarget.
#
# Note to run this demo you need to setup your `.env` file to properly authenticate to an Azure OpenAI endpoint as described [here](../setup/azure_openai_setup.ipynb)
# Note to run this demo you need to setup your `.env` file to properly authenticate to an Azure OpenAI endpoint as described [here](../setup/setup_azure.md)

# %%

Expand Down
2 changes: 1 addition & 1 deletion doc/code/scoring.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
"\n",
"This Jupyter notebook gives an introduction on how to use PyRIT to score responses. We set up a `SelfAskGptClassifier`, which uses Azure Open AI to score a response. In this example, we mock a response from a targeted endpoint and ask if it matches any classifier.\n",
"\n",
"Before starting this, make sure you are [set up and authenticated to use Azure OpenAI endpoints](../setup/azure_openai_setup.md)"
"Before starting this, make sure you are [set up and authenticated to use Azure OpenAI endpoints](../setup/setup_azure.md)"
]
},
{
Expand Down
2 changes: 1 addition & 1 deletion doc/code/scoring.pct.py → doc/code/scoring.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
#
# This Jupyter notebook gives an introduction on how to use PyRIT to score responses. We set up a `SelfAskGptClassifier`, which uses Azure Open AI to score a response. In this example, we mock a response from a targeted endpoint and ask if it matches any classifier.
#
# Before starting this, make sure you are [set up and authenticated to use Azure OpenAI endpoints](../setup/azure_openai_setup.md)
# Before starting this, make sure you are [set up and authenticated to use Azure OpenAI endpoints](../setup/setup_azure.md)

# %%

Expand Down
2 changes: 1 addition & 1 deletion doc/demo/1_gandalf.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
"\n",
"Before you begin, ensure the following steps have been completed:\n",
"\n",
"1. Before starting this, make sure you are [set up and authenticated to use Azure OpenAI endpoints](../setup/azure_openai_setup.ipynb)\n",
"1. Before starting this, make sure you are [set up and authenticated to use Azure OpenAI endpoints](../setup/setup_azure.md)\n",
"\n",
"2. **Deploy an Azure OpenAI:** Confirm that an Azure OpenAI service is already deployed in Azure subscription.\n",
"\n",
Expand Down
16 changes: 1 addition & 15 deletions doc/demo/1_gandalf.pct.py → doc/demo/1_gandalf.py
Original file line number Diff line number Diff line change
@@ -1,15 +1,3 @@
# ---
# jupyter:
# jupytext:
# cell_metadata_filter: -all
# formats: ipynb,py:percent
# text_representation:
# extension: .py
# format_name: percent
# format_version: '1.3'
# jupytext_version: 1.16.1
# ---

# %% [markdown]
# # Introduction
#
Expand All @@ -19,7 +7,7 @@
#
# Before you begin, ensure the following steps have been completed:
#
# 1. Before starting this, make sure you are [set up and authenticated to use Azure OpenAI endpoints](../setup/azure_openai_setup.ipynb)
# 1. Before starting this, make sure you are [set up and authenticated to use Azure OpenAI endpoints](../setup/setup_azure.md)
#
# 2. **Deploy an Azure OpenAI:** Confirm that an Azure OpenAI service is already deployed in Azure subscription.
#
Expand Down Expand Up @@ -101,7 +89,6 @@

GandalfLevel.LEVEL_1, GandalfLevel.LEVEL_2


# %% [markdown]
# Once the agents are set up, we can start the conversation.

Expand Down Expand Up @@ -141,7 +128,6 @@
# %% [markdown]
# Once this is complete, we can use the `GandalfScorer` to score the response from Gandalf.


# %%
gandalf_password_scorer_l1 = GandalfScorer(level=GandalfLevel.LEVEL_1, chat_engine=aoai_chat_engine)
# gandalf_password_scorer_l2 = GandalfScorer(level=GandalfLevel.LEVEL_2, chat_engine=aoai_chat_engine)
Expand Down
6 changes: 3 additions & 3 deletions doc/deployment/deploy_hf_model_aml.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -9,17 +9,17 @@
"This notebook demonstrates the process of deploying registered models in Azure ML workspace\n",
"to an AZURE ML managed online endpoint for real-time inference.\n",
"\n",
"[Learn more about Azure ML Managed Online Endpoints](https://learn.microsoft.com/en-us/azure/machine-learning/concept-endpoints-onlineview=azureml-api-2)\n",
"[Learn more about Azure ML Managed Online Endpoints](https://learn.microsoft.com/en-us/azure/machine-learning/concept-endpoints-online?view=azureml-api-2)\n",
"\n",
"### Prerequisites\n",
"- An Azure account with an active subscription. [Create one for free](https://azure.microsoft.com/free/).\n",
"- An Azure ML workspace set up. [Learn how to set up a workspace](https://docs.microsoft.com/en-us/azure/machine-learninghow-to-manage-workspace).\n",
"- An Azure ML workspace set up. [Learn how to set up a workspace](https://learn.microsoft.com/en-us/azure/machine-learning/how-to-manage-workspace?view=azureml-api-2&tabs=python).\n",
"- Install the Azure ML client library for Python with pip.\n",
" ```bash\n",
" pip install azure-ai-ml\n",
" pip install azure-identity\n",
" ```\n",
"- Execute the `az login` command to sign in to your Azure subscription. For detailed instructions, refer to the \"Authenticate with Azure Subscription\" section in the notebook provided [here](../setup/azure_openai_setup.ipynb)\n",
"- Execute the `az login` command to sign in to your Azure subscription. For detailed instructions, refer to the \"Authenticate with Azure Subscription\" section in the notebook provided [here](../setup/setup_azure.md)\n",
"- A Hugging Face model should be present in the AZURE ML model catalog. If it is missing, execute the [notebook](./download_and_register_hf_model_aml.ipynb) to download and register the Hugging Face model in the AZURE ML registry."
]
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,17 +4,17 @@
# This notebook demonstrates the process of deploying registered models in Azure ML workspace
# to an AZURE ML managed online endpoint for real-time inference.
#
# [Learn more about Azure ML Managed Online Endpoints](https://learn.microsoft.com/en-us/azure/machine-learning/concept-endpoints-onlineview=azureml-api-2)
# [Learn more about Azure ML Managed Online Endpoints](https://learn.microsoft.com/en-us/azure/machine-learning/concept-endpoints-online?view=azureml-api-2)
#
# ### Prerequisites
# - An Azure account with an active subscription. [Create one for free](https://azure.microsoft.com/free/).
# - An Azure ML workspace set up. [Learn how to set up a workspace](https://docs.microsoft.com/en-us/azure/machine-learninghow-to-manage-workspace).
# - An Azure ML workspace set up. [Learn how to set up a workspace](https://learn.microsoft.com/en-us/azure/machine-learning/how-to-manage-workspace?view=azureml-api-2&tabs=python).
# - Install the Azure ML client library for Python with pip.
# ```bash
# pip install azure-ai-ml
# pip install azure-identity
# ```
# - Execute the `az login` command to sign in to your Azure subscription. For detailed instructions, refer to the "Authenticate with Azure Subscription" section in the notebook provided [here](../setup/azure_openai_setup.ipynb)
# - Execute the `az login` command to sign in to your Azure subscription. For detailed instructions, refer to the "Authenticate with Azure Subscription" section in the notebook provided [here](../setup/setup_azure.md)
# - A Hugging Face model should be present in the AZURE ML model catalog. If it is missing, execute the [notebook](./download_and_register_hf_model_aml.ipynb) to download and register the Hugging Face model in the AZURE ML registry.

# %% [markdown]
Expand Down Expand Up @@ -161,7 +161,7 @@ def check_model_version_exists(client, model_name, version) -> bool:

# %%
# Using the first 32 characters because Azure ML endpoint names must be between 3 and 32 characters in length.
endpoint_name = endpoint_name[:32]
endpoint_name = endpoint_name[:30]

# %% [markdown]
# **Create an Azure ML managed online endpoint**
Expand Down Expand Up @@ -201,3 +201,5 @@ def check_model_version_exists(client, model_name, version) -> bool:
)
workspace_ml_client.online_deployments.begin_create_or_update(deployment).wait()
workspace_ml_client.begin_create_or_update(endpoint).result()

# %%
2 changes: 1 addition & 1 deletion doc/deployment/download_and_register_hf_model_aml.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
" pip install azure-ai-ml\n",
" pip install azure-identity\n",
" ```\n",
"- Execute the `az login` command to sign in to your Azure subscription. For detailed instructions, refer to the \"Authenticate with Azure Subscription\" section in the notebook provided [here](../setup/azure_openai_setup.ipynb)"
"- Execute the `az login` command to sign in to your Azure subscription. For detailed instructions, refer to the \"Authenticate with Azure Subscription\" section in the notebook provided [here](../setup/setup_azure.md)"
]
},
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
# pip install azure-ai-ml
# pip install azure-identity
# ```
# - Execute the `az login` command to sign in to your Azure subscription. For detailed instructions, refer to the "Authenticate with Azure Subscription" section in the notebook provided [here](../setup/azure_openai_setup.ipynb)
# - Execute the `az login` command to sign in to your Azure subscription. For detailed instructions, refer to the "Authenticate with Azure Subscription" section in the notebook provided [here](../setup/setup_azure.md)

# %% [markdown]
# ## 1. Connect to Azure Machine Learning Workspace
Expand Down
2 changes: 1 addition & 1 deletion doc/deployment/score_aml_endpoint.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
"Before proceeding with this notebook, ensure the following prerequisites are met:\n",
"\n",
"1. **Azure ML Model Deployment**: Your Azure ML model must be deployed to an Azure ML managed online endpoint. If your model is not yet deployed, please follow the instructions in the [deployment notebook](./deploy_hf_model_aml.ipynb).\n",
"2. Execute the `az login` command to sign in to your Azure subscription. For detailed instructions, refer to the \"Authenticate with Azure Subscription\" section in the notebook provided [here](../setup/azure_openai_setup.ipynb)\n",
"2. Execute the `az login` command to sign in to your Azure subscription. For detailed instructions, refer to the \"Authenticate with Azure Subscription\" section in the notebook provided [here](../setup/setup_azure.md)\n",
"\n",
"\n",
"### Environment Variables\n",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
# Before proceeding with this notebook, ensure the following prerequisites are met:
#
# 1. **Azure ML Model Deployment**: Your Azure ML model must be deployed to an Azure ML managed online endpoint. If your model is not yet deployed, please follow the instructions in the [deployment notebook](./deploy_hf_model_aml.ipynb).
# 2. Execute the `az login` command to sign in to your Azure subscription. For detailed instructions, refer to the "Authenticate with Azure Subscription" section in the notebook provided [here](../setup/azure_openai_setup.ipynb)
# 2. Execute the `az login` command to sign in to your Azure subscription. For detailed instructions, refer to the "Authenticate with Azure Subscription" section in the notebook provided [here](../setup/setup_azure.md)
#
#
# ### Environment Variables
Expand Down
12 changes: 6 additions & 6 deletions doc/how_to_guide.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,11 @@
"\n",
"For that reason, PyRIT is designed to help AI Red Teams scale their efforts. In this user guide, we\n",
"describe two ways of using PyRIT:\n",
"1. [Write prompts yourself](#write-prompts-yourself)\n",
"2. [Generate prompts automatically with RedTeamingBot](#generate-prompts-automatically-with-redteamingbot)\n",
"1. Write prompts yourself\n",
"2. Generate prompts automatically with RedTeamingBot\n",
"\n",
"PyRIT also includes functionality to [score LLM ](#output-scoring) and keep track of conversation\n",
"history with a built-in [memory](#memory) which we discuss below.\n",
"PyRIT also includes functionality to score LLM and keep track of conversation\n",
"history with a built-in memory which we discuss below.\n",
"\n",
"## Write prompts yourself\n",
"\n",
Expand Down Expand Up @@ -241,8 +241,8 @@
"for example, `datasets/attack_strategies/multi-turn-chat/red_team_chatbot_with_objective.yaml`).\n",
"\n",
"PyRIT offers various integration choices for the `RedTeamingBot`, including\n",
"[Azure ML managed online endpoints](https://github.com/Azure/PyRIT/blob/main/examples/demo/3_gandalf_AML_endpoint_red_team_bot.ipynb),\n",
"[Hugging Face](https://github.com/Azure/PyRIT/blob/main/examples/demo/4_gandalf_HuggingFace_red_team_bot.ipynb),\n",
"[Azure ML managed online endpoints](../doc/code/aml_endpoints.ipynb),\n",
"[Hugging Face](../doc/code/huggingface_endpoints.ipynb),\n",
"and Azure OpenAI models (as shown above).\n",
"\n",
"## Output scoring\n",
Expand Down
Loading
Loading