Skip to content

Commit 79037be

Browse files
responses API tests (#40218)
* initial responses tests * add screenshot * add more responses/vector store tests * add input_file base64 tests * switch to sweden resource * remove southindia endpoint * skip tests with known service issues * skips and fixes for tests with aoai
1 parent 3e68663 commit 79037be

9 files changed

+1499
-15
lines changed
534 KB
Loading
14.8 KB
Binary file not shown.

sdk/openai/azure-openai/tests/conftest.py

Lines changed: 10 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,8 @@
4949
ENV_AZURE_OPENAI_EMBEDDINGS_NAME = "text-embedding-ada-002"
5050
ENV_AZURE_OPENAI_AUDIO_NAME = "whisper"
5151
ENV_AZURE_OPENAI_DALLE_NAME = "dall-e-3"
52-
ENV_AZURE_OPENAI_CHAT_COMPLETIONS_GPT4_NAME = "gpt-4o"
52+
ENV_AZURE_OPENAI_CHAT_COMPLETIONS_GPT4_NAME = "gpt-4o-mini"
53+
ENV_AZURE_OPENAI_REALTIME_NAME = "gpt-4o-mini-realtime-preview-1217"
5354
ENV_AZURE_OPENAI_TTS_NAME = "tts"
5455

5556
ENV_OPENAI_KEY = "OPENAI_KEY"
@@ -58,7 +59,8 @@
5859
ENV_OPENAI_EMBEDDINGS_MODEL = "text-embedding-ada-002"
5960
ENV_OPENAI_AUDIO_MODEL = "whisper-1"
6061
ENV_OPENAI_DALLE_MODEL = "dall-e-3"
61-
ENV_OPENAI_CHAT_COMPLETIONS_GPT4_MODEL = "gpt-4o-2024-08-06"
62+
ENV_OPENAI_CHAT_COMPLETIONS_GPT4_MODEL = "gpt-4o-mini-2024-07-18"
63+
ENV_OPENAI_REALTIME_NAME = "gpt-4o-mini-realtime-preview-2024-10-01"
6264
ENV_OPENAI_TTS_MODEL = "tts-1"
6365

6466

@@ -149,8 +151,10 @@ def build_kwargs(args, api_type):
149151
return {"model": ENV_OPENAI_TTS_MODEL}
150152
elif api_type in ["tts_azure"]:
151153
return {"model": ENV_AZURE_OPENAI_TTS_NAME}
152-
if test_feature.startswith("test_chat_completions") \
153-
or test_feature.startswith(("test_client", "test_models")):
154+
if test_feature.startswith(
155+
("test_client", "test_models", "test_chat_completions",
156+
"test_assistants", "test_responses", "test_vector_stores")
157+
):
154158
if api_type in ["azure", "azure_key", "asst_azure"]:
155159
return {"model": ENV_AZURE_OPENAI_CHAT_COMPLETIONS_NAME}
156160
elif api_type == "openai":
@@ -174,16 +178,11 @@ def build_kwargs(args, api_type):
174178
return {"model": ENV_AZURE_OPENAI_DALLE_NAME}
175179
elif api_type == "openai":
176180
return {"model": ENV_OPENAI_DALLE_MODEL}
177-
if test_feature.startswith("test_assistants") or test_feature.startswith("test_vector_stores"):
178-
if api_type in ["asst_azure"]:
179-
return {"model": ENV_AZURE_OPENAI_CHAT_COMPLETIONS_GPT4_NAME}
180-
elif api_type == "gpt_4_openai":
181-
return {"model": ENV_OPENAI_CHAT_COMPLETIONS_GPT4_MODEL}
182181
if test_feature.startswith("test_realtime"):
183182
if api_type in ["gpt_4_azure"]:
184-
return {"model": "gpt-4o-realtime-preview-1001"}
183+
return {"model": ENV_AZURE_OPENAI_REALTIME_NAME}
185184
elif api_type == "gpt_4_openai":
186-
return {"model": "gpt-4o-realtime-preview-2024-10-01"}
185+
return {"model": ENV_OPENAI_REALTIME_NAME}
187186
if test_feature.startswith(("test_module_client", "test_cli")):
188187
return {}
189188
raise ValueError(f"Test feature: {test_feature} needs to have its kwargs configured.")

sdk/openai/azure-openai/tests/test_chat_completions.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1214,7 +1214,7 @@ class MathResponse(BaseModel):
12141214
def test_chat_completion_parallel_tool_calls_disable(self, client, api_type, api_version, **kwargs):
12151215
messages = [
12161216
{"role": "system", "content": "Don't make assumptions about what values to plug into tools. Ask for clarification if a user request is ambiguous."},
1217-
{"role": "user", "content": "What's the weather like today in Seattle and Los Angeles?"}
1217+
{"role": "user", "content": "What's the weather like today in Seattle and Los Angeles in Fahrenheit?"}
12181218
]
12191219
tools = [
12201220
{

sdk/openai/azure-openai/tests/test_chat_completions_async.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1241,7 +1241,7 @@ class MathResponse(BaseModel):
12411241
async def test_chat_completion_parallel_tool_calls_disable(self, client_async, api_type, api_version, **kwargs):
12421242
messages = [
12431243
{"role": "system", "content": "Don't make assumptions about what values to plug into tools. Ask for clarification if a user request is ambiguous."},
1244-
{"role": "user", "content": "What's the weather like today in Seattle and Los Angeles?"}
1244+
{"role": "user", "content": "What's the weather like today in Seattle and Los Angeles in Fahrenheit?"}
12451245
]
12461246
tools = [
12471247
{

0 commit comments

Comments
 (0)