Skip to content

Commit ee633c9

Browse files
authored
Merge branch 'main' into docstrings/memory-1176
2 parents f5e7a32 + f9f488d commit ee633c9

File tree

151 files changed

+11332
-11370
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

151 files changed

+11332
-11370
lines changed

.env_example

Lines changed: 49 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -10,42 +10,46 @@
1010
# or copy to OPENAI_CHAT_ENDPOINT
1111
###################################
1212

13-
PLATFORM_OPENAI_CHAT_ENDPOINT="https://api.openai.com/v1/chat/completions"
13+
PLATFORM_OPENAI_CHAT_ENDPOINT="https://api.openai.com/v1"
1414
PLATFORM_OPENAI_CHAT_API_KEY="sk-xxxxx"
1515
PLATFORM_OPENAI_CHAT_GPT4O_MODEL="gpt-4o"
1616

17-
# Note: For Azure OpenAI endpoints, include the api-version query parameter in the URL
18-
# Example: https://xxxx.openai.azure.com/openai/deployments/xxxxx/chat/completions?api-version=2024-10-21
19-
AZURE_OPENAI_GPT4O_ENDPOINT="https://xxxx.openai.azure.com/openai/deployments/xxxxx/chat/completions?api-version=2024-10-21"
17+
# Note: For Azure OpenAI endpoints, use the new format with /openai/v1 and specify the model separately
18+
# Example: https://xxxx.openai.azure.com/openai/v1
19+
AZURE_OPENAI_GPT4O_ENDPOINT="https://xxxx.openai.azure.com/openai/v1"
2020
AZURE_OPENAI_GPT4O_KEY="xxxxx"
21+
AZURE_OPENAI_GPT4O_MODEL="deployment-name"
2122

22-
AZURE_OPENAI_INTEGRATION_TEST_ENDPOINT="https://xxxxx.openai.azure.com/openai/deployments/xxxx/chat/completions?api-version=2024-10-21"
23+
AZURE_OPENAI_INTEGRATION_TEST_ENDPOINT="https://xxxxx.openai.azure.com/openai/v1"
2324
AZURE_OPENAI_INTEGRATION_TEST_KEY="xxxxx"
25+
AZURE_OPENAI_INTEGRATION_TEST_MODEL="deployment-name"
2426

25-
AZURE_OPENAI_GPT3_5_CHAT_ENDPOINT="https://xxxxx.openai.azure.com/openai/deployments/xxxxx/chat/completions?api-version=2024-10-21"
27+
AZURE_OPENAI_GPT3_5_CHAT_ENDPOINT="https://xxxxx.openai.azure.com/openai/v1"
2628
AZURE_OPENAI_GPT3_5_CHAT_KEY="xxxxx"
29+
AZURE_OPENAI_GPT3_5_CHAT_MODEL="deployment-name"
2730

28-
AZURE_OPENAI_GPT4_CHAT_ENDPOINT="https://xxxxx.openai.azure.com/openai/deployments/xxxxx/chat/completions?api-version=2024-10-21"
31+
AZURE_OPENAI_GPT4_CHAT_ENDPOINT="https://xxxxx.openai.azure.com/openai/v1"
2932
AZURE_OPENAI_GPT4_CHAT_KEY="xxxxx"
33+
AZURE_OPENAI_GPT4_CHAT_MODEL="deployment-name"
3034

31-
AZURE_FOUNDRY_DEEPSEEK_ENDPOINT="https://xxxxx.eastus2.models.ai.azure.com/chat/completions"
35+
AZURE_FOUNDRY_DEEPSEEK_ENDPOINT="https://xxxxx.eastus2.models.ai.azure.com"
3236
AZURE_FOUNDRY_DEEPSEEK_KEY="xxxxx"
3337

34-
AZURE_FOUNDRY_PHI4_ENDPOINT="https://xxxxx.models.ai.azure.com/chat/completions"
38+
AZURE_FOUNDRY_PHI4_ENDPOINT="https://xxxxx.models.ai.azure.com"
3539
AZURE_CHAT_PHI4_KEY="xxxxx"
3640

37-
AZURE_FOUNDRY_MINSTRAL3B_ENDPOINT="https://xxxxx.eastus2.models.ai.azure.com/chat/completions"
41+
AZURE_FOUNDRY_MINSTRAL3B_ENDPOINT="https://xxxxx.eastus2.models.ai.azure.com"
3842
AZURE_CHAT_MINSTRAL3B_KEY="xxxxx"
3943

40-
GROQ_ENDPOINT="https://api.groq.com/openai/v1/chat/completions"
44+
GROQ_ENDPOINT="https://api.groq.com/openai/v1"
4145
GROQ_KEY="gsk_xxxxxxxx"
4246
GROQ_LLAMA_MODEL="llama3-8b-8192"
4347

44-
OPEN_ROUTER_ENDPOINT="https://openrouter.ai/api/v1/chat/completions"
48+
OPEN_ROUTER_ENDPOINT="https://openrouter.ai/api/v1"
4549
OPEN_ROUTER_KEY="sk-or-v1-xxxxx"
4650
OPEN_ROUTER_CLAUDE_MODEL="anthropic/claude-3.7-sonnet"
4751

48-
OLLAMA_CHAT_ENDPOINT="http://127.0.0.1:11434/v1/chat/completions"
52+
OLLAMA_CHAT_ENDPOINT="http://127.0.0.1:11434/v1"
4953
OLLAMA_MODEL="llama2"
5054

5155
DEFAULT_OPENAI_FRONTEND_ENDPOINT = ${AZURE_OPENAI_GPT4O_AAD_ENDPOINT}
@@ -60,16 +64,16 @@ OPENAI_CHAT_MODEL=${PLATFORM_OPENAI_CHAT_GPT4O_MODEL}
6064
# OPENAI RESPONSES TARGET SECRETS
6165
##################################
6266

63-
AZURE_OPENAI_GPT5_RESPONSES_ENDPOINT="https://xxxxxxxxx.azure.com/openai/deployments/gpt-5/responses?api-version=2025-03-01-preview"
64-
AZURE_OPENAI_GPT5_COMPLETION_ENDPOINT="https://xxxxxxxxx.azure.com/openai/deployments/gpt-5/chat/completions?api-version=2025-01-01-preview"
67+
AZURE_OPENAI_GPT5_RESPONSES_ENDPOINT="https://xxxxxxxxx.azure.com/openai/v1"
68+
AZURE_OPENAI_GPT5_COMPLETION_ENDPOINT="https://xxxxxxxxx.azure.com/openai/v1"
6569
AZURE_OPENAI_GPT5_KEY="xxxxxxx"
6670
AZURE_OPENAI_GPT5_MODEL="gpt-5"
6771

68-
PLATFORM_OPENAI_RESPONSES_ENDPOINT="https://api.openai.com/v1/responses"
72+
PLATFORM_OPENAI_RESPONSES_ENDPOINT="https://api.openai.com/v1"
6973
PLATFORM_OPENAI_RESPONSES_KEY="sk-xxxxx"
7074
PLATFORM_OPENAI_RESPONSES_MODEL="o4-mini"
7175

72-
AZURE_OPENAI_RESPONSES_ENDPOINT="https://xxxxx.openai.azure.com/openai/responses?api-version=2025-03-01-preview"
76+
AZURE_OPENAI_RESPONSES_ENDPOINT="https://xxxxx.openai.azure.com/openai/v1"
7377
AZURE_OPENAI_RESPONSES_KEY="xxxxx"
7478
AZURE_OPENAI_RESPONSES_MODEL="o4-mini"
7579

@@ -84,11 +88,11 @@ OPENAI_RESPONSES_MODEL=${PLATFORM_OPENAI_RESPONSES_MODEL}
8488
# or copy to OPENAI_REALTIME_ENDPOINT
8589
##################################
8690

87-
PLATFORM_OPENAI_REALTIME_ENDPOINT="wss://api.openai.com/v1/realtime"
91+
PLATFORM_OPENAI_REALTIME_ENDPOINT="wss://api.openai.com/v1"
8892
PLATFORM_OPENAI_REALTIME_API_KEY="sk-xxxxx"
8993
PLATFORM_OPENAI_REALTIME_MODEL="gpt-4o-realtime-preview"
9094

91-
AZURE_OPENAI_REALTIME_ENDPOINT = "wss://xxxx.openai.azure.com/openai/realtime?api-version=2024-10-01-preview"
95+
AZURE_OPENAI_REALTIME_ENDPOINT = "wss://xxxx.openai.azure.com/openai/v1"
9296
AZURE_OPENAI_REALTIME_API_KEY = "xxxxx"
9397
AZURE_OPENAI_REALTIME_MODEL = "gpt-4o-realtime-preview"
9498

@@ -97,20 +101,22 @@ OPENAI_REALTIME_API_KEY = ${PLATFORM_OPENAI_REALTIME_API_KEY}
97101
OPENAI_REALTIME_MODEL = ${PLATFORM_OPENAI_REALTIME_MODEL}
98102

99103
##################################
100-
# DALLE TARGET SECRETS
104+
# IMAGE TARGET SECRETS
101105
#
102-
# The below models work with OpenAIDALLETarget - either pass via environment variables
103-
# or copy to OPENAI_DALLE_ENDPOINT
106+
# The below models work with OpenAIImageTarget - either pass via environment variables
107+
# or copy to OPENAI_IMAGE_ENDPOINT
104108
###################################
105109

106-
OPENAI_DALLE_ENDPOINT1 = "https://xxxxx.openai.azure.com/openai/deployments/xxxxx/images/generations?api-version=2024-10-21"
107-
OPENAI_DALLE_API_KEY1 = "xxxxxx"
110+
OPENAI_IMAGE_ENDPOINT1 = "https://xxxxx.openai.azure.com/openai/v1"
111+
OPENAI_IMAGE_API_KEY1 = "xxxxxx"
112+
OPENAI_IMAGE_MODEL1 = "deployment-name"
108113

109-
OPENAI_DALLE_ENDPOINT2 = "https://api.openai.com/v1/images/generations"
110-
OPENAI_DALLE_API_KEY2 = "sk-xxxxx"
114+
OPENAI_IMAGE_ENDPOINT2 = "https://api.openai.com/v1"
115+
OPENAI_IMAGE_API_KEY2 = "sk-xxxxx"
116+
OPENAI_IMAGE_MODEL2 = "dall-e-3"
111117

112-
OPENAI_DALLE_ENDPOINT = ${OPENAI_DALLE_ENDPOINT2}
113-
OPENAI_DALLE_API_KEY = ${OPENAI_DALLE_API_KEY2}
118+
OPENAI_IMAGE_ENDPOINT = ${OPENAI_IMAGE_ENDPOINT2}
119+
OPENAI_IMAGE_API_KEY = ${OPENAI_IMAGE_API_KEY2}
114120

115121

116122
##################################
@@ -120,29 +126,31 @@ OPENAI_DALLE_API_KEY = ${OPENAI_DALLE_API_KEY2}
120126
# or copy to OPENAI_TTS_ENDPOINT
121127
###################################
122128

123-
OPENAI_TTS_ENDPOINT1 = "https://xxxxx.openai.azure.com/openai/deployments/tts/audio/speech"
129+
OPENAI_TTS_ENDPOINT1 = "https://xxxxx.openai.azure.com/openai/v1"
124130
OPENAI_TTS_KEY1 = "xxxxxxx"
131+
OPENAI_TTS_MODEL1 = "tts"
125132

126-
OPENAI_TTS_ENDPOINT2 = "https://api.openai.com/v1/audio/speech"
133+
OPENAI_TTS_ENDPOINT2 = "https://api.openai.com/v1"
127134
OPENAI_TTS_KEY2 = "xxxxxx"
135+
OPENAI_TTS_MODEL2 = "tts-1"
128136

129137
OPENAI_TTS_ENDPOINT = ${OPENAI_TTS_ENDPOINT2}
130138
OPENAI_TTS_KEY = ${OPENAI_TTS_KEY2}
131139

132140
##################################
133-
# SORA TARGET SECRETS
141+
# VIDEO TARGET SECRETS
134142
#
135-
# The below models work with OpenAISoraTarget - either pass via environment variables
136-
# or copy to OPENAI_SORA_ENDPOINT
143+
# The below models work with OpenAIVideoTarget - either pass via environment variables
144+
# or copy to OPENAI_VIDEO_ENDPOINT
137145
###################################
138146

139-
# Note: Remove /jobs?api-version=<value> from the end of the default Target URI provided
140-
AZURE_OPENAI_SORA_ENDPOINT="https://xxxxx.cognitiveservices.azure.com/openai/v1/video/generations"
141-
AZURE_OPENAI_SORA_KEY="xxxxxxx"
147+
# Note: Use the base URL without API path
148+
AZURE_OPENAI_VIDEO_ENDPOINT="https://xxxxx.cognitiveservices.azure.com/openai/v1"
149+
AZURE_OPENAI_VIDEO_KEY="xxxxxxx"
142150

143-
OPENAI_SORA_ENDPOINT = ${AZURE_OPENAI_SORA_ENDPOINT}
144-
OPENAI_SORA_KEY = ${AZURE_OPENAI_SORA_KEY}
145-
OPENAI_SORA_MODEL = "sora-2"
151+
OPENAI_VIDEO_ENDPOINT = ${AZURE_OPENAI_VIDEO_ENDPOINT}
152+
OPENAI_VIDEO_KEY = ${AZURE_OPENAI_VIDEO_KEY}
153+
OPENAI_VIDEO_MODEL = "sora-2"
146154

147155

148156
##################################
@@ -164,7 +172,7 @@ AZURE_ML_KEY=${AZURE_ML_PHI_KEY}
164172
###################################
165173

166174

167-
OPENAI_COMPLETION_ENDPOINT="https://xxxxx.openai.azure.com/openai/deployments/xxxxx/completions"
175+
OPENAI_COMPLETION_ENDPOINT="https://xxxxx.openai.azure.com/openai/v1"
168176
OPENAI_COMPLETION_API_KEY="xxxxx"
169177
OPENAI_COMPLETION_MODEL="davinci-002"
170178

@@ -188,7 +196,7 @@ CRUCIBLE_API_KEY = "xxxxx"
188196

189197
HUGGINGFACE_TOKEN="hf_xxxxxxx"
190198

191-
GOOGLE_GEMINI_ENDPOINT = "https://generativelanguage.googleapis.com/v1beta/openai/chat/completions"
199+
GOOGLE_GEMINI_ENDPOINT = "https://generativelanguage.googleapis.com/v1beta/openai"
192200
GOOGLE_GEMINI_API_KEY = "xxxxx"
193201
GOOGLE_GEMINI_MODEL="gemini-2.0-flash"
194202

.env_local_example

Lines changed: 7 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -10,12 +10,6 @@ OPENAI_CHAT_ENDPOINT=${PLATFORM_OPENAI_CHAT_ENDPOINT}
1010
OPENAI_CHAT_KEY=${PLATFORM_OPENAI_CHAT_API_KEY}
1111
OPENAI_CHAT_MODEL="gpt-4o"
1212

13-
# For the XPIA example, the formatting for semantic kernel adds /chat/completions onto the end which results in a 404 Error.
14-
# Thus this endpoint should not have the /chat/completions at the end to avoid getting added twice.
15-
XPIA_OPENAI_GPT4O_ENDPOINT = ""
16-
XPIA_OPENAI_API_VERSION = ""
17-
XPIA_OPENAI_MODEL = ""
18-
XPIA_OPENAI_KEY=""
1913

2014
##############
2115
# The below GLOBAL_MEMORY_LABELS will be applied to all prompts sent via attacks and can be altered whenever needed.
@@ -32,19 +26,19 @@ GLOBAL_MEMORY_LABELS = {"username": "username"}
3226
#OPENAI_CHAT_ADDITIONAL_REQUEST_HEADERS="<Provide headers using a dictionary format. Ex., {'key1':'value1'}>"
3327

3428
##############
35-
# OpenAI Sora-2 Target Configuration
29+
# OpenAI Video Target Configuration
3630
# Works with both standard OpenAI Sora-2 API and Azure OpenAI Sora-2 deployments
3731
##############
3832

3933
# OpenAI Sora-2 configuration
40-
OPENAI_SORA_ENDPOINT="https://api.openai.com/v1/videos"
41-
OPENAI_SORA_KEY="your-openai-api-key"
42-
OPENAI_SORA_MODEL="sora-2"
34+
OPENAI_VIDEO_ENDPOINT="https://api.openai.com/v1"
35+
OPENAI_VIDEO_KEY="your-openai-api-key"
36+
OPENAI_VIDEO_MODEL="sora-2"
4337

4438
# For Azure OpenAI Sora-2, override with your Azure endpoint and key:
45-
OPENAI_SORA_ENDPOINT="https://your-resource.cognitiveservices.azure.com/openai/v1/video/generations"
46-
OPENAI_SORA_KEY="your-azure-openai-key"
47-
OPENAI_SORA_MODEL="sora-2"
39+
OPENAI_VIDEO_ENDPOINT="https://your-resource.cognitiveservices.azure.com/openai/v1"
40+
OPENAI_VIDEO_KEY="your-azure-openai-key"
41+
OPENAI_VIDEO_MODEL="sora-2"
4842

4943

5044
# Specify to run tests that may be skipped in the pipeline

build_scripts/env_local_integration_test

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@ OPENAI_CHAT_ENDPOINT=${AZURE_OPENAI_INTEGRATION_TEST_ENDPOINT}
77
OPENAI_CHAT_KEY=${AZURE_OPENAI_INTEGRATION_TEST_KEY}
88
OPENAI_CHAT_MODEL="gpt-4o"
99

10-
OPENAI_DALLE_ENDPOINT=${OPENAI_DALLE_ENDPOINT2}
11-
OPENAI_DALLE_API_KEY=${OPENAI_DALLE_API_KEY2}
10+
OPENAI_IMAGE_ENDPOINT=${OPENAI_IMAGE_ENDPOINT2}
11+
OPENAI_IMAGE_API_KEY=${OPENAI_IMAGE_API_KEY2}
1212

1313
OPENAI_TTS_ENDPOINT=${OPENAI_TTS_ENDPOINT2}
1414
OPENAI_TTS_KEY=${OPENAI_TTS_KEY2}

doc/api.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -438,10 +438,10 @@ API Reference
438438
HuggingFaceEndpointTarget
439439
limit_requests_per_minute
440440
OpenAICompletionTarget
441-
OpenAIDALLETarget
441+
OpenAIImageTarget
442442
OpenAIChatTarget
443443
OpenAIResponseTarget
444-
OpenAISoraTarget
444+
OpenAIVideoTarget
445445
OpenAITTSTarget
446446
OpenAITarget
447447
PlaywrightTarget

doc/blog/2025_03_03.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ We now loop through various models to check that they're working. This helps us
100100
[
101101
("AZURE_OPENAI_GPT4O_ENDPOINT", "AZURE_OPENAI_GPT4O_KEY", ""),
102102
("AZURE_OPENAI_GPT4O_INTEGRATION_TEST_ENDPOINT", "AZURE_OPENAI_GPT4O_INTEGRATION_TEST_KEY", ""),
103-
("AZURE_OPENAI_GPT4O_UNSAFE_ENDPOINT", "AZURE_OPENAI_GPT4O_UNSAFE_CHAT_KEY", ""),
103+
("AZURE_OPENAI_GPT4O_UNSAFE_CHAT_ENDPOINT", "AZURE_OPENAI_GPT4O_UNSAFE_CHAT_KEY", ""),
104104
("AZURE_OPENAI_GPT4O_UNSAFE_CHAT_ENDPOINT2", "AZURE_OPENAI_GPT4O_UNSAFE_CHAT_KEY2", ""),
105105
("AZURE_OPENAI_GPT3_5_CHAT_ENDPOINT", "AZURE_OPENAI_GPT3_5_CHAT_KEY", ""),
106106
("AZURE_OPENAI_GPT4_CHAT_ENDPOINT", "AZURE_OPENAI_GPT4_CHAT_KEY", ""),

doc/code/architecture.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ The remainder of this document talks about the different components, how they wo
1515

1616
The first piece of an attack is often a dataset piece, like a prompt. "Tell me how to create a Molotov cocktail" is an example of a prompt. PyRIT is a good place to have a library of things to check for.
1717

18-
Ways to contribute: Check out our prompts in [seed prompts](https://github.com/Azure/PyRIT/tree/main/pyrit/datasets/seed_prompts) and [jailbreak templates](https://github.com/Azure/PyRIT/tree/main/pyrit/datasets/jailbreak); are there more you can add that include scenarios you're testing for?
18+
Ways to contribute: Check out our prompts in [seed datasets](https://github.com/Azure/PyRIT/tree/main/pyrit/datasets/seed_datasets) and [jailbreak templates](https://github.com/Azure/PyRIT/tree/main/pyrit/datasets/jailbreak); are there more you can add that include scenarios you're testing for?
1919

2020
## Attacks
2121

0 commit comments

Comments
 (0)