From d84f0d0b383fefb949617491b2a201bf65dfa8ea Mon Sep 17 00:00:00 2001 From: Krista Pratico Date: Fri, 3 May 2024 16:19:48 -0700 Subject: [PATCH 01/20] switch to majority defaultazurecredential auth for tests --- sdk/openai/azure-openai/tests/conftest.py | 61 +++++-------------- .../azure-openai/tests/test_assistants.py | 4 +- .../tests/test_assistants_async.py | 4 +- sdk/openai/azure-openai/tests/test_audio.py | 8 +-- .../azure-openai/tests/test_audio_async.py | 8 +-- .../tests/test_chat_completions.py | 34 +++++++++-- .../tests/test_chat_completions_async.py | 33 ++++++++-- sdk/openai/azure-openai/tests/test_cli.py | 17 +++--- sdk/openai/azure-openai/tests/test_client.py | 6 +- .../azure-openai/tests/test_client_async.py | 6 +- .../azure-openai/tests/test_completions.py | 4 +- .../tests/test_completions_async.py | 4 +- sdk/openai/azure-openai/tests/test_dall_e.py | 4 +- .../azure-openai/tests/test_dall_e_async.py | 4 +- .../azure-openai/tests/test_embeddings.py | 4 +- .../tests/test_embeddings_async.py | 4 +- sdk/openai/azure-openai/tests/test_models.py | 6 +- .../azure-openai/tests/test_models_async.py | 6 +- .../azure-openai/tests/test_module_client.py | 15 +++-- 19 files changed, 124 insertions(+), 108 deletions(-) diff --git a/sdk/openai/azure-openai/tests/conftest.py b/sdk/openai/azure-openai/tests/conftest.py index 89cf69ae8ee4..8b76ea0fede3 100644 --- a/sdk/openai/azure-openai/tests/conftest.py +++ b/sdk/openai/azure-openai/tests/conftest.py @@ -25,27 +25,20 @@ AZURE = "azure" OPENAI = "openai" -AZURE_AD = "azuread" +AZURE_KEY = "azure_key" WHISPER_AZURE = "whisper_azure" -WHISPER_AZURE_AD = "whisper_azuread" TTS_OPENAI = "tts_openai" TTS_AZURE = "tts_azure" -TTS_AZURE_AD = "tts_azuread" DALLE_AZURE = "dalle_azure" -DALLE_AZURE_AD = "dalle_azuread" GPT_4_AZURE = "gpt_4_azure" -GPT_4_AZURE_AD = "gpt_4_azuread" GPT_4_OPENAI = "gpt_4_openai" ASST_AZURE = "asst_azure" -ASST_AZUREAD = "asst_azuread" # Environment variable keys ENV_AZURE_OPENAI_ENDPOINT = "AZ_OPENAI_ENDPOINT" ENV_AZURE_OPENAI_KEY = "AZURE_OPENAI_KEY" ENV_AZURE_OPENAI_NORTHCENTRALUS_ENDPOINT = "AZURE_OPENAI_NORTHCENTRALUS_ENDPOINT" -ENV_AZURE_OPENAI_NORTHCENTRALUS_KEY = "AZURE_OPENAI_NORTHCENTRALUS_KEY" ENV_AZURE_OPENAI_SWEDENCENTRAL_ENDPOINT = "AZURE_OPENAI_SWEDENCENTRAL_ENDPOINT" -ENV_AZURE_OPENAI_SWEDENCENTRAL_KEY = "AZURE_OPENAI_SWEDENCENTRAL_KEY" ENV_SUBSCRIPTION_ID = "AZURE_SUBSCRIPTION_ID" ENV_TENANT_ID = "AZURE_TENANT_ID" ENV_CLIENT_ID = "AZURE_CLIENT_ID" @@ -77,13 +70,13 @@ def client(api_type, api_version): if api_type == "azure": client = openai.AzureOpenAI( azure_endpoint=os.getenv(ENV_AZURE_OPENAI_ENDPOINT), - api_key=os.getenv(ENV_AZURE_OPENAI_KEY), + azure_ad_token_provider=get_bearer_token_provider(DefaultAzureCredential(), "https://cognitiveservices.azure.com/.default"), api_version=api_version, ) - elif api_type == "azuread": + elif api_type == "azure_key": client = openai.AzureOpenAI( azure_endpoint=os.getenv(ENV_AZURE_OPENAI_ENDPOINT), - azure_ad_token_provider=get_bearer_token_provider(DefaultAzureCredential(), "https://cognitiveservices.azure.com/.default"), + api_key=os.getenv(ENV_AZURE_OPENAI_KEY), api_version=api_version, ) elif api_type in ["openai", "gpt_4_openai", "tts_openai"]: @@ -91,24 +84,12 @@ def client(api_type, api_version): api_key=os.getenv(ENV_OPENAI_KEY) ) elif api_type in ["whisper_azure", "tts_azure"]: - client = openai.AzureOpenAI( - azure_endpoint=os.getenv(ENV_AZURE_OPENAI_NORTHCENTRALUS_ENDPOINT), - api_key=os.getenv(ENV_AZURE_OPENAI_NORTHCENTRALUS_KEY), - api_version=api_version, - ) - elif api_type in ["whisper_azuread", "tts_azuread"]: client = openai.AzureOpenAI( azure_endpoint=os.getenv(ENV_AZURE_OPENAI_NORTHCENTRALUS_ENDPOINT), azure_ad_token_provider=get_bearer_token_provider(DefaultAzureCredential(), "https://cognitiveservices.azure.com/.default"), api_version=api_version, ) elif api_type in ["dalle_azure", "gpt_4_azure", "asst_azure"]: - client = openai.AzureOpenAI( - azure_endpoint=os.getenv(ENV_AZURE_OPENAI_SWEDENCENTRAL_ENDPOINT), - api_key=os.getenv(ENV_AZURE_OPENAI_SWEDENCENTRAL_KEY), - api_version=api_version, - ) - elif api_type in ["dalle_azuread", "gpt_4_azuread", "asst_azuread"]: client = openai.AzureOpenAI( azure_endpoint=os.getenv(ENV_AZURE_OPENAI_SWEDENCENTRAL_ENDPOINT), azure_ad_token_provider=get_bearer_token_provider(DefaultAzureCredential(), "https://cognitiveservices.azure.com/.default"), @@ -122,13 +103,13 @@ def client_async(api_type, api_version): if api_type == "azure": client = openai.AsyncAzureOpenAI( azure_endpoint=os.getenv(ENV_AZURE_OPENAI_ENDPOINT), - api_key=os.getenv(ENV_AZURE_OPENAI_KEY), + azure_ad_token_provider=get_bearer_token_provider_async(AsyncDefaultAzureCredential(), "https://cognitiveservices.azure.com/.default"), api_version=api_version, ) - elif api_type == "azuread": + elif api_type == "azure_key": client = openai.AsyncAzureOpenAI( azure_endpoint=os.getenv(ENV_AZURE_OPENAI_ENDPOINT), - azure_ad_token_provider=get_bearer_token_provider_async(AsyncDefaultAzureCredential(), "https://cognitiveservices.azure.com/.default"), + api_key=os.getenv(ENV_AZURE_OPENAI_KEY), api_version=api_version, ) elif api_type in ["openai", "gpt_4_openai", "tts_openai"]: @@ -136,24 +117,12 @@ def client_async(api_type, api_version): api_key=os.getenv(ENV_OPENAI_KEY) ) elif api_type in ["whisper_azure", "tts_azure"]: - client = openai.AsyncAzureOpenAI( - azure_endpoint=os.getenv(ENV_AZURE_OPENAI_NORTHCENTRALUS_ENDPOINT), - api_key=os.getenv(ENV_AZURE_OPENAI_NORTHCENTRALUS_KEY), - api_version=api_version, - ) - elif api_type in ["whisper_azuread", "tts_azuread"]: client = openai.AsyncAzureOpenAI( azure_endpoint=os.getenv(ENV_AZURE_OPENAI_NORTHCENTRALUS_ENDPOINT), azure_ad_token_provider=get_bearer_token_provider_async(AsyncDefaultAzureCredential(), "https://cognitiveservices.azure.com/.default"), api_version=api_version, ) elif api_type in ["dalle_azure", "gpt_4_azure", "asst_azure"]: - client = openai.AsyncAzureOpenAI( - azure_endpoint=os.getenv(ENV_AZURE_OPENAI_SWEDENCENTRAL_ENDPOINT), - api_key=os.getenv(ENV_AZURE_OPENAI_SWEDENCENTRAL_KEY), - api_version=api_version, - ) - elif api_type in ["dalle_azuread", "gpt_4_azuread", "asst_azuread"]: client = openai.AsyncAzureOpenAI( azure_endpoint=os.getenv(ENV_AZURE_OPENAI_SWEDENCENTRAL_ENDPOINT), azure_ad_token_provider=get_bearer_token_provider_async(AsyncDefaultAzureCredential(), "https://cognitiveservices.azure.com/.default"), @@ -165,41 +134,41 @@ def client_async(api_type, api_version): def build_kwargs(args, api_type): test_feature = args[0].qualified_test_name if test_feature.startswith("test_audio"): - if api_type in ["whisper_azure", "whisper_azuread"]: + if api_type in ["whisper_azure"]: return {"model": ENV_AZURE_OPENAI_AUDIO_NAME} elif api_type == "openai": return {"model": ENV_OPENAI_AUDIO_MODEL} elif api_type == "tts_openai": return {"model": ENV_OPENAI_TTS_MODEL} - elif api_type in ["tts_azure", "tts_azuread"]: + elif api_type in ["tts_azure"]: return {"model": ENV_AZURE_OPENAI_TTS_NAME} if test_feature.startswith("test_chat_completions") \ or test_feature.startswith(("test_client", "test_models")): - if api_type in ["azure", "azuread", "asst_azure"]: + if api_type in ["azure", "azure_key", "asst_azure"]: return {"model": ENV_AZURE_OPENAI_CHAT_COMPLETIONS_NAME} elif api_type == "openai": return {"model": ENV_OPENAI_CHAT_COMPLETIONS_MODEL} - elif api_type in ["gpt_4_azure", "gpt_4_azuread"]: + elif api_type in ["gpt_4_azure"]: return {"model": ENV_AZURE_OPENAI_CHAT_COMPLETIONS_GPT4_NAME} elif api_type == "gpt_4_openai": return {"model": ENV_OPENAI_CHAT_COMPLETIONS_GPT4_MODEL} if test_feature.startswith("test_completions"): - if api_type in ["azure", "azuread"]: + if api_type in ["azure", "azure_key"]: return {"model": ENV_AZURE_OPENAI_COMPLETIONS_NAME} elif api_type == "openai": return {"model": ENV_OPENAI_COMPLETIONS_MODEL} if test_feature.startswith("test_embeddings"): - if api_type in ["azure", "azuread"]: + if api_type in ["azure", "azure_key"]: return {"model": ENV_AZURE_OPENAI_EMBEDDINGS_NAME} elif api_type == "openai": return {"model": ENV_OPENAI_EMBEDDINGS_MODEL} if test_feature.startswith("test_dall_e"): - if api_type in ["dalle_azure", "dalle_azuread"]: + if api_type in ["dalle_azure"]: return {"model": ENV_AZURE_OPENAI_DALLE_NAME} elif api_type == "openai": return {"model": ENV_OPENAI_DALLE_MODEL} if test_feature.startswith("test_assistants"): - if api_type in ["asst_azure", "asst_azuread"]: + if api_type in ["asst_azure"]: return {"model": ENV_AZURE_OPENAI_CHAT_COMPLETIONS_GPT4_NAME} elif api_type == "gpt_4_openai": return {"model": ENV_OPENAI_CHAT_COMPLETIONS_GPT4_MODEL} diff --git a/sdk/openai/azure-openai/tests/test_assistants.py b/sdk/openai/azure-openai/tests/test_assistants.py index 09149351add2..389fa2002f75 100644 --- a/sdk/openai/azure-openai/tests/test_assistants.py +++ b/sdk/openai/azure-openai/tests/test_assistants.py @@ -9,7 +9,7 @@ import pathlib import uuid from devtools_testutils import AzureRecordedTestCase -from conftest import ASST_AZURE, ASST_AZUREAD, PREVIEW, GPT_4_OPENAI, configure +from conftest import ASST_AZURE, PREVIEW, GPT_4_OPENAI, configure TIMEOUT = 300 @@ -18,7 +18,7 @@ class TestAssistants(AzureRecordedTestCase): @configure @pytest.mark.parametrize( "api_type, api_version", - [(ASST_AZURE, PREVIEW), (ASST_AZUREAD, PREVIEW), (GPT_4_OPENAI, "v1")] + [(ASST_AZURE, PREVIEW), (GPT_4_OPENAI, "v1")] ) def test_assistants_crud(self, client, api_type, api_version, **kwargs): diff --git a/sdk/openai/azure-openai/tests/test_assistants_async.py b/sdk/openai/azure-openai/tests/test_assistants_async.py index f4c437eea83d..0de07fc6a632 100644 --- a/sdk/openai/azure-openai/tests/test_assistants_async.py +++ b/sdk/openai/azure-openai/tests/test_assistants_async.py @@ -9,7 +9,7 @@ import pathlib import uuid from devtools_testutils import AzureRecordedTestCase -from conftest import ASST_AZURE, ASST_AZUREAD, PREVIEW, GPT_4_OPENAI, configure_async +from conftest import ASST_AZURE, PREVIEW, GPT_4_OPENAI, configure_async TIMEOUT = 300 @@ -19,7 +19,7 @@ class TestAssistantsAsync(AzureRecordedTestCase): @pytest.mark.asyncio @pytest.mark.parametrize( "api_type, api_version", - [(ASST_AZURE, PREVIEW), (ASST_AZUREAD, PREVIEW), (GPT_4_OPENAI, "v1")] + [(ASST_AZURE, PREVIEW), (GPT_4_OPENAI, "v1")] ) async def test_assistants_crud(self, client_async, api_type, api_version, **kwargs): try: diff --git a/sdk/openai/azure-openai/tests/test_audio.py b/sdk/openai/azure-openai/tests/test_audio.py index ecdda4eeafc6..96a43dae36f8 100644 --- a/sdk/openai/azure-openai/tests/test_audio.py +++ b/sdk/openai/azure-openai/tests/test_audio.py @@ -8,7 +8,7 @@ import pathlib import uuid from devtools_testutils import AzureRecordedTestCase -from conftest import WHISPER_AZURE, OPENAI, WHISPER_AZURE_AD, PREVIEW, GA, configure, TTS_OPENAI, TTS_AZURE, TTS_AZURE_AD +from conftest import WHISPER_AZURE, OPENAI, PREVIEW, GA, configure, TTS_OPENAI, TTS_AZURE audio_test_file = pathlib.Path(__file__).parent / "./assets/hello.m4a" audio_long_test_file = pathlib.Path(__file__).parent / "./assets/wikipediaOcelot.wav" @@ -18,7 +18,7 @@ class TestAudio(AzureRecordedTestCase): @configure @pytest.mark.parametrize( "api_type, api_version", - [(WHISPER_AZURE, GA), (WHISPER_AZURE_AD, GA), (WHISPER_AZURE, PREVIEW), (WHISPER_AZURE_AD, PREVIEW), (OPENAI, "v1")] + [(WHISPER_AZURE, GA), (WHISPER_AZURE, PREVIEW), (OPENAI, "v1")] ) def test_transcribe(self, client, api_type, api_version, **kwargs): @@ -43,7 +43,7 @@ def test_transcribe_raw(self, client, api_type, api_version, **kwargs): @configure @pytest.mark.parametrize( "api_type, api_version", - [(WHISPER_AZURE, GA), (WHISPER_AZURE_AD, GA), (WHISPER_AZURE, PREVIEW), (WHISPER_AZURE_AD, PREVIEW), (OPENAI, "v1")] + [(WHISPER_AZURE, GA), (WHISPER_AZURE, PREVIEW), (OPENAI, "v1")] ) def test_translate(self, client, api_type, api_version, **kwargs): @@ -223,7 +223,7 @@ def test_translate_options(self, client, api_type, api_version, **kwargs): @configure @pytest.mark.parametrize( "api_type, api_version", - [(TTS_AZURE, PREVIEW), (TTS_AZURE_AD, PREVIEW), (TTS_OPENAI, "v1")] + [(TTS_AZURE, PREVIEW), (TTS_OPENAI, "v1")] ) def test_tts(self, client, api_type, api_version, **kwargs): diff --git a/sdk/openai/azure-openai/tests/test_audio_async.py b/sdk/openai/azure-openai/tests/test_audio_async.py index 3b1babd443bb..d0f90e9ebe24 100644 --- a/sdk/openai/azure-openai/tests/test_audio_async.py +++ b/sdk/openai/azure-openai/tests/test_audio_async.py @@ -8,7 +8,7 @@ import pathlib import uuid from devtools_testutils import AzureRecordedTestCase -from conftest import WHISPER_AZURE, OPENAI, WHISPER_AZURE_AD, PREVIEW, GA, configure_async, TTS_OPENAI, TTS_AZURE, TTS_AZURE_AD +from conftest import WHISPER_AZURE, OPENAI, PREVIEW, GA, configure_async, TTS_OPENAI, TTS_AZURE audio_test_file = pathlib.Path(__file__).parent / "./assets/hello.m4a" audio_long_test_file = pathlib.Path(__file__).parent / "./assets/wikipediaOcelot.wav" @@ -20,7 +20,7 @@ class TestAudioAsync(AzureRecordedTestCase): @pytest.mark.asyncio @pytest.mark.parametrize( "api_type, api_version", - [(WHISPER_AZURE, GA), (WHISPER_AZURE_AD, GA), (WHISPER_AZURE, PREVIEW), (WHISPER_AZURE_AD, PREVIEW), (OPENAI, "v1")] + [(WHISPER_AZURE, GA), (WHISPER_AZURE, PREVIEW), (OPENAI, "v1")] ) async def test_transcribe(self, client_async, api_type, api_version, **kwargs): @@ -47,7 +47,7 @@ async def test_transcribe_raw(self, client_async, api_type, api_version, **kwarg @pytest.mark.asyncio @pytest.mark.parametrize( "api_type, api_version", - [(WHISPER_AZURE, GA), (WHISPER_AZURE_AD, GA), (WHISPER_AZURE, PREVIEW), (WHISPER_AZURE_AD, PREVIEW), (OPENAI, "v1")] + [(WHISPER_AZURE, GA), (WHISPER_AZURE, PREVIEW), (OPENAI, "v1")] ) async def test_translate(self, client_async, api_type, api_version, **kwargs): @@ -239,7 +239,7 @@ async def test_translate_options(self, client_async, api_type, api_version, **kw @pytest.mark.asyncio @pytest.mark.parametrize( "api_type, api_version", - [(TTS_AZURE, PREVIEW), (TTS_AZURE_AD, PREVIEW), (TTS_OPENAI, "v1")] + [(TTS_AZURE, PREVIEW), (TTS_OPENAI, "v1")] ) async def test_tts(self, client_async, api_type, api_version, **kwargs): diff --git a/sdk/openai/azure-openai/tests/test_chat_completions.py b/sdk/openai/azure-openai/tests/test_chat_completions.py index 0b5cdda390d0..edaea716f256 100644 --- a/sdk/openai/azure-openai/tests/test_chat_completions.py +++ b/sdk/openai/azure-openai/tests/test_chat_completions.py @@ -11,9 +11,8 @@ from conftest import ( AZURE, OPENAI, - AZURE_AD, + AZURE_KEY, GPT_4_AZURE, - GPT_4_AZURE_AD, GPT_4_OPENAI, configure, GA, @@ -29,9 +28,34 @@ class TestChatCompletions(AzureRecordedTestCase): @configure @pytest.mark.parametrize( "api_type, api_version", - [(AZURE, GA), (AZURE, PREVIEW), (AZURE_AD, GA), (AZURE_AD, PREVIEW), (OPENAI, "v1")] + [(AZURE_KEY, GA), (AZURE_KEY, PREVIEW)] ) - def test_chat_completion(self, client, api_type, api_version, **kwargs): + def test_azure_api_key(self, client, api_type, api_version, **kwargs): + messages = [ + {"role": "system", "content": "You are a helpful assistant."}, + {"role": "user", "content": "Who won the world series in 2020?"} + ] + + completion = client.chat.completions.create(messages=messages, **kwargs) + assert completion.id + assert completion.object == "chat.completion" + assert completion.model + assert completion.created + assert completion.usage.completion_tokens is not None + assert completion.usage.prompt_tokens is not None + assert completion.usage.total_tokens == completion.usage.completion_tokens + completion.usage.prompt_tokens + assert len(completion.choices) == 1 + assert completion.choices[0].finish_reason + assert completion.choices[0].index is not None + assert completion.choices[0].message.content is not None + assert completion.choices[0].message.role + + @configure + @pytest.mark.parametrize( + "api_type, api_version", + [(AZURE, GA), (AZURE, PREVIEW), (OPENAI, "v1")] + ) + def test_chat_completiona(self, client, api_type, api_version, **kwargs): messages = [ {"role": "system", "content": "You are a helpful assistant."}, {"role": "user", "content": "Who won the world series in 2020?"} @@ -698,7 +722,7 @@ def test_chat_completion_functions_rai(self, client, api_type, api_version, **kw assert content_filter_result["violence"]["severity"] is not None @configure - @pytest.mark.parametrize("api_type, api_version", [(GPT_4_AZURE, GA), (GPT_4_AZURE, PREVIEW), (GPT_4_AZURE_AD, PREVIEW)]) + @pytest.mark.parametrize("api_type, api_version", [(GPT_4_AZURE, GA), (GPT_4_AZURE, PREVIEW)]) def test_chat_completion_byod(self, client, api_type, api_version, **kwargs): messages = [ {"role": "system", "content": "You are a helpful assistant."}, diff --git a/sdk/openai/azure-openai/tests/test_chat_completions_async.py b/sdk/openai/azure-openai/tests/test_chat_completions_async.py index 2c16440b54d8..c29959cf2a7e 100644 --- a/sdk/openai/azure-openai/tests/test_chat_completions_async.py +++ b/sdk/openai/azure-openai/tests/test_chat_completions_async.py @@ -11,9 +11,8 @@ from conftest import ( AZURE, OPENAI, - AZURE_AD, + AZURE_KEY, GPT_4_AZURE, - GPT_4_AZURE_AD, GPT_4_OPENAI, configure_async, GA, @@ -30,7 +29,33 @@ class TestChatCompletionsAsync(AzureRecordedTestCase): @pytest.mark.asyncio @pytest.mark.parametrize( "api_type, api_version", - [(AZURE, GA), (AZURE, PREVIEW), (AZURE_AD, GA), (AZURE_AD, PREVIEW), (OPENAI, "v1")] + [(AZURE_KEY, GA), (AZURE_KEY, PREVIEW)] + ) + async def test_azure_api_key(self, client_async, api_type, api_version, **kwargs): + messages = [ + {"role": "system", "content": "You are a helpful assistant."}, + {"role": "user", "content": "Who won the world series in 2020?"} + ] + + completion = await client_async.chat.completions.create(messages=messages, **kwargs) + assert completion.id + assert completion.object == "chat.completion" + assert completion.model + assert completion.created + assert completion.usage.completion_tokens is not None + assert completion.usage.prompt_tokens is not None + assert completion.usage.total_tokens == completion.usage.completion_tokens + completion.usage.prompt_tokens + assert len(completion.choices) == 1 + assert completion.choices[0].finish_reason + assert completion.choices[0].index is not None + assert completion.choices[0].message.content is not None + assert completion.choices[0].message.role + + @configure_async + @pytest.mark.asyncio + @pytest.mark.parametrize( + "api_type, api_version", + [(AZURE, GA), (AZURE, PREVIEW), (OPENAI, "v1")] ) async def test_chat_completion(self, client_async, api_type, api_version, **kwargs): messages = [ @@ -714,7 +739,7 @@ async def test_chat_completion_functions_rai(self, client_async, api_type, api_v @configure_async @pytest.mark.asyncio - @pytest.mark.parametrize("api_type, api_version", [(GPT_4_AZURE, GA), (GPT_4_AZURE, PREVIEW), (GPT_4_AZURE_AD, PREVIEW)]) + @pytest.mark.parametrize("api_type, api_version", [(GPT_4_AZURE, GA), (GPT_4_AZURE, PREVIEW)]) async def test_chat_completion_byod(self, client_async, api_type, api_version, **kwargs): messages = [ {"role": "system", "content": "You are a helpful assistant."}, diff --git a/sdk/openai/azure-openai/tests/test_cli.py b/sdk/openai/azure-openai/tests/test_cli.py index 40f71e72927d..3f746755351f 100644 --- a/sdk/openai/azure-openai/tests/test_cli.py +++ b/sdk/openai/azure-openai/tests/test_cli.py @@ -17,7 +17,6 @@ ENV_AZURE_OPENAI_CHAT_COMPLETIONS_NAME, ENV_AZURE_OPENAI_AUDIO_NAME, ENV_AZURE_OPENAI_NORTHCENTRALUS_ENDPOINT, - ENV_AZURE_OPENAI_NORTHCENTRALUS_KEY, reload ) @@ -85,7 +84,7 @@ def test_cli_env_vars_token(self): del os.environ['OPENAI_API_VERSION'] del os.environ["OPENAI_API_TYPE"] - def test_cli_ad_token(self): + def test_cli_api_key(self): with reload(): result = subprocess.run( [ @@ -95,7 +94,7 @@ def test_cli_ad_token(self): "--api-type=azure", f"--azure-endpoint={os.getenv(ENV_AZURE_OPENAI_ENDPOINT)}", f"--api-version={LATEST}", - f"--azure-ad-token={DefaultAzureCredential().get_token('https://cognitiveservices.azure.com/.default').token}", + f"--api-key={os.getenv(ENV_AZURE_OPENAI_KEY)}", "api", "completions.create", "-m", @@ -117,7 +116,7 @@ def test_cli_completions(self): "--api-type=azure", f"--azure-endpoint={os.getenv(ENV_AZURE_OPENAI_ENDPOINT)}", f"--api-version={LATEST}", - f"--api-key={os.getenv(ENV_AZURE_OPENAI_KEY)}", + f"--azure-ad-token={DefaultAzureCredential().get_token('https://cognitiveservices.azure.com/.default').token}", "api", "completions.create", "-m", @@ -139,7 +138,7 @@ def test_cli_chat_completions(self): "--api-type=azure", f"--azure-endpoint={os.getenv(ENV_AZURE_OPENAI_ENDPOINT)}", f"--api-version={LATEST}", - f"--api-key={os.getenv(ENV_AZURE_OPENAI_KEY)}", + f"--azure-ad-token={DefaultAzureCredential().get_token('https://cognitiveservices.azure.com/.default').token}", "api", "chat.completions.create", "-m", @@ -162,7 +161,7 @@ def test_cli_audio_transcription(self): "--api-type=azure", f"--azure-endpoint={os.getenv(ENV_AZURE_OPENAI_NORTHCENTRALUS_ENDPOINT)}", f"--api-version={LATEST}", - f"--api-key={os.getenv(ENV_AZURE_OPENAI_NORTHCENTRALUS_KEY)}", + f"--azure-ad-token={DefaultAzureCredential().get_token('https://cognitiveservices.azure.com/.default').token}", "api", "audio.transcriptions.create", "-m", @@ -184,7 +183,7 @@ def test_cli_audio_translation(self): "--api-type=azure", f"--azure-endpoint={os.getenv(ENV_AZURE_OPENAI_NORTHCENTRALUS_ENDPOINT)}", f"--api-version={LATEST}", - f"--api-key={os.getenv(ENV_AZURE_OPENAI_NORTHCENTRALUS_KEY)}", + f"--azure-ad-token={DefaultAzureCredential().get_token('https://cognitiveservices.azure.com/.default').token}", "api", "audio.translations.create", "-m", @@ -206,7 +205,7 @@ def test_cli_models_list(self): "--api-type=azure", f"--azure-endpoint={os.getenv(ENV_AZURE_OPENAI_ENDPOINT)}", f"--api-version={LATEST}", - f"--api-key={os.getenv(ENV_AZURE_OPENAI_KEY)}", + f"--azure-ad-token={DefaultAzureCredential().get_token('https://cognitiveservices.azure.com/.default').token}", "api", "models.list", ], @@ -224,7 +223,7 @@ def test_cli_models_retrieve(self): "--api-type=azure", f"--azure-endpoint={os.getenv(ENV_AZURE_OPENAI_ENDPOINT)}", f"--api-version={LATEST}", - f"--api-key={os.getenv(ENV_AZURE_OPENAI_KEY)}", + f"--azure-ad-token={DefaultAzureCredential().get_token('https://cognitiveservices.azure.com/.default').token}", "api", "models.retrieve", "-i", diff --git a/sdk/openai/azure-openai/tests/test_client.py b/sdk/openai/azure-openai/tests/test_client.py index 047fe4734e92..552fa9a31301 100644 --- a/sdk/openai/azure-openai/tests/test_client.py +++ b/sdk/openai/azure-openai/tests/test_client.py @@ -8,7 +8,7 @@ import openai import httpx from devtools_testutils import AzureRecordedTestCase -from azure.identity import DefaultAzureCredential +from azure.identity import DefaultAzureCredential, get_bearer_token_provider from conftest import ( AZURE, ENV_AZURE_OPENAI_ENDPOINT, @@ -44,7 +44,7 @@ def test_chat_completion_endpoint_deployment(self, client, api_type, api_version client = openai.AzureOpenAI( azure_endpoint=os.getenv(ENV_AZURE_OPENAI_ENDPOINT), azure_deployment=ENV_AZURE_OPENAI_CHAT_COMPLETIONS_NAME, - api_key=os.getenv(ENV_AZURE_OPENAI_KEY), + azure_ad_token_provider=get_bearer_token_provider(DefaultAzureCredential(), "https://cognitiveservices.azure.com/.default"), api_version=LATEST, ) messages = [ @@ -79,7 +79,7 @@ def test_chat_completion_base_url(self, client, api_type, api_version, **kwargs) client = openai.AzureOpenAI( base_url=f"{os.getenv(ENV_AZURE_OPENAI_ENDPOINT)}/openai/deployments/{ENV_AZURE_OPENAI_CHAT_COMPLETIONS_NAME}", - api_key=os.getenv(ENV_AZURE_OPENAI_KEY), + azure_ad_token_provider=get_bearer_token_provider(DefaultAzureCredential(), "https://cognitiveservices.azure.com/.default"), api_version=LATEST, ) messages = [ diff --git a/sdk/openai/azure-openai/tests/test_client_async.py b/sdk/openai/azure-openai/tests/test_client_async.py index 1c278052ff2f..f3296676ff4a 100644 --- a/sdk/openai/azure-openai/tests/test_client_async.py +++ b/sdk/openai/azure-openai/tests/test_client_async.py @@ -8,7 +8,7 @@ import openai import httpx from devtools_testutils import AzureRecordedTestCase -from azure.identity.aio import DefaultAzureCredential +from azure.identity.aio import DefaultAzureCredential, get_bearer_token_provider from conftest import ( AZURE, ENV_AZURE_OPENAI_ENDPOINT, @@ -46,7 +46,7 @@ async def test_chat_completion_endpoint_deployment(self, client_async, api_type, client = openai.AsyncAzureOpenAI( azure_endpoint=os.getenv(ENV_AZURE_OPENAI_ENDPOINT), azure_deployment=ENV_AZURE_OPENAI_CHAT_COMPLETIONS_NAME, - api_key=os.getenv(ENV_AZURE_OPENAI_KEY), + azure_ad_token_provider=get_bearer_token_provider(DefaultAzureCredential(), "https://cognitiveservices.azure.com/.default"), api_version=LATEST, ) messages = [ @@ -82,7 +82,7 @@ async def test_chat_completion_base_url(self, client_async, api_type, api_versio client = openai.AsyncAzureOpenAI( base_url=f"{os.getenv(ENV_AZURE_OPENAI_ENDPOINT)}/openai/deployments/{ENV_AZURE_OPENAI_CHAT_COMPLETIONS_NAME}", - api_key=os.getenv(ENV_AZURE_OPENAI_KEY), + azure_ad_token_provider=get_bearer_token_provider(DefaultAzureCredential(), "https://cognitiveservices.azure.com/.default"), api_version=LATEST, ) messages = [ diff --git a/sdk/openai/azure-openai/tests/test_completions.py b/sdk/openai/azure-openai/tests/test_completions.py index af1fbd4a6b2c..05edd630af31 100644 --- a/sdk/openai/azure-openai/tests/test_completions.py +++ b/sdk/openai/azure-openai/tests/test_completions.py @@ -7,7 +7,7 @@ import json import openai from devtools_testutils import AzureRecordedTestCase -from conftest import AZURE, OPENAI, AZURE_AD, PREVIEW, GA, configure +from conftest import AZURE, OPENAI, PREVIEW, GA, configure class TestCompletions(AzureRecordedTestCase): @@ -16,7 +16,7 @@ class TestCompletions(AzureRecordedTestCase): @configure @pytest.mark.parametrize( "api_type, api_version", - [(AZURE, PREVIEW), (AZURE, GA), (AZURE_AD, PREVIEW), (AZURE_AD, GA), (OPENAI, "v1")] + [(AZURE, PREVIEW), (AZURE, GA), (OPENAI, "v1")] ) def test_completion(self, client, api_type, api_version, **kwargs): diff --git a/sdk/openai/azure-openai/tests/test_completions_async.py b/sdk/openai/azure-openai/tests/test_completions_async.py index 65698f35d5f8..986a27cac14c 100644 --- a/sdk/openai/azure-openai/tests/test_completions_async.py +++ b/sdk/openai/azure-openai/tests/test_completions_async.py @@ -6,7 +6,7 @@ import json import openai from devtools_testutils import AzureRecordedTestCase -from conftest import AZURE, OPENAI, AZURE_AD, PREVIEW, GA, configure_async +from conftest import AZURE, OPENAI, PREVIEW, GA, configure_async class TestCompletionsAsync(AzureRecordedTestCase): @@ -16,7 +16,7 @@ class TestCompletionsAsync(AzureRecordedTestCase): @pytest.mark.asyncio @pytest.mark.parametrize( "api_type, api_version", - [(AZURE, PREVIEW), (AZURE, GA), (AZURE_AD, PREVIEW), (AZURE_AD, GA), (OPENAI, "v1")] + [(AZURE, PREVIEW), (AZURE, GA), (OPENAI, "v1")] ) async def test_completion(self, client_async, api_type, api_version, **kwargs): diff --git a/sdk/openai/azure-openai/tests/test_dall_e.py b/sdk/openai/azure-openai/tests/test_dall_e.py index 97a04244d82e..bbce75dee816 100644 --- a/sdk/openai/azure-openai/tests/test_dall_e.py +++ b/sdk/openai/azure-openai/tests/test_dall_e.py @@ -6,7 +6,7 @@ import pytest import openai from devtools_testutils import AzureRecordedTestCase -from conftest import configure, DALLE_AZURE, OPENAI, DALLE_AZURE_AD, PREVIEW, GA +from conftest import configure, DALLE_AZURE, OPENAI, PREVIEW, GA class TestDallE(AzureRecordedTestCase): @@ -14,7 +14,7 @@ class TestDallE(AzureRecordedTestCase): @configure @pytest.mark.parametrize( "api_type, api_version", - [(DALLE_AZURE, GA), (DALLE_AZURE_AD, GA), (DALLE_AZURE, PREVIEW), (DALLE_AZURE_AD, PREVIEW), (OPENAI, "v1")] + [(DALLE_AZURE, GA), (DALLE_AZURE, PREVIEW), (OPENAI, "v1")] ) def test_image_create(self, client, api_type, api_version, **kwargs): image = client.images.generate( diff --git a/sdk/openai/azure-openai/tests/test_dall_e_async.py b/sdk/openai/azure-openai/tests/test_dall_e_async.py index 71912fef9d02..945186757223 100644 --- a/sdk/openai/azure-openai/tests/test_dall_e_async.py +++ b/sdk/openai/azure-openai/tests/test_dall_e_async.py @@ -6,7 +6,7 @@ import pytest import openai from devtools_testutils import AzureRecordedTestCase -from conftest import configure_async, DALLE_AZURE, OPENAI, DALLE_AZURE_AD, PREVIEW, GA +from conftest import configure_async, DALLE_AZURE, OPENAI, PREVIEW, GA class TestDallEAsync(AzureRecordedTestCase): @@ -15,7 +15,7 @@ class TestDallEAsync(AzureRecordedTestCase): @pytest.mark.asyncio @pytest.mark.parametrize( "api_type, api_version", - [(DALLE_AZURE, GA), (DALLE_AZURE_AD, GA), (DALLE_AZURE, PREVIEW), (DALLE_AZURE_AD, PREVIEW), (OPENAI, "v1")] + [(DALLE_AZURE, GA), (DALLE_AZURE, PREVIEW), (OPENAI, "v1")] ) async def test_image_create(self, client_async, api_type, api_version, **kwargs): image = await client_async.images.generate( diff --git a/sdk/openai/azure-openai/tests/test_embeddings.py b/sdk/openai/azure-openai/tests/test_embeddings.py index b472f3251634..fb56f473d765 100644 --- a/sdk/openai/azure-openai/tests/test_embeddings.py +++ b/sdk/openai/azure-openai/tests/test_embeddings.py @@ -6,7 +6,7 @@ import pytest import openai from devtools_testutils import AzureRecordedTestCase -from conftest import configure, AZURE, OPENAI, AZURE_AD, PREVIEW, GA +from conftest import configure, AZURE, OPENAI, PREVIEW, GA class TestEmbeddings(AzureRecordedTestCase): @@ -14,7 +14,7 @@ class TestEmbeddings(AzureRecordedTestCase): @configure @pytest.mark.parametrize( "api_type, api_version", - [(AZURE, GA), (AZURE, PREVIEW), (AZURE_AD, GA), (AZURE_AD, PREVIEW), (OPENAI, "v1")] + [(AZURE, GA), (AZURE, PREVIEW), (OPENAI, "v1")] ) def test_embedding(self, client, api_type, api_version, **kwargs): diff --git a/sdk/openai/azure-openai/tests/test_embeddings_async.py b/sdk/openai/azure-openai/tests/test_embeddings_async.py index 9247685cdb94..7c1d86a62da2 100644 --- a/sdk/openai/azure-openai/tests/test_embeddings_async.py +++ b/sdk/openai/azure-openai/tests/test_embeddings_async.py @@ -6,7 +6,7 @@ import pytest import openai from devtools_testutils import AzureRecordedTestCase -from conftest import configure_async, AZURE, OPENAI, AZURE_AD, PREVIEW, GA +from conftest import configure_async, AZURE, OPENAI, PREVIEW, GA class TestEmbeddingsAsync(AzureRecordedTestCase): @@ -15,7 +15,7 @@ class TestEmbeddingsAsync(AzureRecordedTestCase): @pytest.mark.asyncio @pytest.mark.parametrize( "api_type, api_version", - [(AZURE, GA), (AZURE, PREVIEW), (AZURE_AD, GA), (AZURE_AD, PREVIEW), (OPENAI, "v1")] + [(AZURE, GA), (AZURE, PREVIEW), (OPENAI, "v1")] ) async def test_embedding(self, client_async, api_type, api_version, **kwargs): diff --git a/sdk/openai/azure-openai/tests/test_models.py b/sdk/openai/azure-openai/tests/test_models.py index 1c5641abd331..878a15283723 100644 --- a/sdk/openai/azure-openai/tests/test_models.py +++ b/sdk/openai/azure-openai/tests/test_models.py @@ -8,7 +8,7 @@ import pathlib import uuid from devtools_testutils import AzureRecordedTestCase -from conftest import configure, ASST_AZURE, OPENAI, AZURE, AZURE_AD, PREVIEW, GA +from conftest import configure, ASST_AZURE, OPENAI, AZURE, PREVIEW, GA class TestModels(AzureRecordedTestCase): @@ -16,7 +16,7 @@ class TestModels(AzureRecordedTestCase): @configure @pytest.mark.parametrize( "api_type, api_version", - [(AZURE, GA), (AZURE, PREVIEW), (AZURE_AD, GA), (AZURE_AD, PREVIEW), (OPENAI, "v1")] + [(AZURE, GA), (AZURE, PREVIEW), (OPENAI, "v1")] ) def test_models_list(self, client, api_type, api_version, **kwargs): @@ -27,7 +27,7 @@ def test_models_list(self, client, api_type, api_version, **kwargs): @configure @pytest.mark.parametrize( "api_type, api_version", - [(AZURE, GA), (AZURE, PREVIEW), (AZURE_AD, GA), (AZURE_AD, PREVIEW), (OPENAI, "v1")] + [(AZURE, GA), (AZURE, PREVIEW), (OPENAI, "v1")] ) def test_models_retrieve(self, client, api_type, api_version, **kwargs): diff --git a/sdk/openai/azure-openai/tests/test_models_async.py b/sdk/openai/azure-openai/tests/test_models_async.py index 2851cd00ca03..d87136bba9ea 100644 --- a/sdk/openai/azure-openai/tests/test_models_async.py +++ b/sdk/openai/azure-openai/tests/test_models_async.py @@ -8,7 +8,7 @@ import pathlib import uuid from devtools_testutils import AzureRecordedTestCase -from conftest import configure_async, ASST_AZURE, OPENAI, AZURE, AZURE_AD, PREVIEW, GA +from conftest import configure_async, ASST_AZURE, OPENAI, AZURE, PREVIEW, GA class TestModelsAsync(AzureRecordedTestCase): @@ -17,7 +17,7 @@ class TestModelsAsync(AzureRecordedTestCase): @pytest.mark.asyncio @pytest.mark.parametrize( "api_type, api_version", - [(AZURE, GA), (AZURE, PREVIEW), (AZURE_AD, GA), (AZURE_AD, PREVIEW), (OPENAI, "v1")] + [(AZURE, GA), (AZURE, PREVIEW), (OPENAI, "v1")] ) async def test_models_list(self, client_async, api_type, api_version, **kwargs): @@ -29,7 +29,7 @@ async def test_models_list(self, client_async, api_type, api_version, **kwargs): @pytest.mark.asyncio @pytest.mark.parametrize( "api_type, api_version", - [(AZURE, GA), (AZURE, PREVIEW), (AZURE_AD, GA), (AZURE_AD, PREVIEW), (OPENAI, "v1")] + [(AZURE, GA), (AZURE, PREVIEW), (OPENAI, "v1")] ) async def test_models_retrieve(self, client_async, api_type, api_version, **kwargs): diff --git a/sdk/openai/azure-openai/tests/test_module_client.py b/sdk/openai/azure-openai/tests/test_module_client.py index a873c35e331e..dcde0598cbf4 100644 --- a/sdk/openai/azure-openai/tests/test_module_client.py +++ b/sdk/openai/azure-openai/tests/test_module_client.py @@ -15,7 +15,6 @@ ENV_AZURE_OPENAI_KEY, LATEST, ENV_AZURE_OPENAI_NORTHCENTRALUS_ENDPOINT, - ENV_AZURE_OPENAI_NORTHCENTRALUS_KEY, ENV_AZURE_OPENAI_COMPLETIONS_NAME, ENV_AZURE_OPENAI_CHAT_COMPLETIONS_NAME, ENV_AZURE_OPENAI_EMBEDDINGS_NAME, @@ -88,11 +87,11 @@ def test_module_client_env_vars_token(self, client, api_type, api_version, **kwa @configure @pytest.mark.parametrize("api_type, api_version", [(AZURE, LATEST)]) - def test_module_client_ad_token_provider(self, client, api_type, api_version, **kwargs): + def test_module_client_api_key(self, client, api_type, api_version, **kwargs): with reload(): openai.api_type= "azure" openai.azure_endpoint = os.getenv(ENV_AZURE_OPENAI_ENDPOINT) - openai.azure_ad_token_provider = get_bearer_token_provider(DefaultAzureCredential(), "https://cognitiveservices.azure.com/.default") + openai.api_key = os.getenv(ENV_AZURE_OPENAI_KEY) openai.api_version = LATEST completion = openai.completions.create(prompt="hello world", model=ENV_AZURE_OPENAI_COMPLETIONS_NAME) @@ -138,7 +137,7 @@ def test_module_client_completions(self, client, api_type, api_version, **kwargs with reload(): openai.api_type= "azure" openai.azure_endpoint = os.getenv(ENV_AZURE_OPENAI_ENDPOINT) - openai.api_key = os.getenv(ENV_AZURE_OPENAI_KEY) + openai.azure_ad_token_provider = get_bearer_token_provider(DefaultAzureCredential(), "https://cognitiveservices.azure.com/.default") openai.api_version = LATEST completion = openai.completions.create(prompt="hello world", model=ENV_AZURE_OPENAI_COMPLETIONS_NAME) @@ -160,7 +159,7 @@ def test_module_client_chat_completions(self, client, api_type, api_version, **k with reload(): openai.api_type= "azure" openai.azure_endpoint = os.getenv(ENV_AZURE_OPENAI_ENDPOINT) - openai.api_key = os.getenv(ENV_AZURE_OPENAI_KEY) + openai.azure_ad_token_provider = get_bearer_token_provider(DefaultAzureCredential(), "https://cognitiveservices.azure.com/.default") openai.api_version = LATEST messages = [ @@ -188,7 +187,7 @@ def test_module_client_embeddings(self, client, api_type, api_version, **kwargs) with reload(): openai.api_type= "azure" openai.azure_endpoint = os.getenv(ENV_AZURE_OPENAI_ENDPOINT) - openai.api_key = os.getenv(ENV_AZURE_OPENAI_KEY) + openai.azure_ad_token_provider = get_bearer_token_provider(DefaultAzureCredential(), "https://cognitiveservices.azure.com/.default") openai.api_version = LATEST embedding = openai.embeddings.create(input="hello world", model=ENV_AZURE_OPENAI_EMBEDDINGS_NAME) @@ -207,7 +206,7 @@ def test_module_client_models(self, client, api_type, api_version, **kwargs): with reload(): openai.api_type= "azure" openai.azure_endpoint = os.getenv(ENV_AZURE_OPENAI_ENDPOINT) - openai.api_key = os.getenv(ENV_AZURE_OPENAI_KEY) + openai.azure_ad_token_provider = get_bearer_token_provider(DefaultAzureCredential(), "https://cognitiveservices.azure.com/.default") openai.api_version = LATEST models = openai.models.list() @@ -223,7 +222,7 @@ def test_module_client_audio(self, client, api_type, api_version, **kwargs): with reload(): openai.api_type= "azure" openai.azure_endpoint = os.getenv(ENV_AZURE_OPENAI_NORTHCENTRALUS_ENDPOINT) - openai.api_key = os.getenv(ENV_AZURE_OPENAI_NORTHCENTRALUS_KEY) + openai.azure_ad_token_provider = get_bearer_token_provider(DefaultAzureCredential(), "https://cognitiveservices.azure.com/.default") openai.api_version = LATEST result = openai.audio.transcriptions.create( From 25fceacab9c5ef80c275c465bce9edaca9030945 Mon Sep 17 00:00:00 2001 From: Krista Pratico Date: Wed, 29 May 2024 10:18:54 -0700 Subject: [PATCH 02/20] test run --- sdk/openai/azure-openai/dev_requirements.txt | 1 + sdk/openai/azure-openai/pyproject.toml | 8 -------- 2 files changed, 1 insertion(+), 8 deletions(-) diff --git a/sdk/openai/azure-openai/dev_requirements.txt b/sdk/openai/azure-openai/dev_requirements.txt index 3a7d551667c3..ce42c5cfe5c9 100644 --- a/sdk/openai/azure-openai/dev_requirements.txt +++ b/sdk/openai/azure-openai/dev_requirements.txt @@ -2,3 +2,4 @@ ../../identity/azure-identity httpx aiohttp +openai diff --git a/sdk/openai/azure-openai/pyproject.toml b/sdk/openai/azure-openai/pyproject.toml index bb99b3ca2735..e724faf7c64d 100644 --- a/sdk/openai/azure-openai/pyproject.toml +++ b/sdk/openai/azure-openai/pyproject.toml @@ -4,11 +4,3 @@ mypy = false pyright = false type_check_samples = false verifytypes = false - -[[tool.azure-sdk-build.optional]] -name = "main" -install = ["git+https://github.com/openai/openai-python@main"] - -[[tool.azure-sdk-build.optional]] -name = "released" -install = ["openai"] From 1585e269237b0d347a6777857debc72d0da762cb Mon Sep 17 00:00:00 2001 From: Krista Pratico Date: Wed, 29 May 2024 10:37:11 -0700 Subject: [PATCH 03/20] don't use optional for test run --- sdk/openai/tests.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/sdk/openai/tests.yml b/sdk/openai/tests.yml index ac2abcf02204..b364bd6850da 100644 --- a/sdk/openai/tests.yml +++ b/sdk/openai/tests.yml @@ -5,7 +5,6 @@ extends: parameters: ServiceDirectory: openai TestTimeoutInMinutes: 200 - ToxTestEnv: optional MatrixFilters: - PythonVersion=3.11.* EnvVars: From b17b627eaa3f065082c124221ed53f65cbcb3712 Mon Sep 17 00:00:00 2001 From: Krista Pratico Date: Thu, 30 May 2024 19:17:58 -0700 Subject: [PATCH 04/20] try --- .../TestResources/sub-config/AzureOpenAITestingSub.json | 6 ++++++ sdk/openai/azure-openai/tests/test_assistants.py | 2 +- sdk/openai/azure-openai/tests/test_assistants_async.py | 2 +- sdk/openai/azure-openai/tests/test_audio.py | 2 +- sdk/openai/azure-openai/tests/test_audio_async.py | 2 +- sdk/openai/azure-openai/tests/test_chat_completions.py | 8 +++----- .../azure-openai/tests/test_chat_completions_async.py | 8 +++----- sdk/openai/azure-openai/tests/test_cli.py | 2 +- sdk/openai/azure-openai/tests/test_client.py | 2 +- sdk/openai/azure-openai/tests/test_client_async.py | 2 +- sdk/openai/azure-openai/tests/test_completions_async.py | 2 +- sdk/openai/azure-openai/tests/test_dall_e.py | 2 +- sdk/openai/azure-openai/tests/test_dall_e_async.py | 2 +- sdk/openai/azure-openai/tests/test_embeddings.py | 2 +- sdk/openai/azure-openai/tests/test_embeddings_async.py | 2 +- sdk/openai/azure-openai/tests/test_models.py | 2 +- sdk/openai/azure-openai/tests/test_models_async.py | 2 +- sdk/openai/azure-openai/tests/test_module_client.py | 2 +- sdk/openai/tests.yml | 8 ++------ 19 files changed, 29 insertions(+), 31 deletions(-) create mode 100644 eng/common/TestResources/sub-config/AzureOpenAITestingSub.json diff --git a/eng/common/TestResources/sub-config/AzureOpenAITestingSub.json b/eng/common/TestResources/sub-config/AzureOpenAITestingSub.json new file mode 100644 index 000000000000..dc251d55ae6f --- /dev/null +++ b/eng/common/TestResources/sub-config/AzureOpenAITestingSub.json @@ -0,0 +1,6 @@ +{ + "SubscriptionId": "e72e5254-f265-4e95-9bd2-9ee8e7329051", + "TenantId": "72f988bf-86f1-41af-91ab-2d7cd011db47", + "Environment": "AzureCloud", + "AzureSubscription": "Speech Services - DEV - SDK (rob)" +} \ No newline at end of file diff --git a/sdk/openai/azure-openai/tests/test_assistants.py b/sdk/openai/azure-openai/tests/test_assistants.py index 389fa2002f75..1ec746983e7b 100644 --- a/sdk/openai/azure-openai/tests/test_assistants.py +++ b/sdk/openai/azure-openai/tests/test_assistants.py @@ -12,7 +12,7 @@ from conftest import ASST_AZURE, PREVIEW, GPT_4_OPENAI, configure TIMEOUT = 300 - +@pytest.mark.skip() class TestAssistants(AzureRecordedTestCase): @configure diff --git a/sdk/openai/azure-openai/tests/test_assistants_async.py b/sdk/openai/azure-openai/tests/test_assistants_async.py index 0de07fc6a632..fda7139c6f0c 100644 --- a/sdk/openai/azure-openai/tests/test_assistants_async.py +++ b/sdk/openai/azure-openai/tests/test_assistants_async.py @@ -12,7 +12,7 @@ from conftest import ASST_AZURE, PREVIEW, GPT_4_OPENAI, configure_async TIMEOUT = 300 - +@pytest.mark.skip() class TestAssistantsAsync(AzureRecordedTestCase): @configure_async diff --git a/sdk/openai/azure-openai/tests/test_audio.py b/sdk/openai/azure-openai/tests/test_audio.py index 96a43dae36f8..f59dd5d5c8cc 100644 --- a/sdk/openai/azure-openai/tests/test_audio.py +++ b/sdk/openai/azure-openai/tests/test_audio.py @@ -12,7 +12,7 @@ audio_test_file = pathlib.Path(__file__).parent / "./assets/hello.m4a" audio_long_test_file = pathlib.Path(__file__).parent / "./assets/wikipediaOcelot.wav" - +@pytest.mark.skip() class TestAudio(AzureRecordedTestCase): @configure diff --git a/sdk/openai/azure-openai/tests/test_audio_async.py b/sdk/openai/azure-openai/tests/test_audio_async.py index d0f90e9ebe24..6f468a95578c 100644 --- a/sdk/openai/azure-openai/tests/test_audio_async.py +++ b/sdk/openai/azure-openai/tests/test_audio_async.py @@ -13,7 +13,7 @@ audio_test_file = pathlib.Path(__file__).parent / "./assets/hello.m4a" audio_long_test_file = pathlib.Path(__file__).parent / "./assets/wikipediaOcelot.wav" - +@pytest.mark.skip() class TestAudioAsync(AzureRecordedTestCase): @configure_async diff --git a/sdk/openai/azure-openai/tests/test_chat_completions.py b/sdk/openai/azure-openai/tests/test_chat_completions.py index edaea716f256..6096a8ad9136 100644 --- a/sdk/openai/azure-openai/tests/test_chat_completions.py +++ b/sdk/openai/azure-openai/tests/test_chat_completions.py @@ -22,7 +22,7 @@ ENV_AZURE_OPENAI_SEARCH_INDEX ) - +@pytest.mark.skip() class TestChatCompletions(AzureRecordedTestCase): @configure @@ -739,8 +739,7 @@ def test_chat_completion_byod(self, client, api_type, api_version, **kwargs): "endpoint": os.environ[ENV_AZURE_OPENAI_SEARCH_ENDPOINT], "index_name": os.environ[ENV_AZURE_OPENAI_SEARCH_INDEX], "authentication": { - "type": "api_key", - "key": os.environ[ENV_AZURE_OPENAI_SEARCH_KEY], + "type": "system_assigned_managed_identity" } } } @@ -778,8 +777,7 @@ def test_streamed_chat_completions_byod(self, client, api_type, api_version, **k "endpoint": os.environ[ENV_AZURE_OPENAI_SEARCH_ENDPOINT], "index_name": os.environ[ENV_AZURE_OPENAI_SEARCH_INDEX], "authentication": { - "type": "api_key", - "key": os.environ[ENV_AZURE_OPENAI_SEARCH_KEY], + "type": "system_assigned_managed_identity" } } } diff --git a/sdk/openai/azure-openai/tests/test_chat_completions_async.py b/sdk/openai/azure-openai/tests/test_chat_completions_async.py index c29959cf2a7e..7c962f6f8ad3 100644 --- a/sdk/openai/azure-openai/tests/test_chat_completions_async.py +++ b/sdk/openai/azure-openai/tests/test_chat_completions_async.py @@ -22,7 +22,7 @@ ENV_AZURE_OPENAI_SEARCH_INDEX ) - +@pytest.mark.skip() class TestChatCompletionsAsync(AzureRecordedTestCase): @configure_async @@ -756,8 +756,7 @@ async def test_chat_completion_byod(self, client_async, api_type, api_version, * "endpoint": os.environ[ENV_AZURE_OPENAI_SEARCH_ENDPOINT], "index_name": os.environ[ENV_AZURE_OPENAI_SEARCH_INDEX], "authentication": { - "type": "api_key", - "key": os.environ[ENV_AZURE_OPENAI_SEARCH_KEY], + "type": "system_assigned_managed_identity" } } } @@ -796,8 +795,7 @@ async def test_streamed_chat_completions_byod(self, client_async, api_type, api_ "endpoint": os.environ[ENV_AZURE_OPENAI_SEARCH_ENDPOINT], "index_name": os.environ[ENV_AZURE_OPENAI_SEARCH_INDEX], "authentication": { - "type": "api_key", - "key": os.environ[ENV_AZURE_OPENAI_SEARCH_KEY], + "type": "system_assigned_managed_identity" } } } diff --git a/sdk/openai/azure-openai/tests/test_cli.py b/sdk/openai/azure-openai/tests/test_cli.py index 3f746755351f..1c105e0033c7 100644 --- a/sdk/openai/azure-openai/tests/test_cli.py +++ b/sdk/openai/azure-openai/tests/test_cli.py @@ -22,7 +22,7 @@ audio_test_file = pathlib.Path(__file__).parent / "./assets/hello.m4a" - +@pytest.mark.skip() class TestCLI(AzureRecordedTestCase): """No support for embeddings CLI cmd""" diff --git a/sdk/openai/azure-openai/tests/test_client.py b/sdk/openai/azure-openai/tests/test_client.py index 552fa9a31301..569b765e3898 100644 --- a/sdk/openai/azure-openai/tests/test_client.py +++ b/sdk/openai/azure-openai/tests/test_client.py @@ -19,7 +19,7 @@ reload, ) - +@pytest.mark.skip() class TestClient(AzureRecordedTestCase): """Azure AD with token provider is missing here because it is tested per feature""" diff --git a/sdk/openai/azure-openai/tests/test_client_async.py b/sdk/openai/azure-openai/tests/test_client_async.py index f3296676ff4a..b272bfb6fce7 100644 --- a/sdk/openai/azure-openai/tests/test_client_async.py +++ b/sdk/openai/azure-openai/tests/test_client_async.py @@ -19,7 +19,7 @@ reload, ) - +@pytest.mark.skip() class TestClientAsync(AzureRecordedTestCase): """Azure AD with token provider is missing here because it is tested per feature""" diff --git a/sdk/openai/azure-openai/tests/test_completions_async.py b/sdk/openai/azure-openai/tests/test_completions_async.py index 986a27cac14c..df568f4ca21f 100644 --- a/sdk/openai/azure-openai/tests/test_completions_async.py +++ b/sdk/openai/azure-openai/tests/test_completions_async.py @@ -8,7 +8,7 @@ from devtools_testutils import AzureRecordedTestCase from conftest import AZURE, OPENAI, PREVIEW, GA, configure_async - +@pytest.mark.skip() class TestCompletionsAsync(AzureRecordedTestCase): """Missing tests for keyword argument `suffix`""" diff --git a/sdk/openai/azure-openai/tests/test_dall_e.py b/sdk/openai/azure-openai/tests/test_dall_e.py index bbce75dee816..f1f9758125f8 100644 --- a/sdk/openai/azure-openai/tests/test_dall_e.py +++ b/sdk/openai/azure-openai/tests/test_dall_e.py @@ -8,7 +8,7 @@ from devtools_testutils import AzureRecordedTestCase from conftest import configure, DALLE_AZURE, OPENAI, PREVIEW, GA - +@pytest.mark.skip() class TestDallE(AzureRecordedTestCase): @configure diff --git a/sdk/openai/azure-openai/tests/test_dall_e_async.py b/sdk/openai/azure-openai/tests/test_dall_e_async.py index 945186757223..b1519ae25113 100644 --- a/sdk/openai/azure-openai/tests/test_dall_e_async.py +++ b/sdk/openai/azure-openai/tests/test_dall_e_async.py @@ -8,7 +8,7 @@ from devtools_testutils import AzureRecordedTestCase from conftest import configure_async, DALLE_AZURE, OPENAI, PREVIEW, GA - +@pytest.mark.skip() class TestDallEAsync(AzureRecordedTestCase): @configure_async diff --git a/sdk/openai/azure-openai/tests/test_embeddings.py b/sdk/openai/azure-openai/tests/test_embeddings.py index fb56f473d765..03a68b825bbf 100644 --- a/sdk/openai/azure-openai/tests/test_embeddings.py +++ b/sdk/openai/azure-openai/tests/test_embeddings.py @@ -8,7 +8,7 @@ from devtools_testutils import AzureRecordedTestCase from conftest import configure, AZURE, OPENAI, PREVIEW, GA - +@pytest.mark.skip() class TestEmbeddings(AzureRecordedTestCase): @configure diff --git a/sdk/openai/azure-openai/tests/test_embeddings_async.py b/sdk/openai/azure-openai/tests/test_embeddings_async.py index 7c1d86a62da2..cce0f6b6e0fc 100644 --- a/sdk/openai/azure-openai/tests/test_embeddings_async.py +++ b/sdk/openai/azure-openai/tests/test_embeddings_async.py @@ -8,7 +8,7 @@ from devtools_testutils import AzureRecordedTestCase from conftest import configure_async, AZURE, OPENAI, PREVIEW, GA - +@pytest.mark.skip() class TestEmbeddingsAsync(AzureRecordedTestCase): @configure_async diff --git a/sdk/openai/azure-openai/tests/test_models.py b/sdk/openai/azure-openai/tests/test_models.py index 878a15283723..5a1ac641fe90 100644 --- a/sdk/openai/azure-openai/tests/test_models.py +++ b/sdk/openai/azure-openai/tests/test_models.py @@ -10,7 +10,7 @@ from devtools_testutils import AzureRecordedTestCase from conftest import configure, ASST_AZURE, OPENAI, AZURE, PREVIEW, GA - +@pytest.mark.skip() class TestModels(AzureRecordedTestCase): @configure diff --git a/sdk/openai/azure-openai/tests/test_models_async.py b/sdk/openai/azure-openai/tests/test_models_async.py index d87136bba9ea..ac9212c91453 100644 --- a/sdk/openai/azure-openai/tests/test_models_async.py +++ b/sdk/openai/azure-openai/tests/test_models_async.py @@ -10,7 +10,7 @@ from devtools_testutils import AzureRecordedTestCase from conftest import configure_async, ASST_AZURE, OPENAI, AZURE, PREVIEW, GA - +@pytest.mark.skip() class TestModelsAsync(AzureRecordedTestCase): @configure_async diff --git a/sdk/openai/azure-openai/tests/test_module_client.py b/sdk/openai/azure-openai/tests/test_module_client.py index dcde0598cbf4..8fa6f60632ac 100644 --- a/sdk/openai/azure-openai/tests/test_module_client.py +++ b/sdk/openai/azure-openai/tests/test_module_client.py @@ -26,7 +26,7 @@ audio_test_file = pathlib.Path(__file__).parent / "./assets/hello.m4a" - +@pytest.mark.skip() class TestModuleClient(AzureRecordedTestCase): @configure diff --git a/sdk/openai/tests.yml b/sdk/openai/tests.yml index b364bd6850da..d3d7d479f7f6 100644 --- a/sdk/openai/tests.yml +++ b/sdk/openai/tests.yml @@ -5,20 +5,16 @@ extends: parameters: ServiceDirectory: openai TestTimeoutInMinutes: 200 + UseFederatedAuth: true MatrixFilters: - PythonVersion=3.11.* + SubscriptionConfigurationFilePath: eng/common/TestResources/sub-config/AzureOpenAITestingSub.json EnvVars: - AZURE_CLIENT_ID: $(python-openai-client-id) - AZURE_CLIENT_SECRET: $(python-openai-client-secret) - AZURE_TENANT_ID: $(python-openai-tenant-id) AZ_OPENAI_ENDPOINT: $(AOAI-ENDPOINT) AZURE_OPENAI_KEY: $(AOAI-API-KEY) AZURE_OPENAI_NORTHCENTRALUS_ENDPOINT: $(AOAI-ENDPOINT-NORTHCENTRALUS) - AZURE_OPENAI_NORTHCENTRALUS_KEY: $(AOAI-API-KEY-NORTHCENTRALUS) AZURE_OPENAI_SWEDENCENTRAL_ENDPOINT: $(AOAI-ENDPOINT-SWEDENCENTRAL) - AZURE_OPENAI_SWEDENCENTRAL_KEY: $(AOAI-API-KEY-SWEDENCENTRAL) OPENAI_KEY: $(python-nonazure-openai-key) AZURE_OPENAI_SEARCH_ENDPOINT: $(COGNITIVE-SEARCH-API-ENDPOINT) - AZURE_OPENAI_SEARCH_KEY: $(COGNITIVE-SEARCH-API-KEY) AZURE_OPENAI_SEARCH_INDEX: $(COGNITIVE-SEARCH-API-INDEX) AZURE_TEST_RUN_LIVE: 'true' From 6b2a5b42da76141acefa288c8a63d362109b1811 Mon Sep 17 00:00:00 2001 From: Krista Pratico Date: Thu, 30 May 2024 19:21:29 -0700 Subject: [PATCH 05/20] fix --- sdk/openai/tests.yml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/sdk/openai/tests.yml b/sdk/openai/tests.yml index d3d7d479f7f6..e304aace1a8f 100644 --- a/sdk/openai/tests.yml +++ b/sdk/openai/tests.yml @@ -8,7 +8,9 @@ extends: UseFederatedAuth: true MatrixFilters: - PythonVersion=3.11.* - SubscriptionConfigurationFilePath: eng/common/TestResources/sub-config/AzureOpenAITestingSub.json + CloudConfig: + Public: + SubscriptionConfigurationFilePath: eng/common/TestResources/sub-config/AzureOpenAITestingSub.json EnvVars: AZ_OPENAI_ENDPOINT: $(AOAI-ENDPOINT) AZURE_OPENAI_KEY: $(AOAI-API-KEY) From 4ca4a0dbc5937d2c3483296d0b462731d1594880 Mon Sep 17 00:00:00 2001 From: Krista Pratico Date: Fri, 31 May 2024 11:27:23 -0700 Subject: [PATCH 06/20] remove --- sdk/openai/tests.yml | 4 ---- 1 file changed, 4 deletions(-) diff --git a/sdk/openai/tests.yml b/sdk/openai/tests.yml index e304aace1a8f..2d3eb8d82628 100644 --- a/sdk/openai/tests.yml +++ b/sdk/openai/tests.yml @@ -5,12 +5,8 @@ extends: parameters: ServiceDirectory: openai TestTimeoutInMinutes: 200 - UseFederatedAuth: true MatrixFilters: - PythonVersion=3.11.* - CloudConfig: - Public: - SubscriptionConfigurationFilePath: eng/common/TestResources/sub-config/AzureOpenAITestingSub.json EnvVars: AZ_OPENAI_ENDPOINT: $(AOAI-ENDPOINT) AZURE_OPENAI_KEY: $(AOAI-API-KEY) From d9001b6c0b31d94e666199cd6b99068dcf99cdd2 Mon Sep 17 00:00:00 2001 From: Krista Pratico Date: Fri, 31 May 2024 15:54:09 -0700 Subject: [PATCH 07/20] fix import --- sdk/openai/azure-openai/tests/test_cli.py | 1 + 1 file changed, 1 insertion(+) diff --git a/sdk/openai/azure-openai/tests/test_cli.py b/sdk/openai/azure-openai/tests/test_cli.py index 1c105e0033c7..4aa102524e43 100644 --- a/sdk/openai/azure-openai/tests/test_cli.py +++ b/sdk/openai/azure-openai/tests/test_cli.py @@ -7,6 +7,7 @@ import sys import pathlib import subprocess +import pytest from devtools_testutils import AzureRecordedTestCase from azure.identity import DefaultAzureCredential from conftest import ( From 62184d3325e5141dd0a1d91a04def5c8cf2f1153 Mon Sep 17 00:00:00 2001 From: Krista Pratico Date: Fri, 31 May 2024 16:49:25 -0700 Subject: [PATCH 08/20] try --- .../TestResources/sub-config/AzureOpenAITestingSub.json | 4 ++++ sdk/openai/tests.yml | 5 +++++ 2 files changed, 9 insertions(+) diff --git a/eng/common/TestResources/sub-config/AzureOpenAITestingSub.json b/eng/common/TestResources/sub-config/AzureOpenAITestingSub.json index dc251d55ae6f..8590da5730bd 100644 --- a/eng/common/TestResources/sub-config/AzureOpenAITestingSub.json +++ b/eng/common/TestResources/sub-config/AzureOpenAITestingSub.json @@ -1,6 +1,10 @@ { "SubscriptionId": "e72e5254-f265-4e95-9bd2-9ee8e7329051", "TenantId": "72f988bf-86f1-41af-91ab-2d7cd011db47", + "TestApplicationId": "324a31f2-f7b4-4915-bd63-4b2d232c9999", + "TestApplicationOid": "3760ff49-3170-4dd5-92e7-a170440d48b1", + "ProvisionerApplicationId": "324a31f2-f7b4-4915-bd63-4b2d232c9999", + "ProvisionerApplicationOid": "3760ff49-3170-4dd5-92e7-a170440d48b1", "Environment": "AzureCloud", "AzureSubscription": "Speech Services - DEV - SDK (rob)" } \ No newline at end of file diff --git a/sdk/openai/tests.yml b/sdk/openai/tests.yml index 2d3eb8d82628..28ef5a7f93de 100644 --- a/sdk/openai/tests.yml +++ b/sdk/openai/tests.yml @@ -5,8 +5,13 @@ extends: parameters: ServiceDirectory: openai TestTimeoutInMinutes: 200 + UseFederatedAuth: true MatrixFilters: - PythonVersion=3.11.* + CloudConfig: + Public: + ServiceConnection: python-openai-tests + SubscriptionConfigurationFilePath: eng/common/TestResources/sub-config/AzureOpenAITestingSub.json EnvVars: AZ_OPENAI_ENDPOINT: $(AOAI-ENDPOINT) AZURE_OPENAI_KEY: $(AOAI-API-KEY) From e6bc92c21e48b431f861f78dc2ba079e3c3e0308 Mon Sep 17 00:00:00 2001 From: Krista Pratico Date: Fri, 31 May 2024 16:52:22 -0700 Subject: [PATCH 09/20] try different connection --- sdk/openai/tests.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sdk/openai/tests.yml b/sdk/openai/tests.yml index 28ef5a7f93de..ec5a741bcd0d 100644 --- a/sdk/openai/tests.yml +++ b/sdk/openai/tests.yml @@ -10,7 +10,7 @@ extends: - PythonVersion=3.11.* CloudConfig: Public: - ServiceConnection: python-openai-tests + ServiceConnection: azure-sdk-tests SubscriptionConfigurationFilePath: eng/common/TestResources/sub-config/AzureOpenAITestingSub.json EnvVars: AZ_OPENAI_ENDPOINT: $(AOAI-ENDPOINT) From c9142754628cc9365428d08af0a6fde9d44cd7d4 Mon Sep 17 00:00:00 2001 From: Krista Pratico Date: Tue, 4 Jun 2024 14:22:59 -0700 Subject: [PATCH 10/20] update subconfig --- .../TestResources/sub-config/AzureOpenAITestingSub.json | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/eng/common/TestResources/sub-config/AzureOpenAITestingSub.json b/eng/common/TestResources/sub-config/AzureOpenAITestingSub.json index 8590da5730bd..aa593a0b03ee 100644 --- a/eng/common/TestResources/sub-config/AzureOpenAITestingSub.json +++ b/eng/common/TestResources/sub-config/AzureOpenAITestingSub.json @@ -1,10 +1,10 @@ { "SubscriptionId": "e72e5254-f265-4e95-9bd2-9ee8e7329051", "TenantId": "72f988bf-86f1-41af-91ab-2d7cd011db47", - "TestApplicationId": "324a31f2-f7b4-4915-bd63-4b2d232c9999", - "TestApplicationOid": "3760ff49-3170-4dd5-92e7-a170440d48b1", - "ProvisionerApplicationId": "324a31f2-f7b4-4915-bd63-4b2d232c9999", - "ProvisionerApplicationOid": "3760ff49-3170-4dd5-92e7-a170440d48b1", + "TestApplicationId": "", + "TestApplicationOid": "", + "ProvisionerApplicationId": "", + "ProvisionerApplicationOid": "", "Environment": "AzureCloud", "AzureSubscription": "Speech Services - DEV - SDK (rob)" } \ No newline at end of file From c9d026bb5be5a0f8a6105ed246a7fc3ac23629c8 Mon Sep 17 00:00:00 2001 From: Krista Pratico Date: Tue, 4 Jun 2024 15:51:14 -0700 Subject: [PATCH 11/20] byod uses system_assigned_managed_identity --- sdk/openai/azure-openai/tests/test_chat_completions.py | 5 ++--- sdk/openai/azure-openai/tests/test_chat_completions_async.py | 5 ++--- 2 files changed, 4 insertions(+), 6 deletions(-) diff --git a/sdk/openai/azure-openai/tests/test_chat_completions.py b/sdk/openai/azure-openai/tests/test_chat_completions.py index 6096a8ad9136..b67a322806bd 100644 --- a/sdk/openai/azure-openai/tests/test_chat_completions.py +++ b/sdk/openai/azure-openai/tests/test_chat_completions.py @@ -18,7 +18,6 @@ GA, PREVIEW, ENV_AZURE_OPENAI_SEARCH_ENDPOINT, - ENV_AZURE_OPENAI_SEARCH_KEY, ENV_AZURE_OPENAI_SEARCH_INDEX ) @@ -722,7 +721,7 @@ def test_chat_completion_functions_rai(self, client, api_type, api_version, **kw assert content_filter_result["violence"]["severity"] is not None @configure - @pytest.mark.parametrize("api_type, api_version", [(GPT_4_AZURE, GA), (GPT_4_AZURE, PREVIEW)]) + @pytest.mark.parametrize("api_type, api_version", [(AZURE, GA), (AZURE, PREVIEW)]) def test_chat_completion_byod(self, client, api_type, api_version, **kwargs): messages = [ {"role": "system", "content": "You are a helpful assistant."}, @@ -760,7 +759,7 @@ def test_chat_completion_byod(self, client, api_type, api_version, **kwargs): assert completion.choices[0].message.context["intent"] @configure - @pytest.mark.parametrize("api_type, api_version", [(GPT_4_AZURE, GA), (GPT_4_AZURE, PREVIEW)]) + @pytest.mark.parametrize("api_type, api_version", [(AZURE, GA), (AZURE, PREVIEW)]) def test_streamed_chat_completions_byod(self, client, api_type, api_version, **kwargs): messages = [ {"role": "system", "content": "You are a helpful assistant."}, diff --git a/sdk/openai/azure-openai/tests/test_chat_completions_async.py b/sdk/openai/azure-openai/tests/test_chat_completions_async.py index 7c962f6f8ad3..4afcea22a441 100644 --- a/sdk/openai/azure-openai/tests/test_chat_completions_async.py +++ b/sdk/openai/azure-openai/tests/test_chat_completions_async.py @@ -18,7 +18,6 @@ GA, PREVIEW, ENV_AZURE_OPENAI_SEARCH_ENDPOINT, - ENV_AZURE_OPENAI_SEARCH_KEY, ENV_AZURE_OPENAI_SEARCH_INDEX ) @@ -739,7 +738,7 @@ async def test_chat_completion_functions_rai(self, client_async, api_type, api_v @configure_async @pytest.mark.asyncio - @pytest.mark.parametrize("api_type, api_version", [(GPT_4_AZURE, GA), (GPT_4_AZURE, PREVIEW)]) + @pytest.mark.parametrize("api_type, api_version", [(AZURE, GA), (AZURE, PREVIEW)]) async def test_chat_completion_byod(self, client_async, api_type, api_version, **kwargs): messages = [ {"role": "system", "content": "You are a helpful assistant."}, @@ -778,7 +777,7 @@ async def test_chat_completion_byod(self, client_async, api_type, api_version, * @configure_async @pytest.mark.asyncio - @pytest.mark.parametrize("api_type, api_version", [(GPT_4_AZURE, GA), (GPT_4_AZURE, PREVIEW)]) + @pytest.mark.parametrize("api_type, api_version", [(AZURE, GA), (AZURE, PREVIEW)]) async def test_streamed_chat_completions_byod(self, client_async, api_type, api_version, **kwargs): messages = [ {"role": "system", "content": "You are a helpful assistant."}, From 53b5dc8c035803e68915218d2d89ec925b34b3c4 Mon Sep 17 00:00:00 2001 From: Krista Pratico Date: Tue, 4 Jun 2024 15:53:57 -0700 Subject: [PATCH 12/20] remove azure key where not using --- sdk/openai/azure-openai/tests/conftest.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sdk/openai/azure-openai/tests/conftest.py b/sdk/openai/azure-openai/tests/conftest.py index 8b76ea0fede3..9a1516065255 100644 --- a/sdk/openai/azure-openai/tests/conftest.py +++ b/sdk/openai/azure-openai/tests/conftest.py @@ -153,12 +153,12 @@ def build_kwargs(args, api_type): elif api_type == "gpt_4_openai": return {"model": ENV_OPENAI_CHAT_COMPLETIONS_GPT4_MODEL} if test_feature.startswith("test_completions"): - if api_type in ["azure", "azure_key"]: + if api_type == "azure": return {"model": ENV_AZURE_OPENAI_COMPLETIONS_NAME} elif api_type == "openai": return {"model": ENV_OPENAI_COMPLETIONS_MODEL} if test_feature.startswith("test_embeddings"): - if api_type in ["azure", "azure_key"]: + if api_type == "azure": return {"model": ENV_AZURE_OPENAI_EMBEDDINGS_NAME} elif api_type == "openai": return {"model": ENV_OPENAI_EMBEDDINGS_MODEL} From b175faf0c7a54bf52536658342d80d9a65edd34b Mon Sep 17 00:00:00 2001 From: Krista Pratico Date: Tue, 4 Jun 2024 16:01:19 -0700 Subject: [PATCH 13/20] typo --- sdk/openai/azure-openai/tests/test_chat_completions.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sdk/openai/azure-openai/tests/test_chat_completions.py b/sdk/openai/azure-openai/tests/test_chat_completions.py index b67a322806bd..b6223a132db5 100644 --- a/sdk/openai/azure-openai/tests/test_chat_completions.py +++ b/sdk/openai/azure-openai/tests/test_chat_completions.py @@ -54,7 +54,7 @@ def test_azure_api_key(self, client, api_type, api_version, **kwargs): "api_type, api_version", [(AZURE, GA), (AZURE, PREVIEW), (OPENAI, "v1")] ) - def test_chat_completiona(self, client, api_type, api_version, **kwargs): + def test_chat_completion(self, client, api_type, api_version, **kwargs): messages = [ {"role": "system", "content": "You are a helpful assistant."}, {"role": "user", "content": "Who won the world series in 2020?"} From 4afaab70a27311c4e4c62cdd61335494a9e27f91 Mon Sep 17 00:00:00 2001 From: Krista Pratico Date: Tue, 4 Jun 2024 16:01:57 -0700 Subject: [PATCH 14/20] add azure-sdk-tests values to subconfig --- .../TestResources/sub-config/AzureOpenAITestingSub.json | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/eng/common/TestResources/sub-config/AzureOpenAITestingSub.json b/eng/common/TestResources/sub-config/AzureOpenAITestingSub.json index aa593a0b03ee..fa7be0cb9496 100644 --- a/eng/common/TestResources/sub-config/AzureOpenAITestingSub.json +++ b/eng/common/TestResources/sub-config/AzureOpenAITestingSub.json @@ -1,10 +1,10 @@ { "SubscriptionId": "e72e5254-f265-4e95-9bd2-9ee8e7329051", "TenantId": "72f988bf-86f1-41af-91ab-2d7cd011db47", - "TestApplicationId": "", - "TestApplicationOid": "", - "ProvisionerApplicationId": "", - "ProvisionerApplicationOid": "", + "TestApplicationId": "f850650c-1fcf-4489-b46f-71af2e30d360", + "TestApplicationOid": "30511c9d-ba1a-4c7b-b422-5b543da11b3f", + "ProvisionerApplicationId": "f850650c-1fcf-4489-b46f-71af2e30d360", + "ProvisionerApplicationOid": "30511c9d-ba1a-4c7b-b422-5b543da11b3f", "Environment": "AzureCloud", "AzureSubscription": "Speech Services - DEV - SDK (rob)" } \ No newline at end of file From f5f7cdf2e1c564a6ad6d1cc0db52799a97300cbd Mon Sep 17 00:00:00 2001 From: Krista Pratico Date: Tue, 4 Jun 2024 16:08:06 -0700 Subject: [PATCH 15/20] explicitly state model for byod tests --- sdk/openai/azure-openai/tests/test_chat_completions.py | 6 +++--- .../azure-openai/tests/test_chat_completions_async.py | 4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/sdk/openai/azure-openai/tests/test_chat_completions.py b/sdk/openai/azure-openai/tests/test_chat_completions.py index b6223a132db5..980e518e39b8 100644 --- a/sdk/openai/azure-openai/tests/test_chat_completions.py +++ b/sdk/openai/azure-openai/tests/test_chat_completions.py @@ -21,7 +21,7 @@ ENV_AZURE_OPENAI_SEARCH_INDEX ) -@pytest.mark.skip() +# @pytest.mark.skip() class TestChatCompletions(AzureRecordedTestCase): @configure @@ -744,7 +744,7 @@ def test_chat_completion_byod(self, client, api_type, api_version, **kwargs): } ], }, - **kwargs + model="gpt-4" ) assert completion.id assert completion.object == "extensions.chat.completion" @@ -783,7 +783,7 @@ def test_streamed_chat_completions_byod(self, client, api_type, api_version, **k ], }, stream=True, - **kwargs + model="gpt-4" ) for chunk in response: assert chunk.id diff --git a/sdk/openai/azure-openai/tests/test_chat_completions_async.py b/sdk/openai/azure-openai/tests/test_chat_completions_async.py index 4afcea22a441..9c722ad1c1c5 100644 --- a/sdk/openai/azure-openai/tests/test_chat_completions_async.py +++ b/sdk/openai/azure-openai/tests/test_chat_completions_async.py @@ -761,7 +761,7 @@ async def test_chat_completion_byod(self, client_async, api_type, api_version, * } ], }, - **kwargs + model="gpt-4" ) assert completion.id assert completion.object == "extensions.chat.completion" @@ -801,7 +801,7 @@ async def test_streamed_chat_completions_byod(self, client_async, api_type, api_ ], }, stream=True, - **kwargs + model="gpt-4" ) async for chunk in response: assert chunk.id From d03434bc47fe8e76b5eeab860063c68f04a0e604 Mon Sep 17 00:00:00 2001 From: Krista Pratico Date: Tue, 4 Jun 2024 17:58:43 -0700 Subject: [PATCH 16/20] add back optional env and remove skips --- sdk/openai/azure-openai/tests/test_assistants.py | 3 ++- sdk/openai/azure-openai/tests/test_assistants_async.py | 3 ++- sdk/openai/azure-openai/tests/test_audio.py | 3 ++- sdk/openai/azure-openai/tests/test_audio_async.py | 2 +- sdk/openai/azure-openai/tests/test_chat_completions.py | 8 +++----- .../azure-openai/tests/test_chat_completions_async.py | 8 +++----- sdk/openai/azure-openai/tests/test_cli.py | 2 +- sdk/openai/azure-openai/tests/test_client.py | 2 +- sdk/openai/azure-openai/tests/test_client_async.py | 2 +- sdk/openai/azure-openai/tests/test_completions_async.py | 2 +- sdk/openai/azure-openai/tests/test_dall_e.py | 2 +- sdk/openai/azure-openai/tests/test_dall_e_async.py | 2 +- sdk/openai/azure-openai/tests/test_embeddings.py | 2 +- sdk/openai/azure-openai/tests/test_embeddings_async.py | 2 +- sdk/openai/azure-openai/tests/test_models.py | 2 +- sdk/openai/azure-openai/tests/test_models_async.py | 2 +- sdk/openai/azure-openai/tests/test_module_client.py | 2 +- 17 files changed, 24 insertions(+), 25 deletions(-) diff --git a/sdk/openai/azure-openai/tests/test_assistants.py b/sdk/openai/azure-openai/tests/test_assistants.py index 1ec746983e7b..6cb2c3f6ad6f 100644 --- a/sdk/openai/azure-openai/tests/test_assistants.py +++ b/sdk/openai/azure-openai/tests/test_assistants.py @@ -12,7 +12,8 @@ from conftest import ASST_AZURE, PREVIEW, GPT_4_OPENAI, configure TIMEOUT = 300 -@pytest.mark.skip() + + class TestAssistants(AzureRecordedTestCase): @configure diff --git a/sdk/openai/azure-openai/tests/test_assistants_async.py b/sdk/openai/azure-openai/tests/test_assistants_async.py index fda7139c6f0c..4eaf03fc48e1 100644 --- a/sdk/openai/azure-openai/tests/test_assistants_async.py +++ b/sdk/openai/azure-openai/tests/test_assistants_async.py @@ -12,7 +12,8 @@ from conftest import ASST_AZURE, PREVIEW, GPT_4_OPENAI, configure_async TIMEOUT = 300 -@pytest.mark.skip() + + class TestAssistantsAsync(AzureRecordedTestCase): @configure_async diff --git a/sdk/openai/azure-openai/tests/test_audio.py b/sdk/openai/azure-openai/tests/test_audio.py index f59dd5d5c8cc..fdca5ef8fd53 100644 --- a/sdk/openai/azure-openai/tests/test_audio.py +++ b/sdk/openai/azure-openai/tests/test_audio.py @@ -12,7 +12,8 @@ audio_test_file = pathlib.Path(__file__).parent / "./assets/hello.m4a" audio_long_test_file = pathlib.Path(__file__).parent / "./assets/wikipediaOcelot.wav" -@pytest.mark.skip() + + class TestAudio(AzureRecordedTestCase): @configure diff --git a/sdk/openai/azure-openai/tests/test_audio_async.py b/sdk/openai/azure-openai/tests/test_audio_async.py index 6f468a95578c..d0f90e9ebe24 100644 --- a/sdk/openai/azure-openai/tests/test_audio_async.py +++ b/sdk/openai/azure-openai/tests/test_audio_async.py @@ -13,7 +13,7 @@ audio_test_file = pathlib.Path(__file__).parent / "./assets/hello.m4a" audio_long_test_file = pathlib.Path(__file__).parent / "./assets/wikipediaOcelot.wav" -@pytest.mark.skip() + class TestAudioAsync(AzureRecordedTestCase): @configure_async diff --git a/sdk/openai/azure-openai/tests/test_chat_completions.py b/sdk/openai/azure-openai/tests/test_chat_completions.py index 980e518e39b8..135fcfe11154 100644 --- a/sdk/openai/azure-openai/tests/test_chat_completions.py +++ b/sdk/openai/azure-openai/tests/test_chat_completions.py @@ -21,7 +21,7 @@ ENV_AZURE_OPENAI_SEARCH_INDEX ) -# @pytest.mark.skip() + class TestChatCompletions(AzureRecordedTestCase): @configure @@ -810,9 +810,8 @@ def test_chat_completion_seed(self, client, api_type, api_version, **kwargs): ] completion = client.chat.completions.create(messages=messages, seed=42, **kwargs) - assert completion.system_fingerprint - completion = client.chat.completions.create(messages=messages, seed=42, **kwargs) - assert completion.system_fingerprint + if api_type != GPT_4_OPENAI: # bug in openai where system_fingerprint is not always returned + assert completion.system_fingerprint @configure @pytest.mark.parametrize("api_type, api_version", [(GPT_4_AZURE, GA), (GPT_4_AZURE, GA), (GPT_4_OPENAI, "v1")]) @@ -825,7 +824,6 @@ def test_chat_completion_json_response(self, client, api_type, api_version, **kw completion = client.chat.completions.create(messages=messages, response_format={ "type": "json_object" }, **kwargs) assert completion.id assert completion.object == "chat.completion" - assert completion.system_fingerprint assert completion.model assert completion.created assert completion.usage.completion_tokens is not None diff --git a/sdk/openai/azure-openai/tests/test_chat_completions_async.py b/sdk/openai/azure-openai/tests/test_chat_completions_async.py index 9c722ad1c1c5..46919ab4101e 100644 --- a/sdk/openai/azure-openai/tests/test_chat_completions_async.py +++ b/sdk/openai/azure-openai/tests/test_chat_completions_async.py @@ -21,7 +21,7 @@ ENV_AZURE_OPENAI_SEARCH_INDEX ) -@pytest.mark.skip() + class TestChatCompletionsAsync(AzureRecordedTestCase): @configure_async @@ -829,9 +829,8 @@ async def test_chat_completion_seed(self, client_async, api_type, api_version, * ] completion = await client_async.chat.completions.create(messages=messages, seed=42, **kwargs) - assert completion.system_fingerprint - completion = await client_async.chat.completions.create(messages=messages, seed=42, **kwargs) - assert completion.system_fingerprint + if api_type != GPT_4_OPENAI: # bug in openai where system_fingerprint is not always returned + assert completion.system_fingerprint @configure_async @pytest.mark.asyncio @@ -845,7 +844,6 @@ async def test_chat_completion_json_response(self, client_async, api_type, api_v completion = await client_async.chat.completions.create(messages=messages, response_format={ "type": "json_object" }, **kwargs) assert completion.id assert completion.object == "chat.completion" - assert completion.system_fingerprint assert completion.model assert completion.created assert completion.usage.completion_tokens is not None diff --git a/sdk/openai/azure-openai/tests/test_cli.py b/sdk/openai/azure-openai/tests/test_cli.py index 4aa102524e43..ce7397f14cb8 100644 --- a/sdk/openai/azure-openai/tests/test_cli.py +++ b/sdk/openai/azure-openai/tests/test_cli.py @@ -23,7 +23,7 @@ audio_test_file = pathlib.Path(__file__).parent / "./assets/hello.m4a" -@pytest.mark.skip() + class TestCLI(AzureRecordedTestCase): """No support for embeddings CLI cmd""" diff --git a/sdk/openai/azure-openai/tests/test_client.py b/sdk/openai/azure-openai/tests/test_client.py index 569b765e3898..552fa9a31301 100644 --- a/sdk/openai/azure-openai/tests/test_client.py +++ b/sdk/openai/azure-openai/tests/test_client.py @@ -19,7 +19,7 @@ reload, ) -@pytest.mark.skip() + class TestClient(AzureRecordedTestCase): """Azure AD with token provider is missing here because it is tested per feature""" diff --git a/sdk/openai/azure-openai/tests/test_client_async.py b/sdk/openai/azure-openai/tests/test_client_async.py index b272bfb6fce7..f3296676ff4a 100644 --- a/sdk/openai/azure-openai/tests/test_client_async.py +++ b/sdk/openai/azure-openai/tests/test_client_async.py @@ -19,7 +19,7 @@ reload, ) -@pytest.mark.skip() + class TestClientAsync(AzureRecordedTestCase): """Azure AD with token provider is missing here because it is tested per feature""" diff --git a/sdk/openai/azure-openai/tests/test_completions_async.py b/sdk/openai/azure-openai/tests/test_completions_async.py index df568f4ca21f..986a27cac14c 100644 --- a/sdk/openai/azure-openai/tests/test_completions_async.py +++ b/sdk/openai/azure-openai/tests/test_completions_async.py @@ -8,7 +8,7 @@ from devtools_testutils import AzureRecordedTestCase from conftest import AZURE, OPENAI, PREVIEW, GA, configure_async -@pytest.mark.skip() + class TestCompletionsAsync(AzureRecordedTestCase): """Missing tests for keyword argument `suffix`""" diff --git a/sdk/openai/azure-openai/tests/test_dall_e.py b/sdk/openai/azure-openai/tests/test_dall_e.py index f1f9758125f8..bbce75dee816 100644 --- a/sdk/openai/azure-openai/tests/test_dall_e.py +++ b/sdk/openai/azure-openai/tests/test_dall_e.py @@ -8,7 +8,7 @@ from devtools_testutils import AzureRecordedTestCase from conftest import configure, DALLE_AZURE, OPENAI, PREVIEW, GA -@pytest.mark.skip() + class TestDallE(AzureRecordedTestCase): @configure diff --git a/sdk/openai/azure-openai/tests/test_dall_e_async.py b/sdk/openai/azure-openai/tests/test_dall_e_async.py index b1519ae25113..945186757223 100644 --- a/sdk/openai/azure-openai/tests/test_dall_e_async.py +++ b/sdk/openai/azure-openai/tests/test_dall_e_async.py @@ -8,7 +8,7 @@ from devtools_testutils import AzureRecordedTestCase from conftest import configure_async, DALLE_AZURE, OPENAI, PREVIEW, GA -@pytest.mark.skip() + class TestDallEAsync(AzureRecordedTestCase): @configure_async diff --git a/sdk/openai/azure-openai/tests/test_embeddings.py b/sdk/openai/azure-openai/tests/test_embeddings.py index 03a68b825bbf..fb56f473d765 100644 --- a/sdk/openai/azure-openai/tests/test_embeddings.py +++ b/sdk/openai/azure-openai/tests/test_embeddings.py @@ -8,7 +8,7 @@ from devtools_testutils import AzureRecordedTestCase from conftest import configure, AZURE, OPENAI, PREVIEW, GA -@pytest.mark.skip() + class TestEmbeddings(AzureRecordedTestCase): @configure diff --git a/sdk/openai/azure-openai/tests/test_embeddings_async.py b/sdk/openai/azure-openai/tests/test_embeddings_async.py index cce0f6b6e0fc..7c1d86a62da2 100644 --- a/sdk/openai/azure-openai/tests/test_embeddings_async.py +++ b/sdk/openai/azure-openai/tests/test_embeddings_async.py @@ -8,7 +8,7 @@ from devtools_testutils import AzureRecordedTestCase from conftest import configure_async, AZURE, OPENAI, PREVIEW, GA -@pytest.mark.skip() + class TestEmbeddingsAsync(AzureRecordedTestCase): @configure_async diff --git a/sdk/openai/azure-openai/tests/test_models.py b/sdk/openai/azure-openai/tests/test_models.py index 5a1ac641fe90..878a15283723 100644 --- a/sdk/openai/azure-openai/tests/test_models.py +++ b/sdk/openai/azure-openai/tests/test_models.py @@ -10,7 +10,7 @@ from devtools_testutils import AzureRecordedTestCase from conftest import configure, ASST_AZURE, OPENAI, AZURE, PREVIEW, GA -@pytest.mark.skip() + class TestModels(AzureRecordedTestCase): @configure diff --git a/sdk/openai/azure-openai/tests/test_models_async.py b/sdk/openai/azure-openai/tests/test_models_async.py index ac9212c91453..d87136bba9ea 100644 --- a/sdk/openai/azure-openai/tests/test_models_async.py +++ b/sdk/openai/azure-openai/tests/test_models_async.py @@ -10,7 +10,7 @@ from devtools_testutils import AzureRecordedTestCase from conftest import configure_async, ASST_AZURE, OPENAI, AZURE, PREVIEW, GA -@pytest.mark.skip() + class TestModelsAsync(AzureRecordedTestCase): @configure_async diff --git a/sdk/openai/azure-openai/tests/test_module_client.py b/sdk/openai/azure-openai/tests/test_module_client.py index 8fa6f60632ac..dcde0598cbf4 100644 --- a/sdk/openai/azure-openai/tests/test_module_client.py +++ b/sdk/openai/azure-openai/tests/test_module_client.py @@ -26,7 +26,7 @@ audio_test_file = pathlib.Path(__file__).parent / "./assets/hello.m4a" -@pytest.mark.skip() + class TestModuleClient(AzureRecordedTestCase): @configure From f5ce475dfd7b6241a5abda0cbf180cc51c09a2bf Mon Sep 17 00:00:00 2001 From: Krista Pratico Date: Tue, 4 Jun 2024 18:01:40 -0700 Subject: [PATCH 17/20] push missed files --- sdk/openai/azure-openai/dev_requirements.txt | 1 - sdk/openai/azure-openai/pyproject.toml | 8 ++++++++ sdk/openai/tests.yml | 1 + 3 files changed, 9 insertions(+), 1 deletion(-) diff --git a/sdk/openai/azure-openai/dev_requirements.txt b/sdk/openai/azure-openai/dev_requirements.txt index ce42c5cfe5c9..3a7d551667c3 100644 --- a/sdk/openai/azure-openai/dev_requirements.txt +++ b/sdk/openai/azure-openai/dev_requirements.txt @@ -2,4 +2,3 @@ ../../identity/azure-identity httpx aiohttp -openai diff --git a/sdk/openai/azure-openai/pyproject.toml b/sdk/openai/azure-openai/pyproject.toml index e724faf7c64d..bb99b3ca2735 100644 --- a/sdk/openai/azure-openai/pyproject.toml +++ b/sdk/openai/azure-openai/pyproject.toml @@ -4,3 +4,11 @@ mypy = false pyright = false type_check_samples = false verifytypes = false + +[[tool.azure-sdk-build.optional]] +name = "main" +install = ["git+https://github.com/openai/openai-python@main"] + +[[tool.azure-sdk-build.optional]] +name = "released" +install = ["openai"] diff --git a/sdk/openai/tests.yml b/sdk/openai/tests.yml index ec5a741bcd0d..7af53d2f3f81 100644 --- a/sdk/openai/tests.yml +++ b/sdk/openai/tests.yml @@ -5,6 +5,7 @@ extends: parameters: ServiceDirectory: openai TestTimeoutInMinutes: 200 + ToxTestEnv: optional UseFederatedAuth: true MatrixFilters: - PythonVersion=3.11.* From 69591e6b88f71171f2e39811b39adde30a52c23c Mon Sep 17 00:00:00 2001 From: Krista Pratico Date: Wed, 5 Jun 2024 10:02:33 -0700 Subject: [PATCH 18/20] move subconfig to service directory for now --- .../sub-config => sdk/openai}/AzureOpenAITestingSub.json | 3 +-- sdk/openai/tests.yml | 4 ++-- 2 files changed, 3 insertions(+), 4 deletions(-) rename {eng/common/TestResources/sub-config => sdk/openai}/AzureOpenAITestingSub.json (80%) diff --git a/eng/common/TestResources/sub-config/AzureOpenAITestingSub.json b/sdk/openai/AzureOpenAITestingSub.json similarity index 80% rename from eng/common/TestResources/sub-config/AzureOpenAITestingSub.json rename to sdk/openai/AzureOpenAITestingSub.json index fa7be0cb9496..aa7546164bdb 100644 --- a/eng/common/TestResources/sub-config/AzureOpenAITestingSub.json +++ b/sdk/openai/AzureOpenAITestingSub.json @@ -5,6 +5,5 @@ "TestApplicationOid": "30511c9d-ba1a-4c7b-b422-5b543da11b3f", "ProvisionerApplicationId": "f850650c-1fcf-4489-b46f-71af2e30d360", "ProvisionerApplicationOid": "30511c9d-ba1a-4c7b-b422-5b543da11b3f", - "Environment": "AzureCloud", - "AzureSubscription": "Speech Services - DEV - SDK (rob)" + "Environment": "AzureCloud" } \ No newline at end of file diff --git a/sdk/openai/tests.yml b/sdk/openai/tests.yml index 7af53d2f3f81..b08d1c3d344e 100644 --- a/sdk/openai/tests.yml +++ b/sdk/openai/tests.yml @@ -6,13 +6,13 @@ extends: ServiceDirectory: openai TestTimeoutInMinutes: 200 ToxTestEnv: optional - UseFederatedAuth: true MatrixFilters: - PythonVersion=3.11.* + UseFederatedAuth: true CloudConfig: Public: ServiceConnection: azure-sdk-tests - SubscriptionConfigurationFilePath: eng/common/TestResources/sub-config/AzureOpenAITestingSub.json + SubscriptionConfigurationFilePath: AzureOpenAITestingSub.json EnvVars: AZ_OPENAI_ENDPOINT: $(AOAI-ENDPOINT) AZURE_OPENAI_KEY: $(AOAI-API-KEY) From a6aacad2c61cb22f1e339914e018f5b2c5d77e1e Mon Sep 17 00:00:00 2001 From: Krista Pratico Date: Wed, 5 Jun 2024 10:19:46 -0700 Subject: [PATCH 19/20] fix path after moving subconfig --- sdk/openai/tests.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sdk/openai/tests.yml b/sdk/openai/tests.yml index b08d1c3d344e..e48ad26858e3 100644 --- a/sdk/openai/tests.yml +++ b/sdk/openai/tests.yml @@ -12,7 +12,7 @@ extends: CloudConfig: Public: ServiceConnection: azure-sdk-tests - SubscriptionConfigurationFilePath: AzureOpenAITestingSub.json + SubscriptionConfigurationFilePath: sdk/openai/AzureOpenAITestingSub.json EnvVars: AZ_OPENAI_ENDPOINT: $(AOAI-ENDPOINT) AZURE_OPENAI_KEY: $(AOAI-API-KEY) From d41c4702782ae193fd60cf9b5d08646414b42cbb Mon Sep 17 00:00:00 2001 From: Krista Pratico Date: Wed, 5 Jun 2024 14:53:13 -0700 Subject: [PATCH 20/20] simplify --- sdk/openai/AzureOpenAITestingSub.json | 9 --------- sdk/openai/tests.yml | 5 +---- 2 files changed, 1 insertion(+), 13 deletions(-) delete mode 100644 sdk/openai/AzureOpenAITestingSub.json diff --git a/sdk/openai/AzureOpenAITestingSub.json b/sdk/openai/AzureOpenAITestingSub.json deleted file mode 100644 index aa7546164bdb..000000000000 --- a/sdk/openai/AzureOpenAITestingSub.json +++ /dev/null @@ -1,9 +0,0 @@ -{ - "SubscriptionId": "e72e5254-f265-4e95-9bd2-9ee8e7329051", - "TenantId": "72f988bf-86f1-41af-91ab-2d7cd011db47", - "TestApplicationId": "f850650c-1fcf-4489-b46f-71af2e30d360", - "TestApplicationOid": "30511c9d-ba1a-4c7b-b422-5b543da11b3f", - "ProvisionerApplicationId": "f850650c-1fcf-4489-b46f-71af2e30d360", - "ProvisionerApplicationOid": "30511c9d-ba1a-4c7b-b422-5b543da11b3f", - "Environment": "AzureCloud" -} \ No newline at end of file diff --git a/sdk/openai/tests.yml b/sdk/openai/tests.yml index e48ad26858e3..6936fbc34c14 100644 --- a/sdk/openai/tests.yml +++ b/sdk/openai/tests.yml @@ -9,10 +9,7 @@ extends: MatrixFilters: - PythonVersion=3.11.* UseFederatedAuth: true - CloudConfig: - Public: - ServiceConnection: azure-sdk-tests - SubscriptionConfigurationFilePath: sdk/openai/AzureOpenAITestingSub.json + SupportedClouds: 'Public' EnvVars: AZ_OPENAI_ENDPOINT: $(AOAI-ENDPOINT) AZURE_OPENAI_KEY: $(AOAI-API-KEY)