diff --git a/sdk/ai/azure-ai-projects/README.md b/sdk/ai/azure-ai-projects/README.md index 67fa1864a635..317eda80cb6a 100644 --- a/sdk/ai/azure-ai-projects/README.md +++ b/sdk/ai/azure-ai-projects/README.md @@ -104,6 +104,8 @@ with ( credential=credential ) as project_client, ): + # Use project_client here; the context manager closes it on exit. + ... ``` To construct an asynchronous client, install the additional package [aiohttp](https://pypi.org/project/aiohttp/): @@ -127,6 +129,8 @@ async with ( credential=credential ) as project_client, ): + # Use project_client here; the context manager closes it on exit. + ... ``` ### Performing Responses operations using OpenAI client @@ -242,7 +246,7 @@ import sys import logging # Acquire the logger for this client library. Use 'azure' to affect both -# `azure.core` and `azure.ai.projects' libraries. +# `azure.core` and `azure.ai.projects` libraries. logger = logging.getLogger("azure") # Set the desired logging level. logging.INFO or logging.DEBUG are good options. diff --git a/sdk/ai/azure-ai-projects/samples/evaluations/sample_evaluations_score_model_grader_with_audio.py b/sdk/ai/azure-ai-projects/samples/evaluations/sample_evaluations_score_model_grader_with_audio.py index 165bd0f43929..7af590214ca6 100644 --- a/sdk/ai/azure-ai-projects/samples/evaluations/sample_evaluations_score_model_grader_with_audio.py +++ b/sdk/ai/azure-ai-projects/samples/evaluations/sample_evaluations_score_model_grader_with_audio.py @@ -20,10 +20,10 @@ pip install "azure-ai-projects>=2.0.0" azure-identity python-dotenv Set these environment variables with your own values: - 1) AZURE_AI_PROJECT_ENDPOINT - Required. The Azure AI Project endpoint, as found in the overview page of your + 1) FOUNDRY_PROJECT_ENDPOINT - Required. The Azure AI Project endpoint, as found in the overview page of your Microsoft Foundry project. It has the form: https://.services.ai.azure.com/api/projects/. - 2) AZURE_AI_MODEL_DEPLOYMENT_NAME - Required. The name of the model deployment to use for evaluation. - 3) AZURE_AI_MODEL_DEPLOYMENT_NAME_FOR_AUDIO - Required. The name of the model deployment for audio to use for evaluation, recommend to use "gpt-4o-audio-preview" + 2) FOUNDRY_MODEL_NAME - Required. The name of the model deployment to use for evaluation. + 3) FOUNDRY_MODEL_NAME_FOR_AUDIO - Required. The name of the model deployment for audio to use for evaluation, recommend to use "gpt-4o-audio-preview" """ import base64 @@ -48,9 +48,9 @@ file_path = os.path.abspath(__file__) folder_path = os.path.dirname(file_path) -endpoint = os.environ["AZURE_AI_PROJECT_ENDPOINT"] -model_deployment_name = os.environ["AZURE_AI_MODEL_DEPLOYMENT_NAME"] -model_deployment_name_for_audio = os.environ["AZURE_AI_MODEL_DEPLOYMENT_NAME_FOR_AUDIO"] +endpoint = os.environ["FOUNDRY_PROJECT_ENDPOINT"] +model_deployment_name = os.environ["FOUNDRY_MODEL_NAME"] +model_deployment_name_for_audio = os.environ["FOUNDRY_MODEL_NAME_FOR_AUDIO"] def audio_to_base64(audio_path: str) -> str: diff --git a/sdk/ai/azure-ai-projects/samples/evaluations/sample_evaluations_score_model_grader_with_audio_model_target.py b/sdk/ai/azure-ai-projects/samples/evaluations/sample_evaluations_score_model_grader_with_audio_model_target.py index 75eb7b97f566..b080adbfa5d4 100644 --- a/sdk/ai/azure-ai-projects/samples/evaluations/sample_evaluations_score_model_grader_with_audio_model_target.py +++ b/sdk/ai/azure-ai-projects/samples/evaluations/sample_evaluations_score_model_grader_with_audio_model_target.py @@ -20,10 +20,10 @@ pip install "azure-ai-projects>=2.0.0" azure-identity python-dotenv Set these environment variables with your own values: - 1) AZURE_AI_PROJECT_ENDPOINT - Required. The Azure AI Project endpoint, as found in the overview page of your + 1) FOUNDRY_PROJECT_ENDPOINT - Required. The Azure AI Project endpoint, as found in the overview page of your Microsoft Foundry project. It has the form: https://.services.ai.azure.com/api/projects/. - 2) AZURE_AI_MODEL_DEPLOYMENT_NAME - Required. The name of the model deployment to use for evaluation. - 3) AZURE_AI_MODEL_DEPLOYMENT_NAME_FOR_AUDIO - Required. The name of the model deployment for audio to use for evaluation, recommend to use "gpt-4o-audio-preview" + 2) FOUNDRY_MODEL_NAME - Required. The name of the model deployment to use for evaluation. + 3) FOUNDRY_MODEL_NAME_FOR_AUDIO - Required. The name of the model deployment for audio to use for evaluation, recommend to use "gpt-4o-audio-preview" """ import base64 @@ -47,9 +47,9 @@ file_path = os.path.abspath(__file__) folder_path = os.path.dirname(file_path) -endpoint = os.environ["AZURE_AI_PROJECT_ENDPOINT"] -model_deployment_name = os.environ["AZURE_AI_MODEL_DEPLOYMENT_NAME"] -model_deployment_name_for_audio = os.environ["AZURE_AI_MODEL_DEPLOYMENT_NAME_FOR_AUDIO"] +endpoint = os.environ["FOUNDRY_PROJECT_ENDPOINT"] +model_deployment_name = os.environ["FOUNDRY_MODEL_NAME"] +model_deployment_name_for_audio = os.environ["FOUNDRY_MODEL_NAME_FOR_AUDIO"] def audio_to_base64(audio_path: str) -> str: diff --git a/sdk/ai/azure-ai-projects/samples/evaluations/sample_evaluations_score_model_grader_with_image_model_target.py b/sdk/ai/azure-ai-projects/samples/evaluations/sample_evaluations_score_model_grader_with_image_model_target.py index 01a22ccfe588..c54fcde7efc0 100644 --- a/sdk/ai/azure-ai-projects/samples/evaluations/sample_evaluations_score_model_grader_with_image_model_target.py +++ b/sdk/ai/azure-ai-projects/samples/evaluations/sample_evaluations_score_model_grader_with_image_model_target.py @@ -18,9 +18,9 @@ pip install "azure-ai-projects>=2.0.0" azure-identity python-dotenv Pillow Set these environment variables with your own values: - 1) AZURE_AI_PROJECT_ENDPOINT - Required. The Azure AI Project endpoint, as found in the overview page of your + 1) FOUNDRY_PROJECT_ENDPOINT - Required. The Azure AI Project endpoint, as found in the overview page of your Microsoft Foundry project. It has the form: https://.services.ai.azure.com/api/projects/. - 2) AZURE_AI_MODEL_DEPLOYMENT_NAME - Required. The name of the model deployment to use for evaluation. + 2) FOUNDRY_MODEL_NAME - Required. The name of the model deployment to use for evaluation. """ import base64 @@ -47,8 +47,8 @@ file_path = os.path.abspath(__file__) folder_path = os.path.dirname(file_path) -endpoint = os.environ["AZURE_AI_PROJECT_ENDPOINT"] -model_deployment_name = os.environ["AZURE_AI_MODEL_DEPLOYMENT_NAME"] +endpoint = os.environ["FOUNDRY_PROJECT_ENDPOINT"] +model_deployment_name = os.environ["FOUNDRY_MODEL_NAME"] def image_to_data_uri(image_file_path: str) -> str: