diff --git a/sdk/ai/azure-ai-client/azure/ai/client/aio/operations/_patch.py b/sdk/ai/azure-ai-client/azure/ai/client/aio/operations/_patch.py index c424c6d97b44..950d65855134 100644 --- a/sdk/ai/azure-ai-client/azure/ai/client/aio/operations/_patch.py +++ b/sdk/ai/azure-ai-client/azure/ai/client/aio/operations/_patch.py @@ -98,7 +98,7 @@ async def get_embeddings_client(self) -> "EmbeddingsClient": return client - async def get_azure_openai_client(self) -> "AzureOpenAI": + async def get_azure_openai_client(self) -> "AsyncAzureOpenAI": endpoint = await self.outer_instance.endpoints.get_default( endpoint_type=EndpointType.AZURE_OPEN_AI, populate_secrets=True ) @@ -106,7 +106,7 @@ async def get_azure_openai_client(self) -> "AzureOpenAI": raise ValueError("No Azure OpenAI endpoint found.") try: - from openai_async import AzureOpenAI + from openai import AsyncAzureOpenAI except ModuleNotFoundError as _: raise ModuleNotFoundError("OpenAI SDK is not installed. Please install it using 'pip install openai-async'") @@ -114,7 +114,7 @@ async def get_azure_openai_client(self) -> "AzureOpenAI": logger.debug( "[InferenceOperations.get_azure_openai_client] Creating AzureOpenAI using API key authentication" ) - client = AzureOpenAI( + client = AsyncAzureOpenAI( api_key=endpoint.key, azure_endpoint=endpoint.endpoint_url, api_version="2024-08-01-preview", # TODO: Is this needed? @@ -129,7 +129,7 @@ async def get_azure_openai_client(self) -> "AzureOpenAI": raise ModuleNotFoundError( "azure.identity package not installed. Please install it using 'pip install azure.identity'" ) - client = AzureOpenAI( + client = AsyncAzureOpenAI( # See https://learn.microsoft.com/en-us/python/api/azure-identity/azure.identity?view=azure-python#azure-identity-get-bearer-token-provider azure_ad_token_provider=get_bearer_token_provider( endpoint.token_credential, "https://cognitiveservices.azure.com/.default" @@ -139,7 +139,7 @@ async def get_azure_openai_client(self) -> "AzureOpenAI": ) elif endpoint.authentication_type == AuthenticationType.SAS: logger.debug("[InferenceOperations.get_azure_openai_client] Creating AzureOpenAI using SAS authentication") - client = AzureOpenAI( + client = AsyncAzureOpenAI( azure_ad_token_provider=get_bearer_token_provider( endpoint.token_credential, "https://cognitiveservices.azure.com/.default" ), diff --git a/sdk/ai/azure-ai-client/generated_samples/agents_cancel_run_maximum_set_gen.py b/sdk/ai/azure-ai-client/generated_samples/agents_cancel_run_maximum_set_gen.py deleted file mode 100644 index 0fc09fadab61..000000000000 --- a/sdk/ai/azure-ai-client/generated_samples/agents_cancel_run_maximum_set_gen.py +++ /dev/null @@ -1,45 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) Python Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential - -from azure.ai.client import AzureAIClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-ai-client -# USAGE - python agents_cancel_run_maximum_set_gen.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = AzureAIClient( - endpoint="ENDPOINT", - subscription_id="SUBSCRIPTION_ID", - resource_group_name="RESOURCE_GROUP_NAME", - workspace_name="WORKSPACE_NAME", - credential=DefaultAzureCredential(), - ) - - response = client.agents.cancel_run( - thread_id="sxximmrzssszbrz", - run_id="reoghmjcd", - ) - print(response) - - -# x-ms-original-file: 2024-07-01-preview/Agents_CancelRun_MaximumSet_Gen.json -if __name__ == "__main__": - main() diff --git a/sdk/ai/azure-ai-client/generated_samples/agents_cancel_vector_store_file_batch_minimum_set_gen.py b/sdk/ai/azure-ai-client/generated_samples/agents_cancel_vector_store_file_batch_minimum_set_gen.py deleted file mode 100644 index 3108e9a4632c..000000000000 --- a/sdk/ai/azure-ai-client/generated_samples/agents_cancel_vector_store_file_batch_minimum_set_gen.py +++ /dev/null @@ -1,45 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) Python Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential - -from azure.ai.client import AzureAIClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-ai-client -# USAGE - python agents_cancel_vector_store_file_batch_minimum_set_gen.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = AzureAIClient( - endpoint="ENDPOINT", - subscription_id="SUBSCRIPTION_ID", - resource_group_name="RESOURCE_GROUP_NAME", - workspace_name="WORKSPACE_NAME", - credential=DefaultAzureCredential(), - ) - - response = client.agents.cancel_vector_store_file_batch( - vector_store_id="esqgxemsdquv", - batch_id="ukjhmcvwhahdrhhiiyortbbjlhx", - ) - print(response) - - -# x-ms-original-file: 2024-07-01-preview/Agents_CancelVectorStoreFileBatch_MinimumSet_Gen.json -if __name__ == "__main__": - main() diff --git a/sdk/ai/azure-ai-client/generated_samples/agents_delete_agent_minimum_set_gen.py b/sdk/ai/azure-ai-client/generated_samples/agents_delete_agent_minimum_set_gen.py deleted file mode 100644 index 5eedea350f06..000000000000 --- a/sdk/ai/azure-ai-client/generated_samples/agents_delete_agent_minimum_set_gen.py +++ /dev/null @@ -1,44 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) Python Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential - -from azure.ai.client import AzureAIClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-ai-client -# USAGE - python agents_delete_agent_minimum_set_gen.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = AzureAIClient( - endpoint="ENDPOINT", - subscription_id="SUBSCRIPTION_ID", - resource_group_name="RESOURCE_GROUP_NAME", - workspace_name="WORKSPACE_NAME", - credential=DefaultAzureCredential(), - ) - - response = client.agents.delete_agent( - assistant_id="gjbkohvdtcvgmgubguj", - ) - print(response) - - -# x-ms-original-file: 2024-07-01-preview/Agents_DeleteAgent_MinimumSet_Gen.json -if __name__ == "__main__": - main() diff --git a/sdk/ai/azure-ai-client/generated_samples/agents_delete_file_minimum_set_gen.py b/sdk/ai/azure-ai-client/generated_samples/agents_delete_file_minimum_set_gen.py deleted file mode 100644 index d027aed6ae44..000000000000 --- a/sdk/ai/azure-ai-client/generated_samples/agents_delete_file_minimum_set_gen.py +++ /dev/null @@ -1,44 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) Python Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential - -from azure.ai.client import AzureAIClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-ai-client -# USAGE - python agents_delete_file_minimum_set_gen.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = AzureAIClient( - endpoint="ENDPOINT", - subscription_id="SUBSCRIPTION_ID", - resource_group_name="RESOURCE_GROUP_NAME", - workspace_name="WORKSPACE_NAME", - credential=DefaultAzureCredential(), - ) - - response = client.agents.delete_file( - file_id="flyag", - ) - print(response) - - -# x-ms-original-file: 2024-07-01-preview/Agents_DeleteFile_MinimumSet_Gen.json -if __name__ == "__main__": - main() diff --git a/sdk/ai/azure-ai-client/generated_samples/agents_delete_thread_minimum_set_gen.py b/sdk/ai/azure-ai-client/generated_samples/agents_delete_thread_minimum_set_gen.py deleted file mode 100644 index 405b18477a63..000000000000 --- a/sdk/ai/azure-ai-client/generated_samples/agents_delete_thread_minimum_set_gen.py +++ /dev/null @@ -1,44 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) Python Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential - -from azure.ai.client import AzureAIClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-ai-client -# USAGE - python agents_delete_thread_minimum_set_gen.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = AzureAIClient( - endpoint="ENDPOINT", - subscription_id="SUBSCRIPTION_ID", - resource_group_name="RESOURCE_GROUP_NAME", - workspace_name="WORKSPACE_NAME", - credential=DefaultAzureCredential(), - ) - - response = client.agents.delete_thread( - thread_id="zwmmodqpcvxghsghkjw", - ) - print(response) - - -# x-ms-original-file: 2024-07-01-preview/Agents_DeleteThread_MinimumSet_Gen.json -if __name__ == "__main__": - main() diff --git a/sdk/ai/azure-ai-client/generated_samples/agents_delete_vector_store_file_minimum_set_gen.py b/sdk/ai/azure-ai-client/generated_samples/agents_delete_vector_store_file_minimum_set_gen.py deleted file mode 100644 index 92f956c6ff5f..000000000000 --- a/sdk/ai/azure-ai-client/generated_samples/agents_delete_vector_store_file_minimum_set_gen.py +++ /dev/null @@ -1,45 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) Python Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential - -from azure.ai.client import AzureAIClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-ai-client -# USAGE - python agents_delete_vector_store_file_minimum_set_gen.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = AzureAIClient( - endpoint="ENDPOINT", - subscription_id="SUBSCRIPTION_ID", - resource_group_name="RESOURCE_GROUP_NAME", - workspace_name="WORKSPACE_NAME", - credential=DefaultAzureCredential(), - ) - - response = client.agents.delete_vector_store_file( - vector_store_id="hbnrqrcvbsowbuksdrtcqi", - file_id="vzshxliuznhftv", - ) - print(response) - - -# x-ms-original-file: 2024-07-01-preview/Agents_DeleteVectorStoreFile_MinimumSet_Gen.json -if __name__ == "__main__": - main() diff --git a/sdk/ai/azure-ai-client/generated_samples/agents_delete_vector_store_minimum_set_gen.py b/sdk/ai/azure-ai-client/generated_samples/agents_delete_vector_store_minimum_set_gen.py deleted file mode 100644 index 11417b53fa64..000000000000 --- a/sdk/ai/azure-ai-client/generated_samples/agents_delete_vector_store_minimum_set_gen.py +++ /dev/null @@ -1,44 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) Python Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential - -from azure.ai.client import AzureAIClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-ai-client -# USAGE - python agents_delete_vector_store_minimum_set_gen.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = AzureAIClient( - endpoint="ENDPOINT", - subscription_id="SUBSCRIPTION_ID", - resource_group_name="RESOURCE_GROUP_NAME", - workspace_name="WORKSPACE_NAME", - credential=DefaultAzureCredential(), - ) - - response = client.agents.delete_vector_store( - vector_store_id="sshdziwghotwucptzhzgdxpggsedy", - ) - print(response) - - -# x-ms-original-file: 2024-07-01-preview/Agents_DeleteVectorStore_MinimumSet_Gen.json -if __name__ == "__main__": - main() diff --git a/sdk/ai/azure-ai-client/generated_samples/agents_get_agent_minimum_set_gen.py b/sdk/ai/azure-ai-client/generated_samples/agents_get_agent_minimum_set_gen.py deleted file mode 100644 index 5163c2d9357b..000000000000 --- a/sdk/ai/azure-ai-client/generated_samples/agents_get_agent_minimum_set_gen.py +++ /dev/null @@ -1,44 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) Python Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential - -from azure.ai.client import AzureAIClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-ai-client -# USAGE - python agents_get_agent_minimum_set_gen.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = AzureAIClient( - endpoint="ENDPOINT", - subscription_id="SUBSCRIPTION_ID", - resource_group_name="RESOURCE_GROUP_NAME", - workspace_name="WORKSPACE_NAME", - credential=DefaultAzureCredential(), - ) - - response = client.agents.get_agent( - assistant_id="aorarcltzoneckqmfoluejbhgbm", - ) - print(response) - - -# x-ms-original-file: 2024-07-01-preview/Agents_GetAgent_MinimumSet_Gen.json -if __name__ == "__main__": - main() diff --git a/sdk/ai/azure-ai-client/generated_samples/agents_get_file_content_minimum_set_gen.py b/sdk/ai/azure-ai-client/generated_samples/agents_get_file_content_minimum_set_gen.py deleted file mode 100644 index c32dfdd03333..000000000000 --- a/sdk/ai/azure-ai-client/generated_samples/agents_get_file_content_minimum_set_gen.py +++ /dev/null @@ -1,44 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) Python Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential - -from azure.ai.client import AzureAIClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-ai-client -# USAGE - python agents_get_file_content_minimum_set_gen.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = AzureAIClient( - endpoint="ENDPOINT", - subscription_id="SUBSCRIPTION_ID", - resource_group_name="RESOURCE_GROUP_NAME", - workspace_name="WORKSPACE_NAME", - credential=DefaultAzureCredential(), - ) - - response = client.agents.get_file_content( - file_id="oudalhdmazgj", - ) - print(response) - - -# x-ms-original-file: 2024-07-01-preview/Agents_GetFileContent_MinimumSet_Gen.json -if __name__ == "__main__": - main() diff --git a/sdk/ai/azure-ai-client/generated_samples/agents_get_file_minimum_set_gen.py b/sdk/ai/azure-ai-client/generated_samples/agents_get_file_minimum_set_gen.py deleted file mode 100644 index 4f657dffaa2b..000000000000 --- a/sdk/ai/azure-ai-client/generated_samples/agents_get_file_minimum_set_gen.py +++ /dev/null @@ -1,44 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) Python Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential - -from azure.ai.client import AzureAIClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-ai-client -# USAGE - python agents_get_file_minimum_set_gen.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = AzureAIClient( - endpoint="ENDPOINT", - subscription_id="SUBSCRIPTION_ID", - resource_group_name="RESOURCE_GROUP_NAME", - workspace_name="WORKSPACE_NAME", - credential=DefaultAzureCredential(), - ) - - response = client.agents.get_file( - file_id="ahlwbnjjg", - ) - print(response) - - -# x-ms-original-file: 2024-07-01-preview/Agents_GetFile_MinimumSet_Gen.json -if __name__ == "__main__": - main() diff --git a/sdk/ai/azure-ai-client/generated_samples/agents_get_message_minimum_set_gen.py b/sdk/ai/azure-ai-client/generated_samples/agents_get_message_minimum_set_gen.py deleted file mode 100644 index 7f014bca5159..000000000000 --- a/sdk/ai/azure-ai-client/generated_samples/agents_get_message_minimum_set_gen.py +++ /dev/null @@ -1,45 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) Python Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential - -from azure.ai.client import AzureAIClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-ai-client -# USAGE - python agents_get_message_minimum_set_gen.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = AzureAIClient( - endpoint="ENDPOINT", - subscription_id="SUBSCRIPTION_ID", - resource_group_name="RESOURCE_GROUP_NAME", - workspace_name="WORKSPACE_NAME", - credential=DefaultAzureCredential(), - ) - - response = client.agents.get_message( - thread_id="secglofbhaocemzzskoeatl", - message_id="axpvtnmnjmpctkmnoswam", - ) - print(response) - - -# x-ms-original-file: 2024-07-01-preview/Agents_GetMessage_MinimumSet_Gen.json -if __name__ == "__main__": - main() diff --git a/sdk/ai/azure-ai-client/generated_samples/agents_get_run_maximum_set_gen.py b/sdk/ai/azure-ai-client/generated_samples/agents_get_run_maximum_set_gen.py deleted file mode 100644 index c939bf8d423b..000000000000 --- a/sdk/ai/azure-ai-client/generated_samples/agents_get_run_maximum_set_gen.py +++ /dev/null @@ -1,45 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) Python Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential - -from azure.ai.client import AzureAIClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-ai-client -# USAGE - python agents_get_run_maximum_set_gen.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = AzureAIClient( - endpoint="ENDPOINT", - subscription_id="SUBSCRIPTION_ID", - resource_group_name="RESOURCE_GROUP_NAME", - workspace_name="WORKSPACE_NAME", - credential=DefaultAzureCredential(), - ) - - response = client.agents.get_run( - thread_id="ilcsibdqbvldqyvmbjjtvirntap", - run_id="scpdacucqpuoqjihekkeolfpdyeea", - ) - print(response) - - -# x-ms-original-file: 2024-07-01-preview/Agents_GetRun_MaximumSet_Gen.json -if __name__ == "__main__": - main() diff --git a/sdk/ai/azure-ai-client/generated_samples/agents_get_run_step_minimum_set_gen.py b/sdk/ai/azure-ai-client/generated_samples/agents_get_run_step_minimum_set_gen.py deleted file mode 100644 index 747950b6e57f..000000000000 --- a/sdk/ai/azure-ai-client/generated_samples/agents_get_run_step_minimum_set_gen.py +++ /dev/null @@ -1,46 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) Python Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential - -from azure.ai.client import AzureAIClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-ai-client -# USAGE - python agents_get_run_step_minimum_set_gen.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = AzureAIClient( - endpoint="ENDPOINT", - subscription_id="SUBSCRIPTION_ID", - resource_group_name="RESOURCE_GROUP_NAME", - workspace_name="WORKSPACE_NAME", - credential=DefaultAzureCredential(), - ) - - response = client.agents.get_run_step( - thread_id="jwopmhvryvcpltxhimyrvkcwel", - run_id="echizvrhsigfce", - step_id="kc", - ) - print(response) - - -# x-ms-original-file: 2024-07-01-preview/Agents_GetRunStep_MinimumSet_Gen.json -if __name__ == "__main__": - main() diff --git a/sdk/ai/azure-ai-client/generated_samples/agents_get_thread_minimum_set_gen.py b/sdk/ai/azure-ai-client/generated_samples/agents_get_thread_minimum_set_gen.py deleted file mode 100644 index e549f5ee4f80..000000000000 --- a/sdk/ai/azure-ai-client/generated_samples/agents_get_thread_minimum_set_gen.py +++ /dev/null @@ -1,44 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) Python Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential - -from azure.ai.client import AzureAIClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-ai-client -# USAGE - python agents_get_thread_minimum_set_gen.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = AzureAIClient( - endpoint="ENDPOINT", - subscription_id="SUBSCRIPTION_ID", - resource_group_name="RESOURCE_GROUP_NAME", - workspace_name="WORKSPACE_NAME", - credential=DefaultAzureCredential(), - ) - - response = client.agents.get_thread( - thread_id="tyfreqamibskuzfoyo", - ) - print(response) - - -# x-ms-original-file: 2024-07-01-preview/Agents_GetThread_MinimumSet_Gen.json -if __name__ == "__main__": - main() diff --git a/sdk/ai/azure-ai-client/generated_samples/agents_get_vector_store_file_batch_minimum_set_gen.py b/sdk/ai/azure-ai-client/generated_samples/agents_get_vector_store_file_batch_minimum_set_gen.py deleted file mode 100644 index d1084d004d10..000000000000 --- a/sdk/ai/azure-ai-client/generated_samples/agents_get_vector_store_file_batch_minimum_set_gen.py +++ /dev/null @@ -1,45 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) Python Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential - -from azure.ai.client import AzureAIClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-ai-client -# USAGE - python agents_get_vector_store_file_batch_minimum_set_gen.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = AzureAIClient( - endpoint="ENDPOINT", - subscription_id="SUBSCRIPTION_ID", - resource_group_name="RESOURCE_GROUP_NAME", - workspace_name="WORKSPACE_NAME", - credential=DefaultAzureCredential(), - ) - - response = client.agents.get_vector_store_file_batch( - vector_store_id="lbs", - batch_id="zxqbzpge", - ) - print(response) - - -# x-ms-original-file: 2024-07-01-preview/Agents_GetVectorStoreFileBatch_MinimumSet_Gen.json -if __name__ == "__main__": - main() diff --git a/sdk/ai/azure-ai-client/generated_samples/agents_get_vector_store_file_minimum_set_gen.py b/sdk/ai/azure-ai-client/generated_samples/agents_get_vector_store_file_minimum_set_gen.py deleted file mode 100644 index ed62cc06a203..000000000000 --- a/sdk/ai/azure-ai-client/generated_samples/agents_get_vector_store_file_minimum_set_gen.py +++ /dev/null @@ -1,45 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) Python Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential - -from azure.ai.client import AzureAIClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-ai-client -# USAGE - python agents_get_vector_store_file_minimum_set_gen.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = AzureAIClient( - endpoint="ENDPOINT", - subscription_id="SUBSCRIPTION_ID", - resource_group_name="RESOURCE_GROUP_NAME", - workspace_name="WORKSPACE_NAME", - credential=DefaultAzureCredential(), - ) - - response = client.agents.get_vector_store_file( - vector_store_id="tcpppckhbcqnmxcpqnsdhmocbfkvw", - file_id="swmxwhxjbntnayymmrrocysdsrio", - ) - print(response) - - -# x-ms-original-file: 2024-07-01-preview/Agents_GetVectorStoreFile_MinimumSet_Gen.json -if __name__ == "__main__": - main() diff --git a/sdk/ai/azure-ai-client/generated_samples/agents_get_vector_store_minimum_set_gen.py b/sdk/ai/azure-ai-client/generated_samples/agents_get_vector_store_minimum_set_gen.py deleted file mode 100644 index 6fa3b60a5e04..000000000000 --- a/sdk/ai/azure-ai-client/generated_samples/agents_get_vector_store_minimum_set_gen.py +++ /dev/null @@ -1,44 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) Python Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential - -from azure.ai.client import AzureAIClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-ai-client -# USAGE - python agents_get_vector_store_minimum_set_gen.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = AzureAIClient( - endpoint="ENDPOINT", - subscription_id="SUBSCRIPTION_ID", - resource_group_name="RESOURCE_GROUP_NAME", - workspace_name="WORKSPACE_NAME", - credential=DefaultAzureCredential(), - ) - - response = client.agents.get_vector_store( - vector_store_id="imldyfrenvwrdahxomrvypghklgzfm", - ) - print(response) - - -# x-ms-original-file: 2024-07-01-preview/Agents_GetVectorStore_MinimumSet_Gen.json -if __name__ == "__main__": - main() diff --git a/sdk/ai/azure-ai-client/generated_samples/agents_list_agents_minimum_set_gen.py b/sdk/ai/azure-ai-client/generated_samples/agents_list_agents_minimum_set_gen.py deleted file mode 100644 index 88cf1458e1ce..000000000000 --- a/sdk/ai/azure-ai-client/generated_samples/agents_list_agents_minimum_set_gen.py +++ /dev/null @@ -1,42 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) Python Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential - -from azure.ai.client import AzureAIClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-ai-client -# USAGE - python agents_list_agents_minimum_set_gen.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = AzureAIClient( - endpoint="ENDPOINT", - subscription_id="SUBSCRIPTION_ID", - resource_group_name="RESOURCE_GROUP_NAME", - workspace_name="WORKSPACE_NAME", - credential=DefaultAzureCredential(), - ) - - response = client.agents.list_agents() - print(response) - - -# x-ms-original-file: 2024-07-01-preview/Agents_ListAgents_MinimumSet_Gen.json -if __name__ == "__main__": - main() diff --git a/sdk/ai/azure-ai-client/generated_samples/agents_list_files_minimum_set_gen.py b/sdk/ai/azure-ai-client/generated_samples/agents_list_files_minimum_set_gen.py deleted file mode 100644 index 81f7cd719fe5..000000000000 --- a/sdk/ai/azure-ai-client/generated_samples/agents_list_files_minimum_set_gen.py +++ /dev/null @@ -1,42 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) Python Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential - -from azure.ai.client import AzureAIClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-ai-client -# USAGE - python agents_list_files_minimum_set_gen.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = AzureAIClient( - endpoint="ENDPOINT", - subscription_id="SUBSCRIPTION_ID", - resource_group_name="RESOURCE_GROUP_NAME", - workspace_name="WORKSPACE_NAME", - credential=DefaultAzureCredential(), - ) - - response = client.agents.list_files() - print(response) - - -# x-ms-original-file: 2024-07-01-preview/Agents_ListFiles_MinimumSet_Gen.json -if __name__ == "__main__": - main() diff --git a/sdk/ai/azure-ai-client/generated_samples/agents_list_messages_minimum_set_gen.py b/sdk/ai/azure-ai-client/generated_samples/agents_list_messages_minimum_set_gen.py deleted file mode 100644 index 39c7f858737f..000000000000 --- a/sdk/ai/azure-ai-client/generated_samples/agents_list_messages_minimum_set_gen.py +++ /dev/null @@ -1,44 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) Python Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential - -from azure.ai.client import AzureAIClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-ai-client -# USAGE - python agents_list_messages_minimum_set_gen.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = AzureAIClient( - endpoint="ENDPOINT", - subscription_id="SUBSCRIPTION_ID", - resource_group_name="RESOURCE_GROUP_NAME", - workspace_name="WORKSPACE_NAME", - credential=DefaultAzureCredential(), - ) - - response = client.agents.list_messages( - thread_id="bpo", - ) - print(response) - - -# x-ms-original-file: 2024-07-01-preview/Agents_ListMessages_MinimumSet_Gen.json -if __name__ == "__main__": - main() diff --git a/sdk/ai/azure-ai-client/generated_samples/agents_list_run_steps_minimum_set_gen.py b/sdk/ai/azure-ai-client/generated_samples/agents_list_run_steps_minimum_set_gen.py deleted file mode 100644 index 783eed5ea9ce..000000000000 --- a/sdk/ai/azure-ai-client/generated_samples/agents_list_run_steps_minimum_set_gen.py +++ /dev/null @@ -1,45 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) Python Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential - -from azure.ai.client import AzureAIClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-ai-client -# USAGE - python agents_list_run_steps_minimum_set_gen.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = AzureAIClient( - endpoint="ENDPOINT", - subscription_id="SUBSCRIPTION_ID", - resource_group_name="RESOURCE_GROUP_NAME", - workspace_name="WORKSPACE_NAME", - credential=DefaultAzureCredential(), - ) - - response = client.agents.list_run_steps( - thread_id="rgpbsplbzxqewjirwdhbcvc", - run_id="jjtdybnzsckqsid", - ) - print(response) - - -# x-ms-original-file: 2024-07-01-preview/Agents_ListRunSteps_MinimumSet_Gen.json -if __name__ == "__main__": - main() diff --git a/sdk/ai/azure-ai-client/generated_samples/agents_list_runs_maximum_set_gen.py b/sdk/ai/azure-ai-client/generated_samples/agents_list_runs_maximum_set_gen.py deleted file mode 100644 index 4827529a038e..000000000000 --- a/sdk/ai/azure-ai-client/generated_samples/agents_list_runs_maximum_set_gen.py +++ /dev/null @@ -1,44 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) Python Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential - -from azure.ai.client import AzureAIClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-ai-client -# USAGE - python agents_list_runs_maximum_set_gen.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = AzureAIClient( - endpoint="ENDPOINT", - subscription_id="SUBSCRIPTION_ID", - resource_group_name="RESOURCE_GROUP_NAME", - workspace_name="WORKSPACE_NAME", - credential=DefaultAzureCredential(), - ) - - response = client.agents.list_runs( - thread_id="mkbrj", - ) - print(response) - - -# x-ms-original-file: 2024-07-01-preview/Agents_ListRuns_MaximumSet_Gen.json -if __name__ == "__main__": - main() diff --git a/sdk/ai/azure-ai-client/generated_samples/agents_list_vector_store_file_batch_files_minimum_set_gen.py b/sdk/ai/azure-ai-client/generated_samples/agents_list_vector_store_file_batch_files_minimum_set_gen.py deleted file mode 100644 index 1b54f84a9f2d..000000000000 --- a/sdk/ai/azure-ai-client/generated_samples/agents_list_vector_store_file_batch_files_minimum_set_gen.py +++ /dev/null @@ -1,45 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) Python Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential - -from azure.ai.client import AzureAIClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-ai-client -# USAGE - python agents_list_vector_store_file_batch_files_minimum_set_gen.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = AzureAIClient( - endpoint="ENDPOINT", - subscription_id="SUBSCRIPTION_ID", - resource_group_name="RESOURCE_GROUP_NAME", - workspace_name="WORKSPACE_NAME", - credential=DefaultAzureCredential(), - ) - - response = client.agents.list_vector_store_file_batch_files( - vector_store_id="vdelhyyzsgiavifhhzvtvqeqhhsuh", - batch_id="gffqfjubkoliaarvbyq", - ) - print(response) - - -# x-ms-original-file: 2024-07-01-preview/Agents_ListVectorStoreFileBatchFiles_MinimumSet_Gen.json -if __name__ == "__main__": - main() diff --git a/sdk/ai/azure-ai-client/generated_samples/agents_list_vector_store_files_minimum_set_gen.py b/sdk/ai/azure-ai-client/generated_samples/agents_list_vector_store_files_minimum_set_gen.py deleted file mode 100644 index 405fc7ae13d9..000000000000 --- a/sdk/ai/azure-ai-client/generated_samples/agents_list_vector_store_files_minimum_set_gen.py +++ /dev/null @@ -1,44 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) Python Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential - -from azure.ai.client import AzureAIClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-ai-client -# USAGE - python agents_list_vector_store_files_minimum_set_gen.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = AzureAIClient( - endpoint="ENDPOINT", - subscription_id="SUBSCRIPTION_ID", - resource_group_name="RESOURCE_GROUP_NAME", - workspace_name="WORKSPACE_NAME", - credential=DefaultAzureCredential(), - ) - - response = client.agents.list_vector_store_files( - vector_store_id="al", - ) - print(response) - - -# x-ms-original-file: 2024-07-01-preview/Agents_ListVectorStoreFiles_MinimumSet_Gen.json -if __name__ == "__main__": - main() diff --git a/sdk/ai/azure-ai-client/generated_samples/agents_list_vector_stores_minimum_set_gen.py b/sdk/ai/azure-ai-client/generated_samples/agents_list_vector_stores_minimum_set_gen.py deleted file mode 100644 index b731ec0b53d4..000000000000 --- a/sdk/ai/azure-ai-client/generated_samples/agents_list_vector_stores_minimum_set_gen.py +++ /dev/null @@ -1,42 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) Python Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential - -from azure.ai.client import AzureAIClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-ai-client -# USAGE - python agents_list_vector_stores_minimum_set_gen.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = AzureAIClient( - endpoint="ENDPOINT", - subscription_id="SUBSCRIPTION_ID", - resource_group_name="RESOURCE_GROUP_NAME", - workspace_name="WORKSPACE_NAME", - credential=DefaultAzureCredential(), - ) - - response = client.agents.list_vector_stores() - print(response) - - -# x-ms-original-file: 2024-07-01-preview/Agents_ListVectorStores_MinimumSet_Gen.json -if __name__ == "__main__": - main() diff --git a/sdk/ai/azure-ai-client/generated_samples/agents_update_run_maximum_set_gen.py b/sdk/ai/azure-ai-client/generated_samples/agents_update_run_maximum_set_gen.py deleted file mode 100644 index a04f7a260322..000000000000 --- a/sdk/ai/azure-ai-client/generated_samples/agents_update_run_maximum_set_gen.py +++ /dev/null @@ -1,46 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) Python Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential - -from azure.ai.client import AzureAIClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-ai-client -# USAGE - python agents_update_run_maximum_set_gen.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = AzureAIClient( - endpoint="ENDPOINT", - subscription_id="SUBSCRIPTION_ID", - resource_group_name="RESOURCE_GROUP_NAME", - workspace_name="WORKSPACE_NAME", - credential=DefaultAzureCredential(), - ) - - response = client.agents.update_run( - thread_id="rtzvfjw", - run_id="ibopwyspzczc", - body={"metadata": {"key5931": "ojeukdviplvt"}}, - ) - print(response) - - -# x-ms-original-file: 2024-07-01-preview/Agents_UpdateRun_MaximumSet_Gen.json -if __name__ == "__main__": - main() diff --git a/sdk/ai/azure-ai-client/generated_samples/evaluations_create_maximum_set_gen.py b/sdk/ai/azure-ai-client/generated_samples/evaluations_create_maximum_set_gen.py deleted file mode 100644 index 86f5b25179f9..000000000000 --- a/sdk/ai/azure-ai-client/generated_samples/evaluations_create_maximum_set_gen.py +++ /dev/null @@ -1,55 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) Python Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential - -from azure.ai.client import AzureAIClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-ai-client -# USAGE - python evaluations_create_maximum_set_gen.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = AzureAIClient( - endpoint="ENDPOINT", - subscription_id="SUBSCRIPTION_ID", - resource_group_name="RESOURCE_GROUP_NAME", - workspace_name="WORKSPACE_NAME", - credential=DefaultAzureCredential(), - ) - - response = client.evaluations.create( - evaluation={ - "data": {"Uri": "bzelztdbitxoxsrqlthlnacjssata", "type": "Evaluations.InputData"}, - "description": "dfydblbzvilyvhdtqo", - "displayName": "lresoznoqbpwvsummatfyc", - "evaluators": { - "key4462": {"dataMapping": {"key6077": "rkegahkqoagtfoxuxizgo"}, "id": "bodhxfmbqquu", "initParams": {}} - }, - "id": "qfkteoypwndeirixziosai", - "properties": {"key6705": "eooztvyhcibkecr"}, - "systemData": {}, - "tags": {"key9950": "umaulvau"}, - }, - ) - print(response) - - -# x-ms-original-file: 2024-07-01-preview/Evaluations_Create_MaximumSet_Gen.json -if __name__ == "__main__": - main() diff --git a/sdk/ai/azure-ai-client/generated_samples/evaluations_create_minimum_set_gen.py b/sdk/ai/azure-ai-client/generated_samples/evaluations_create_minimum_set_gen.py deleted file mode 100644 index b74d321cf74d..000000000000 --- a/sdk/ai/azure-ai-client/generated_samples/evaluations_create_minimum_set_gen.py +++ /dev/null @@ -1,47 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) Python Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential - -from azure.ai.client import AzureAIClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-ai-client -# USAGE - python evaluations_create_minimum_set_gen.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = AzureAIClient( - endpoint="ENDPOINT", - subscription_id="SUBSCRIPTION_ID", - resource_group_name="RESOURCE_GROUP_NAME", - workspace_name="WORKSPACE_NAME", - credential=DefaultAzureCredential(), - ) - - response = client.evaluations.create( - evaluation={ - "data": {"Uri": "bzelztdbitxoxsrqlthlnacjssata", "type": "Evaluations.InputData"}, - "evaluators": {}, - }, - ) - print(response) - - -# x-ms-original-file: 2024-07-01-preview/Evaluations_Create_MinimumSet_Gen.json -if __name__ == "__main__": - main() diff --git a/sdk/ai/azure-ai-client/generated_samples/evaluations_get_maximum_set_gen.py b/sdk/ai/azure-ai-client/generated_samples/evaluations_get_maximum_set_gen.py deleted file mode 100644 index a20226495dcf..000000000000 --- a/sdk/ai/azure-ai-client/generated_samples/evaluations_get_maximum_set_gen.py +++ /dev/null @@ -1,44 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) Python Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential - -from azure.ai.client import AzureAIClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-ai-client -# USAGE - python evaluations_get_maximum_set_gen.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = AzureAIClient( - endpoint="ENDPOINT", - subscription_id="SUBSCRIPTION_ID", - resource_group_name="RESOURCE_GROUP_NAME", - workspace_name="WORKSPACE_NAME", - credential=DefaultAzureCredential(), - ) - - response = client.evaluations.get( - id="93-", - ) - print(response) - - -# x-ms-original-file: 2024-07-01-preview/Evaluations_Get_MaximumSet_Gen.json -if __name__ == "__main__": - main() diff --git a/sdk/ai/azure-ai-client/generated_samples/evaluations_get_minimum_set_gen.py b/sdk/ai/azure-ai-client/generated_samples/evaluations_get_minimum_set_gen.py deleted file mode 100644 index 33bd9bc4aede..000000000000 --- a/sdk/ai/azure-ai-client/generated_samples/evaluations_get_minimum_set_gen.py +++ /dev/null @@ -1,44 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) Python Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential - -from azure.ai.client import AzureAIClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-ai-client -# USAGE - python evaluations_get_minimum_set_gen.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = AzureAIClient( - endpoint="ENDPOINT", - subscription_id="SUBSCRIPTION_ID", - resource_group_name="RESOURCE_GROUP_NAME", - workspace_name="WORKSPACE_NAME", - credential=DefaultAzureCredential(), - ) - - response = client.evaluations.get( - id="0_0", - ) - print(response) - - -# x-ms-original-file: 2024-07-01-preview/Evaluations_Get_MinimumSet_Gen.json -if __name__ == "__main__": - main() diff --git a/sdk/ai/azure-ai-client/generated_samples/evaluations_list_maximum_set_gen.py b/sdk/ai/azure-ai-client/generated_samples/evaluations_list_maximum_set_gen.py deleted file mode 100644 index e472a0399432..000000000000 --- a/sdk/ai/azure-ai-client/generated_samples/evaluations_list_maximum_set_gen.py +++ /dev/null @@ -1,43 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) Python Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential - -from azure.ai.client import AzureAIClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-ai-client -# USAGE - python evaluations_list_maximum_set_gen.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = AzureAIClient( - endpoint="ENDPOINT", - subscription_id="SUBSCRIPTION_ID", - resource_group_name="RESOURCE_GROUP_NAME", - workspace_name="WORKSPACE_NAME", - credential=DefaultAzureCredential(), - ) - - response = client.evaluations.list() - for item in response: - print(item) - - -# x-ms-original-file: 2024-07-01-preview/Evaluations_List_MaximumSet_Gen.json -if __name__ == "__main__": - main() diff --git a/sdk/ai/azure-ai-client/generated_samples/evaluations_list_minimum_set_gen.py b/sdk/ai/azure-ai-client/generated_samples/evaluations_list_minimum_set_gen.py deleted file mode 100644 index 9c4f643f6f9c..000000000000 --- a/sdk/ai/azure-ai-client/generated_samples/evaluations_list_minimum_set_gen.py +++ /dev/null @@ -1,43 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) Python Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential - -from azure.ai.client import AzureAIClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-ai-client -# USAGE - python evaluations_list_minimum_set_gen.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = AzureAIClient( - endpoint="ENDPOINT", - subscription_id="SUBSCRIPTION_ID", - resource_group_name="RESOURCE_GROUP_NAME", - workspace_name="WORKSPACE_NAME", - credential=DefaultAzureCredential(), - ) - - response = client.evaluations.list() - for item in response: - print(item) - - -# x-ms-original-file: 2024-07-01-preview/Evaluations_List_MinimumSet_Gen.json -if __name__ == "__main__": - main() diff --git a/sdk/ai/azure-ai-client/generated_samples/evaluations_update_maximum_set_gen.py b/sdk/ai/azure-ai-client/generated_samples/evaluations_update_maximum_set_gen.py deleted file mode 100644 index dcf90380de75..000000000000 --- a/sdk/ai/azure-ai-client/generated_samples/evaluations_update_maximum_set_gen.py +++ /dev/null @@ -1,49 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) Python Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential - -from azure.ai.client import AzureAIClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-ai-client -# USAGE - python evaluations_update_maximum_set_gen.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = AzureAIClient( - endpoint="ENDPOINT", - subscription_id="SUBSCRIPTION_ID", - resource_group_name="RESOURCE_GROUP_NAME", - workspace_name="WORKSPACE_NAME", - credential=DefaultAzureCredential(), - ) - - response = client.evaluations.update( - id="8y", - update_request={ - "description": "vl", - "displayName": "zkystmqhvncvxnxrhahhulbui", - "tags": {"key6951": "mirtkcesgent"}, - }, - ) - print(response) - - -# x-ms-original-file: 2024-07-01-preview/Evaluations_Update_MaximumSet_Gen.json -if __name__ == "__main__": - main() diff --git a/sdk/ai/azure-ai-client/generated_tests/conftest.py b/sdk/ai/azure-ai-client/generated_tests/conftest.py deleted file mode 100644 index 72c378f12508..000000000000 --- a/sdk/ai/azure-ai-client/generated_tests/conftest.py +++ /dev/null @@ -1,35 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) Python Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -import os -import pytest -from dotenv import load_dotenv -from devtools_testutils import ( - test_proxy, - add_general_regex_sanitizer, - add_body_key_sanitizer, - add_header_regex_sanitizer, -) - -load_dotenv() - - -# For security, please avoid record sensitive identity information in recordings -@pytest.fixture(scope="session", autouse=True) -def add_sanitizers(test_proxy): - azureai_subscription_id = os.environ.get("AZUREAI_SUBSCRIPTION_ID", "00000000-0000-0000-0000-000000000000") - azureai_tenant_id = os.environ.get("AZUREAI_TENANT_ID", "00000000-0000-0000-0000-000000000000") - azureai_client_id = os.environ.get("AZUREAI_CLIENT_ID", "00000000-0000-0000-0000-000000000000") - azureai_client_secret = os.environ.get("AZUREAI_CLIENT_SECRET", "00000000-0000-0000-0000-000000000000") - add_general_regex_sanitizer(regex=azureai_subscription_id, value="00000000-0000-0000-0000-000000000000") - add_general_regex_sanitizer(regex=azureai_tenant_id, value="00000000-0000-0000-0000-000000000000") - add_general_regex_sanitizer(regex=azureai_client_id, value="00000000-0000-0000-0000-000000000000") - add_general_regex_sanitizer(regex=azureai_client_secret, value="00000000-0000-0000-0000-000000000000") - - add_header_regex_sanitizer(key="Set-Cookie", value="[set-cookie;]") - add_header_regex_sanitizer(key="Cookie", value="cookie;") - add_body_key_sanitizer(json_path="$..access_token", value="access_token") diff --git a/sdk/ai/azure-ai-client/generated_tests/test_agents_operations.py b/sdk/ai/azure-ai-client/generated_tests/test_agents_operations.py deleted file mode 100644 index cc587a49dc53..000000000000 --- a/sdk/ai/azure-ai-client/generated_tests/test_agents_operations.py +++ /dev/null @@ -1,606 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) Python Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -import pytest -from devtools_testutils import recorded_by_proxy -from testpreparer import ClientTestBase, Preparer - - -@pytest.mark.skip("you may need to update the auto-generated test case before run it") -class TestAgentsOperations(ClientTestBase): - @Preparer() - @recorded_by_proxy - def test_agents_create_agent(self, _endpoint): - client = self.create_client(endpoint=_endpoint) - response = client.agents.create_agent( - body={ - "model": "str", - "description": "str", - "instructions": "str", - "metadata": {"str": "str"}, - "name": "str", - "response_format": "str", - "temperature": 0.0, - "tool_resources": { - "code_interpreter": {"file_ids": ["str"]}, - "file_search": {"vector_store_ids": ["str"]}, - }, - "tools": ["tool_definition"], - "top_p": 0.0, - }, - model="str", - ) - - # please add some check logic here by yourself - # ... - - @Preparer() - @recorded_by_proxy - def test_agents_list_agents(self, _endpoint): - client = self.create_client(endpoint=_endpoint) - response = client.agents.list_agents() - - # please add some check logic here by yourself - # ... - - @Preparer() - @recorded_by_proxy - def test_agents_get_agent(self, _endpoint): - client = self.create_client(endpoint=_endpoint) - response = client.agents.get_agent( - agent_id="str", - ) - - # please add some check logic here by yourself - # ... - - @Preparer() - @recorded_by_proxy - def test_agents_update_agent(self, _endpoint): - client = self.create_client(endpoint=_endpoint) - response = client.agents.update_agent( - agent_id="str", - body={ - "description": "str", - "instructions": "str", - "metadata": {"str": "str"}, - "model": "str", - "name": "str", - "response_format": "str", - "temperature": 0.0, - "tool_resources": { - "code_interpreter": {"file_ids": ["str"]}, - "file_search": {"vector_store_ids": ["str"]}, - }, - "tools": ["tool_definition"], - "top_p": 0.0, - }, - ) - - # please add some check logic here by yourself - # ... - - @Preparer() - @recorded_by_proxy - def test_agents_delete_agent(self, _endpoint): - client = self.create_client(endpoint=_endpoint) - response = client.agents.delete_agent( - agent_id="str", - ) - - # please add some check logic here by yourself - # ... - - @Preparer() - @recorded_by_proxy - def test_agents_create_thread(self, _endpoint): - client = self.create_client(endpoint=_endpoint) - response = client.agents.create_thread( - body={ - "messages": [ - { - "content": "str", - "role": "str", - "attachments": [{"file_id": "str", "tools": [{"type": "code_interpreter"}]}], - "metadata": {"str": "str"}, - } - ], - "metadata": {"str": "str"}, - "tool_resources": { - "code_interpreter": {"file_ids": ["str"]}, - "file_search": {"vector_store_ids": ["str"]}, - }, - }, - ) - - # please add some check logic here by yourself - # ... - - @Preparer() - @recorded_by_proxy - def test_agents_get_thread(self, _endpoint): - client = self.create_client(endpoint=_endpoint) - response = client.agents.get_thread( - thread_id="str", - ) - - # please add some check logic here by yourself - # ... - - @Preparer() - @recorded_by_proxy - def test_agents_update_thread(self, _endpoint): - client = self.create_client(endpoint=_endpoint) - response = client.agents.update_thread( - thread_id="str", - body={ - "metadata": {"str": "str"}, - "tool_resources": { - "code_interpreter": {"file_ids": ["str"]}, - "file_search": {"vector_store_ids": ["str"]}, - }, - }, - ) - - # please add some check logic here by yourself - # ... - - @Preparer() - @recorded_by_proxy - def test_agents_delete_thread(self, _endpoint): - client = self.create_client(endpoint=_endpoint) - response = client.agents.delete_thread( - thread_id="str", - ) - - # please add some check logic here by yourself - # ... - - @Preparer() - @recorded_by_proxy - def test_agents_create_message(self, _endpoint): - client = self.create_client(endpoint=_endpoint) - response = client.agents.create_message( - thread_id="str", - body={ - "content": "str", - "role": "str", - "attachments": [{"file_id": "str", "tools": [{"type": "code_interpreter"}]}], - "metadata": {"str": "str"}, - }, - role="str", - content="str", - ) - - # please add some check logic here by yourself - # ... - - @Preparer() - @recorded_by_proxy - def test_agents_list_messages(self, _endpoint): - client = self.create_client(endpoint=_endpoint) - response = client.agents.list_messages( - thread_id="str", - ) - - # please add some check logic here by yourself - # ... - - @Preparer() - @recorded_by_proxy - def test_agents_get_message(self, _endpoint): - client = self.create_client(endpoint=_endpoint) - response = client.agents.get_message( - thread_id="str", - message_id="str", - ) - - # please add some check logic here by yourself - # ... - - @Preparer() - @recorded_by_proxy - def test_agents_update_message(self, _endpoint): - client = self.create_client(endpoint=_endpoint) - response = client.agents.update_message( - thread_id="str", - message_id="str", - body={"metadata": {"str": "str"}}, - ) - - # please add some check logic here by yourself - # ... - - @Preparer() - @recorded_by_proxy - def test_agents_create_run(self, _endpoint): - client = self.create_client(endpoint=_endpoint) - response = client.agents.create_run( - thread_id="str", - body={ - "agent_id": "str", - "additional_instructions": "str", - "additional_messages": [ - { - "agent_id": "str", - "attachments": [{"file_id": "str", "tools": [{"type": "code_interpreter"}]}], - "completed_at": "2020-02-20 00:00:00", - "content": ["message_content"], - "created_at": "2020-02-20 00:00:00", - "id": "str", - "incomplete_at": "2020-02-20 00:00:00", - "incomplete_details": {"reason": "str"}, - "metadata": {"str": "str"}, - "object": "thread.message", - "role": "str", - "run_id": "str", - "status": "str", - "thread_id": "str", - } - ], - "instructions": "str", - "max_completion_tokens": 0, - "max_prompt_tokens": 0, - "metadata": {"str": "str"}, - "model": "str", - "response_format": "str", - "stream": bool, - "temperature": 0.0, - "tool_choice": "str", - "tools": ["tool_definition"], - "top_p": 0.0, - "truncation_strategy": {"type": "str", "last_messages": 0}, - }, - agent_id="str", - ) - - # please add some check logic here by yourself - # ... - - @Preparer() - @recorded_by_proxy - def test_agents_list_runs(self, _endpoint): - client = self.create_client(endpoint=_endpoint) - response = client.agents.list_runs( - thread_id="str", - ) - - # please add some check logic here by yourself - # ... - - @Preparer() - @recorded_by_proxy - def test_agents_get_run(self, _endpoint): - client = self.create_client(endpoint=_endpoint) - response = client.agents.get_run( - thread_id="str", - run_id="str", - ) - - # please add some check logic here by yourself - # ... - - @Preparer() - @recorded_by_proxy - def test_agents_update_run(self, _endpoint): - client = self.create_client(endpoint=_endpoint) - response = client.agents.update_run( - thread_id="str", - run_id="str", - body={"metadata": {"str": "str"}}, - ) - - # please add some check logic here by yourself - # ... - - @Preparer() - @recorded_by_proxy - def test_agents_submit_tool_outputs_to_run(self, _endpoint): - client = self.create_client(endpoint=_endpoint) - response = client.agents.submit_tool_outputs_to_run( - thread_id="str", - run_id="str", - body={"tool_outputs": [{"output": "str", "tool_call_id": "str"}], "stream": bool}, - tool_outputs=[{"output": "str", "tool_call_id": "str"}], - ) - - # please add some check logic here by yourself - # ... - - @Preparer() - @recorded_by_proxy - def test_agents_cancel_run(self, _endpoint): - client = self.create_client(endpoint=_endpoint) - response = client.agents.cancel_run( - thread_id="str", - run_id="str", - ) - - # please add some check logic here by yourself - # ... - - @Preparer() - @recorded_by_proxy - def test_agents_create_thread_and_run(self, _endpoint): - client = self.create_client(endpoint=_endpoint) - response = client.agents.create_thread_and_run( - body={ - "agent_id": "str", - "instructions": "str", - "max_completion_tokens": 0, - "max_prompt_tokens": 0, - "metadata": {"str": "str"}, - "model": "str", - "response_format": "str", - "stream": bool, - "temperature": 0.0, - "thread": { - "messages": [ - { - "content": "str", - "role": "str", - "attachments": [{"file_id": "str", "tools": [{"type": "code_interpreter"}]}], - "metadata": {"str": "str"}, - } - ], - "metadata": {"str": "str"}, - "tool_resources": { - "code_interpreter": {"file_ids": ["str"]}, - "file_search": {"vector_store_ids": ["str"]}, - }, - }, - "tool_choice": "str", - "tool_resources": { - "code_interpreter": {"file_ids": ["str"]}, - "file_search": {"vector_store_ids": ["str"]}, - }, - "tools": ["tool_definition"], - "top_p": 0.0, - "truncation_strategy": {"type": "str", "last_messages": 0}, - }, - agent_id="str", - ) - - # please add some check logic here by yourself - # ... - - @Preparer() - @recorded_by_proxy - def test_agents_get_run_step(self, _endpoint): - client = self.create_client(endpoint=_endpoint) - response = client.agents.get_run_step( - thread_id="str", - run_id="str", - step_id="str", - ) - - # please add some check logic here by yourself - # ... - - @Preparer() - @recorded_by_proxy - def test_agents_list_run_steps(self, _endpoint): - client = self.create_client(endpoint=_endpoint) - response = client.agents.list_run_steps( - thread_id="str", - run_id="str", - ) - - # please add some check logic here by yourself - # ... - - @Preparer() - @recorded_by_proxy - def test_agents_list_files(self, _endpoint): - client = self.create_client(endpoint=_endpoint) - response = client.agents.list_files() - - # please add some check logic here by yourself - # ... - - @Preparer() - @recorded_by_proxy - def test_agents_upload_file(self, _endpoint): - client = self.create_client(endpoint=_endpoint) - response = client.agents.upload_file( - body={"file": "filetype", "purpose": "str", "filename": "str"}, - file="filetype", - purpose="str", - ) - - # please add some check logic here by yourself - # ... - - @Preparer() - @recorded_by_proxy - def test_agents_delete_file(self, _endpoint): - client = self.create_client(endpoint=_endpoint) - response = client.agents.delete_file( - file_id="str", - ) - - # please add some check logic here by yourself - # ... - - @Preparer() - @recorded_by_proxy - def test_agents_get_file(self, _endpoint): - client = self.create_client(endpoint=_endpoint) - response = client.agents.get_file( - file_id="str", - ) - - # please add some check logic here by yourself - # ... - - @Preparer() - @recorded_by_proxy - def test_agents_get_file_content(self, _endpoint): - client = self.create_client(endpoint=_endpoint) - response = client.agents.get_file_content( - file_id="str", - ) - - # please add some check logic here by yourself - # ... - - @Preparer() - @recorded_by_proxy - def test_agents_list_vector_stores(self, _endpoint): - client = self.create_client(endpoint=_endpoint) - response = client.agents.list_vector_stores() - - # please add some check logic here by yourself - # ... - - @Preparer() - @recorded_by_proxy - def test_agents_create_vector_store(self, _endpoint): - client = self.create_client(endpoint=_endpoint) - response = client.agents.create_vector_store( - body={ - "chunking_strategy": "vector_store_chunking_strategy_request", - "expires_after": {"anchor": "str", "days": 0}, - "file_ids": ["str"], - "metadata": {"str": "str"}, - "name": "str", - }, - ) - - # please add some check logic here by yourself - # ... - - @Preparer() - @recorded_by_proxy - def test_agents_get_vector_store(self, _endpoint): - client = self.create_client(endpoint=_endpoint) - response = client.agents.get_vector_store( - vector_store_id="str", - ) - - # please add some check logic here by yourself - # ... - - @Preparer() - @recorded_by_proxy - def test_agents_modify_vector_store(self, _endpoint): - client = self.create_client(endpoint=_endpoint) - response = client.agents.modify_vector_store( - vector_store_id="str", - body={"expires_after": {"anchor": "str", "days": 0}, "metadata": {"str": "str"}, "name": "str"}, - ) - - # please add some check logic here by yourself - # ... - - @Preparer() - @recorded_by_proxy - def test_agents_delete_vector_store(self, _endpoint): - client = self.create_client(endpoint=_endpoint) - response = client.agents.delete_vector_store( - vector_store_id="str", - ) - - # please add some check logic here by yourself - # ... - - @Preparer() - @recorded_by_proxy - def test_agents_list_vector_store_files(self, _endpoint): - client = self.create_client(endpoint=_endpoint) - response = client.agents.list_vector_store_files( - vector_store_id="str", - ) - - # please add some check logic here by yourself - # ... - - @Preparer() - @recorded_by_proxy - def test_agents_create_vector_store_file(self, _endpoint): - client = self.create_client(endpoint=_endpoint) - response = client.agents.create_vector_store_file( - vector_store_id="str", - body={"file_id": "str", "chunking_strategy": "vector_store_chunking_strategy_request"}, - file_id="str", - ) - - # please add some check logic here by yourself - # ... - - @Preparer() - @recorded_by_proxy - def test_agents_get_vector_store_file(self, _endpoint): - client = self.create_client(endpoint=_endpoint) - response = client.agents.get_vector_store_file( - vector_store_id="str", - file_id="str", - ) - - # please add some check logic here by yourself - # ... - - @Preparer() - @recorded_by_proxy - def test_agents_delete_vector_store_file(self, _endpoint): - client = self.create_client(endpoint=_endpoint) - response = client.agents.delete_vector_store_file( - vector_store_id="str", - file_id="str", - ) - - # please add some check logic here by yourself - # ... - - @Preparer() - @recorded_by_proxy - def test_agents_create_vector_store_file_batch(self, _endpoint): - client = self.create_client(endpoint=_endpoint) - response = client.agents.create_vector_store_file_batch( - vector_store_id="str", - body={"file_ids": ["str"], "chunking_strategy": "vector_store_chunking_strategy_request"}, - file_ids=["str"], - ) - - # please add some check logic here by yourself - # ... - - @Preparer() - @recorded_by_proxy - def test_agents_get_vector_store_file_batch(self, _endpoint): - client = self.create_client(endpoint=_endpoint) - response = client.agents.get_vector_store_file_batch( - vector_store_id="str", - batch_id="str", - ) - - # please add some check logic here by yourself - # ... - - @Preparer() - @recorded_by_proxy - def test_agents_cancel_vector_store_file_batch(self, _endpoint): - client = self.create_client(endpoint=_endpoint) - response = client.agents.cancel_vector_store_file_batch( - vector_store_id="str", - batch_id="str", - ) - - # please add some check logic here by yourself - # ... - - @Preparer() - @recorded_by_proxy - def test_agents_list_vector_store_file_batch_files(self, _endpoint): - client = self.create_client(endpoint=_endpoint) - response = client.agents.list_vector_store_file_batch_files( - vector_store_id="str", - batch_id="str", - ) - - # please add some check logic here by yourself - # ... diff --git a/sdk/ai/azure-ai-client/generated_tests/test_agents_operations_async.py b/sdk/ai/azure-ai-client/generated_tests/test_agents_operations_async.py deleted file mode 100644 index 56536356a3ae..000000000000 --- a/sdk/ai/azure-ai-client/generated_tests/test_agents_operations_async.py +++ /dev/null @@ -1,607 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) Python Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -import pytest -from devtools_testutils.aio import recorded_by_proxy_async -from testpreparer import Preparer -from testpreparer_async import ClientTestBaseAsync - - -@pytest.mark.skip("you may need to update the auto-generated test case before run it") -class TestAgentsOperationsAsync(ClientTestBaseAsync): - @Preparer() - @recorded_by_proxy_async - async def test_agents_create_agent(self, _endpoint): - client = self.create_async_client(endpoint=_endpoint) - response = await client.agents.create_agent( - body={ - "model": "str", - "description": "str", - "instructions": "str", - "metadata": {"str": "str"}, - "name": "str", - "response_format": "str", - "temperature": 0.0, - "tool_resources": { - "code_interpreter": {"file_ids": ["str"]}, - "file_search": {"vector_store_ids": ["str"]}, - }, - "tools": ["tool_definition"], - "top_p": 0.0, - }, - model="str", - ) - - # please add some check logic here by yourself - # ... - - @Preparer() - @recorded_by_proxy_async - async def test_agents_list_agents(self, _endpoint): - client = self.create_async_client(endpoint=_endpoint) - response = await client.agents.list_agents() - - # please add some check logic here by yourself - # ... - - @Preparer() - @recorded_by_proxy_async - async def test_agents_get_agent(self, _endpoint): - client = self.create_async_client(endpoint=_endpoint) - response = await client.agents.get_agent( - agent_id="str", - ) - - # please add some check logic here by yourself - # ... - - @Preparer() - @recorded_by_proxy_async - async def test_agents_update_agent(self, _endpoint): - client = self.create_async_client(endpoint=_endpoint) - response = await client.agents.update_agent( - agent_id="str", - body={ - "description": "str", - "instructions": "str", - "metadata": {"str": "str"}, - "model": "str", - "name": "str", - "response_format": "str", - "temperature": 0.0, - "tool_resources": { - "code_interpreter": {"file_ids": ["str"]}, - "file_search": {"vector_store_ids": ["str"]}, - }, - "tools": ["tool_definition"], - "top_p": 0.0, - }, - ) - - # please add some check logic here by yourself - # ... - - @Preparer() - @recorded_by_proxy_async - async def test_agents_delete_agent(self, _endpoint): - client = self.create_async_client(endpoint=_endpoint) - response = await client.agents.delete_agent( - agent_id="str", - ) - - # please add some check logic here by yourself - # ... - - @Preparer() - @recorded_by_proxy_async - async def test_agents_create_thread(self, _endpoint): - client = self.create_async_client(endpoint=_endpoint) - response = await client.agents.create_thread( - body={ - "messages": [ - { - "content": "str", - "role": "str", - "attachments": [{"file_id": "str", "tools": [{"type": "code_interpreter"}]}], - "metadata": {"str": "str"}, - } - ], - "metadata": {"str": "str"}, - "tool_resources": { - "code_interpreter": {"file_ids": ["str"]}, - "file_search": {"vector_store_ids": ["str"]}, - }, - }, - ) - - # please add some check logic here by yourself - # ... - - @Preparer() - @recorded_by_proxy_async - async def test_agents_get_thread(self, _endpoint): - client = self.create_async_client(endpoint=_endpoint) - response = await client.agents.get_thread( - thread_id="str", - ) - - # please add some check logic here by yourself - # ... - - @Preparer() - @recorded_by_proxy_async - async def test_agents_update_thread(self, _endpoint): - client = self.create_async_client(endpoint=_endpoint) - response = await client.agents.update_thread( - thread_id="str", - body={ - "metadata": {"str": "str"}, - "tool_resources": { - "code_interpreter": {"file_ids": ["str"]}, - "file_search": {"vector_store_ids": ["str"]}, - }, - }, - ) - - # please add some check logic here by yourself - # ... - - @Preparer() - @recorded_by_proxy_async - async def test_agents_delete_thread(self, _endpoint): - client = self.create_async_client(endpoint=_endpoint) - response = await client.agents.delete_thread( - thread_id="str", - ) - - # please add some check logic here by yourself - # ... - - @Preparer() - @recorded_by_proxy_async - async def test_agents_create_message(self, _endpoint): - client = self.create_async_client(endpoint=_endpoint) - response = await client.agents.create_message( - thread_id="str", - body={ - "content": "str", - "role": "str", - "attachments": [{"file_id": "str", "tools": [{"type": "code_interpreter"}]}], - "metadata": {"str": "str"}, - }, - role="str", - content="str", - ) - - # please add some check logic here by yourself - # ... - - @Preparer() - @recorded_by_proxy_async - async def test_agents_list_messages(self, _endpoint): - client = self.create_async_client(endpoint=_endpoint) - response = await client.agents.list_messages( - thread_id="str", - ) - - # please add some check logic here by yourself - # ... - - @Preparer() - @recorded_by_proxy_async - async def test_agents_get_message(self, _endpoint): - client = self.create_async_client(endpoint=_endpoint) - response = await client.agents.get_message( - thread_id="str", - message_id="str", - ) - - # please add some check logic here by yourself - # ... - - @Preparer() - @recorded_by_proxy_async - async def test_agents_update_message(self, _endpoint): - client = self.create_async_client(endpoint=_endpoint) - response = await client.agents.update_message( - thread_id="str", - message_id="str", - body={"metadata": {"str": "str"}}, - ) - - # please add some check logic here by yourself - # ... - - @Preparer() - @recorded_by_proxy_async - async def test_agents_create_run(self, _endpoint): - client = self.create_async_client(endpoint=_endpoint) - response = await client.agents.create_run( - thread_id="str", - body={ - "agent_id": "str", - "additional_instructions": "str", - "additional_messages": [ - { - "agent_id": "str", - "attachments": [{"file_id": "str", "tools": [{"type": "code_interpreter"}]}], - "completed_at": "2020-02-20 00:00:00", - "content": ["message_content"], - "created_at": "2020-02-20 00:00:00", - "id": "str", - "incomplete_at": "2020-02-20 00:00:00", - "incomplete_details": {"reason": "str"}, - "metadata": {"str": "str"}, - "object": "thread.message", - "role": "str", - "run_id": "str", - "status": "str", - "thread_id": "str", - } - ], - "instructions": "str", - "max_completion_tokens": 0, - "max_prompt_tokens": 0, - "metadata": {"str": "str"}, - "model": "str", - "response_format": "str", - "stream": bool, - "temperature": 0.0, - "tool_choice": "str", - "tools": ["tool_definition"], - "top_p": 0.0, - "truncation_strategy": {"type": "str", "last_messages": 0}, - }, - agent_id="str", - ) - - # please add some check logic here by yourself - # ... - - @Preparer() - @recorded_by_proxy_async - async def test_agents_list_runs(self, _endpoint): - client = self.create_async_client(endpoint=_endpoint) - response = await client.agents.list_runs( - thread_id="str", - ) - - # please add some check logic here by yourself - # ... - - @Preparer() - @recorded_by_proxy_async - async def test_agents_get_run(self, _endpoint): - client = self.create_async_client(endpoint=_endpoint) - response = await client.agents.get_run( - thread_id="str", - run_id="str", - ) - - # please add some check logic here by yourself - # ... - - @Preparer() - @recorded_by_proxy_async - async def test_agents_update_run(self, _endpoint): - client = self.create_async_client(endpoint=_endpoint) - response = await client.agents.update_run( - thread_id="str", - run_id="str", - body={"metadata": {"str": "str"}}, - ) - - # please add some check logic here by yourself - # ... - - @Preparer() - @recorded_by_proxy_async - async def test_agents_submit_tool_outputs_to_run(self, _endpoint): - client = self.create_async_client(endpoint=_endpoint) - response = await client.agents.submit_tool_outputs_to_run( - thread_id="str", - run_id="str", - body={"tool_outputs": [{"output": "str", "tool_call_id": "str"}], "stream": bool}, - tool_outputs=[{"output": "str", "tool_call_id": "str"}], - ) - - # please add some check logic here by yourself - # ... - - @Preparer() - @recorded_by_proxy_async - async def test_agents_cancel_run(self, _endpoint): - client = self.create_async_client(endpoint=_endpoint) - response = await client.agents.cancel_run( - thread_id="str", - run_id="str", - ) - - # please add some check logic here by yourself - # ... - - @Preparer() - @recorded_by_proxy_async - async def test_agents_create_thread_and_run(self, _endpoint): - client = self.create_async_client(endpoint=_endpoint) - response = await client.agents.create_thread_and_run( - body={ - "agent_id": "str", - "instructions": "str", - "max_completion_tokens": 0, - "max_prompt_tokens": 0, - "metadata": {"str": "str"}, - "model": "str", - "response_format": "str", - "stream": bool, - "temperature": 0.0, - "thread": { - "messages": [ - { - "content": "str", - "role": "str", - "attachments": [{"file_id": "str", "tools": [{"type": "code_interpreter"}]}], - "metadata": {"str": "str"}, - } - ], - "metadata": {"str": "str"}, - "tool_resources": { - "code_interpreter": {"file_ids": ["str"]}, - "file_search": {"vector_store_ids": ["str"]}, - }, - }, - "tool_choice": "str", - "tool_resources": { - "code_interpreter": {"file_ids": ["str"]}, - "file_search": {"vector_store_ids": ["str"]}, - }, - "tools": ["tool_definition"], - "top_p": 0.0, - "truncation_strategy": {"type": "str", "last_messages": 0}, - }, - agent_id="str", - ) - - # please add some check logic here by yourself - # ... - - @Preparer() - @recorded_by_proxy_async - async def test_agents_get_run_step(self, _endpoint): - client = self.create_async_client(endpoint=_endpoint) - response = await client.agents.get_run_step( - thread_id="str", - run_id="str", - step_id="str", - ) - - # please add some check logic here by yourself - # ... - - @Preparer() - @recorded_by_proxy_async - async def test_agents_list_run_steps(self, _endpoint): - client = self.create_async_client(endpoint=_endpoint) - response = await client.agents.list_run_steps( - thread_id="str", - run_id="str", - ) - - # please add some check logic here by yourself - # ... - - @Preparer() - @recorded_by_proxy_async - async def test_agents_list_files(self, _endpoint): - client = self.create_async_client(endpoint=_endpoint) - response = await client.agents.list_files() - - # please add some check logic here by yourself - # ... - - @Preparer() - @recorded_by_proxy_async - async def test_agents_upload_file(self, _endpoint): - client = self.create_async_client(endpoint=_endpoint) - response = await client.agents.upload_file( - body={"file": "filetype", "purpose": "str", "filename": "str"}, - file="filetype", - purpose="str", - ) - - # please add some check logic here by yourself - # ... - - @Preparer() - @recorded_by_proxy_async - async def test_agents_delete_file(self, _endpoint): - client = self.create_async_client(endpoint=_endpoint) - response = await client.agents.delete_file( - file_id="str", - ) - - # please add some check logic here by yourself - # ... - - @Preparer() - @recorded_by_proxy_async - async def test_agents_get_file(self, _endpoint): - client = self.create_async_client(endpoint=_endpoint) - response = await client.agents.get_file( - file_id="str", - ) - - # please add some check logic here by yourself - # ... - - @Preparer() - @recorded_by_proxy_async - async def test_agents_get_file_content(self, _endpoint): - client = self.create_async_client(endpoint=_endpoint) - response = await client.agents.get_file_content( - file_id="str", - ) - - # please add some check logic here by yourself - # ... - - @Preparer() - @recorded_by_proxy_async - async def test_agents_list_vector_stores(self, _endpoint): - client = self.create_async_client(endpoint=_endpoint) - response = await client.agents.list_vector_stores() - - # please add some check logic here by yourself - # ... - - @Preparer() - @recorded_by_proxy_async - async def test_agents_create_vector_store(self, _endpoint): - client = self.create_async_client(endpoint=_endpoint) - response = await client.agents.create_vector_store( - body={ - "chunking_strategy": "vector_store_chunking_strategy_request", - "expires_after": {"anchor": "str", "days": 0}, - "file_ids": ["str"], - "metadata": {"str": "str"}, - "name": "str", - }, - ) - - # please add some check logic here by yourself - # ... - - @Preparer() - @recorded_by_proxy_async - async def test_agents_get_vector_store(self, _endpoint): - client = self.create_async_client(endpoint=_endpoint) - response = await client.agents.get_vector_store( - vector_store_id="str", - ) - - # please add some check logic here by yourself - # ... - - @Preparer() - @recorded_by_proxy_async - async def test_agents_modify_vector_store(self, _endpoint): - client = self.create_async_client(endpoint=_endpoint) - response = await client.agents.modify_vector_store( - vector_store_id="str", - body={"expires_after": {"anchor": "str", "days": 0}, "metadata": {"str": "str"}, "name": "str"}, - ) - - # please add some check logic here by yourself - # ... - - @Preparer() - @recorded_by_proxy_async - async def test_agents_delete_vector_store(self, _endpoint): - client = self.create_async_client(endpoint=_endpoint) - response = await client.agents.delete_vector_store( - vector_store_id="str", - ) - - # please add some check logic here by yourself - # ... - - @Preparer() - @recorded_by_proxy_async - async def test_agents_list_vector_store_files(self, _endpoint): - client = self.create_async_client(endpoint=_endpoint) - response = await client.agents.list_vector_store_files( - vector_store_id="str", - ) - - # please add some check logic here by yourself - # ... - - @Preparer() - @recorded_by_proxy_async - async def test_agents_create_vector_store_file(self, _endpoint): - client = self.create_async_client(endpoint=_endpoint) - response = await client.agents.create_vector_store_file( - vector_store_id="str", - body={"file_id": "str", "chunking_strategy": "vector_store_chunking_strategy_request"}, - file_id="str", - ) - - # please add some check logic here by yourself - # ... - - @Preparer() - @recorded_by_proxy_async - async def test_agents_get_vector_store_file(self, _endpoint): - client = self.create_async_client(endpoint=_endpoint) - response = await client.agents.get_vector_store_file( - vector_store_id="str", - file_id="str", - ) - - # please add some check logic here by yourself - # ... - - @Preparer() - @recorded_by_proxy_async - async def test_agents_delete_vector_store_file(self, _endpoint): - client = self.create_async_client(endpoint=_endpoint) - response = await client.agents.delete_vector_store_file( - vector_store_id="str", - file_id="str", - ) - - # please add some check logic here by yourself - # ... - - @Preparer() - @recorded_by_proxy_async - async def test_agents_create_vector_store_file_batch(self, _endpoint): - client = self.create_async_client(endpoint=_endpoint) - response = await client.agents.create_vector_store_file_batch( - vector_store_id="str", - body={"file_ids": ["str"], "chunking_strategy": "vector_store_chunking_strategy_request"}, - file_ids=["str"], - ) - - # please add some check logic here by yourself - # ... - - @Preparer() - @recorded_by_proxy_async - async def test_agents_get_vector_store_file_batch(self, _endpoint): - client = self.create_async_client(endpoint=_endpoint) - response = await client.agents.get_vector_store_file_batch( - vector_store_id="str", - batch_id="str", - ) - - # please add some check logic here by yourself - # ... - - @Preparer() - @recorded_by_proxy_async - async def test_agents_cancel_vector_store_file_batch(self, _endpoint): - client = self.create_async_client(endpoint=_endpoint) - response = await client.agents.cancel_vector_store_file_batch( - vector_store_id="str", - batch_id="str", - ) - - # please add some check logic here by yourself - # ... - - @Preparer() - @recorded_by_proxy_async - async def test_agents_list_vector_store_file_batch_files(self, _endpoint): - client = self.create_async_client(endpoint=_endpoint) - response = await client.agents.list_vector_store_file_batch_files( - vector_store_id="str", - batch_id="str", - ) - - # please add some check logic here by yourself - # ... diff --git a/sdk/ai/azure-ai-client/generated_tests/test_azure_ai_agents_operations.py b/sdk/ai/azure-ai-client/generated_tests/test_azure_ai_agents_operations.py deleted file mode 100644 index 2ef135f90409..000000000000 --- a/sdk/ai/azure-ai-client/generated_tests/test_azure_ai_agents_operations.py +++ /dev/null @@ -1,606 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) Python Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -import pytest -from devtools_testutils import recorded_by_proxy -from testpreparer import AzureAIClientTestBase, AzureAIPreparer - - -@pytest.mark.skip("you may need to update the auto-generated test case before run it") -class TestAzureAIAgentsOperations(AzureAIClientTestBase): - @AzureAIPreparer() - @recorded_by_proxy - def test_agents_create_agent(self, azureai_endpoint): - client = self.create_client(endpoint=azureai_endpoint) - response = client.agents.create_agent( - body={ - "model": "str", - "description": "str", - "instructions": "str", - "metadata": {"str": "str"}, - "name": "str", - "response_format": "str", - "temperature": 0.0, - "tool_resources": { - "code_interpreter": {"file_ids": ["str"]}, - "file_search": {"vector_store_ids": ["str"]}, - }, - "tools": ["tool_definition"], - "top_p": 0.0, - }, - model="str", - ) - - # please add some check logic here by yourself - # ... - - @AzureAIPreparer() - @recorded_by_proxy - def test_agents_list_agents(self, azureai_endpoint): - client = self.create_client(endpoint=azureai_endpoint) - response = client.agents.list_agents() - - # please add some check logic here by yourself - # ... - - @AzureAIPreparer() - @recorded_by_proxy - def test_agents_get_agent(self, azureai_endpoint): - client = self.create_client(endpoint=azureai_endpoint) - response = client.agents.get_agent( - assistant_id="str", - ) - - # please add some check logic here by yourself - # ... - - @AzureAIPreparer() - @recorded_by_proxy - def test_agents_update_agent(self, azureai_endpoint): - client = self.create_client(endpoint=azureai_endpoint) - response = client.agents.update_agent( - assistant_id="str", - body={ - "description": "str", - "instructions": "str", - "metadata": {"str": "str"}, - "model": "str", - "name": "str", - "response_format": "str", - "temperature": 0.0, - "tool_resources": { - "code_interpreter": {"file_ids": ["str"]}, - "file_search": {"vector_store_ids": ["str"]}, - }, - "tools": ["tool_definition"], - "top_p": 0.0, - }, - ) - - # please add some check logic here by yourself - # ... - - @AzureAIPreparer() - @recorded_by_proxy - def test_agents_delete_agent(self, azureai_endpoint): - client = self.create_client(endpoint=azureai_endpoint) - response = client.agents.delete_agent( - assistant_id="str", - ) - - # please add some check logic here by yourself - # ... - - @AzureAIPreparer() - @recorded_by_proxy - def test_agents_create_thread(self, azureai_endpoint): - client = self.create_client(endpoint=azureai_endpoint) - response = client.agents.create_thread( - body={ - "messages": [ - { - "content": "str", - "role": "str", - "attachments": [{"file_id": "str", "tools": [{"type": "code_interpreter"}]}], - "metadata": {"str": "str"}, - } - ], - "metadata": {"str": "str"}, - "tool_resources": { - "code_interpreter": {"file_ids": ["str"]}, - "file_search": {"vector_store_ids": ["str"]}, - }, - }, - ) - - # please add some check logic here by yourself - # ... - - @AzureAIPreparer() - @recorded_by_proxy - def test_agents_get_thread(self, azureai_endpoint): - client = self.create_client(endpoint=azureai_endpoint) - response = client.agents.get_thread( - thread_id="str", - ) - - # please add some check logic here by yourself - # ... - - @AzureAIPreparer() - @recorded_by_proxy - def test_agents_update_thread(self, azureai_endpoint): - client = self.create_client(endpoint=azureai_endpoint) - response = client.agents.update_thread( - thread_id="str", - body={ - "metadata": {"str": "str"}, - "tool_resources": { - "code_interpreter": {"file_ids": ["str"]}, - "file_search": {"vector_store_ids": ["str"]}, - }, - }, - ) - - # please add some check logic here by yourself - # ... - - @AzureAIPreparer() - @recorded_by_proxy - def test_agents_delete_thread(self, azureai_endpoint): - client = self.create_client(endpoint=azureai_endpoint) - response = client.agents.delete_thread( - thread_id="str", - ) - - # please add some check logic here by yourself - # ... - - @AzureAIPreparer() - @recorded_by_proxy - def test_agents_create_message(self, azureai_endpoint): - client = self.create_client(endpoint=azureai_endpoint) - response = client.agents.create_message( - thread_id="str", - body={ - "content": "str", - "role": "str", - "attachments": [{"file_id": "str", "tools": [{"type": "code_interpreter"}]}], - "metadata": {"str": "str"}, - }, - role="str", - content="str", - ) - - # please add some check logic here by yourself - # ... - - @AzureAIPreparer() - @recorded_by_proxy - def test_agents_list_messages(self, azureai_endpoint): - client = self.create_client(endpoint=azureai_endpoint) - response = client.agents.list_messages( - thread_id="str", - ) - - # please add some check logic here by yourself - # ... - - @AzureAIPreparer() - @recorded_by_proxy - def test_agents_get_message(self, azureai_endpoint): - client = self.create_client(endpoint=azureai_endpoint) - response = client.agents.get_message( - thread_id="str", - message_id="str", - ) - - # please add some check logic here by yourself - # ... - - @AzureAIPreparer() - @recorded_by_proxy - def test_agents_update_message(self, azureai_endpoint): - client = self.create_client(endpoint=azureai_endpoint) - response = client.agents.update_message( - thread_id="str", - message_id="str", - body={"metadata": {"str": "str"}}, - ) - - # please add some check logic here by yourself - # ... - - @AzureAIPreparer() - @recorded_by_proxy - def test_agents_create_run(self, azureai_endpoint): - client = self.create_client(endpoint=azureai_endpoint) - response = client.agents.create_run( - thread_id="str", - body={ - "assistant_id": "str", - "additional_instructions": "str", - "additional_messages": [ - { - "assistant_id": "str", - "attachments": [{"file_id": "str", "tools": [{"type": "code_interpreter"}]}], - "completed_at": "2020-02-20 00:00:00", - "content": ["message_content"], - "created_at": "2020-02-20 00:00:00", - "id": "str", - "incomplete_at": "2020-02-20 00:00:00", - "incomplete_details": {"reason": "str"}, - "metadata": {"str": "str"}, - "object": "thread.message", - "role": "str", - "run_id": "str", - "status": "str", - "thread_id": "str", - } - ], - "instructions": "str", - "max_completion_tokens": 0, - "max_prompt_tokens": 0, - "metadata": {"str": "str"}, - "model": "str", - "response_format": "str", - "stream": bool, - "temperature": 0.0, - "tool_choice": "str", - "tools": ["tool_definition"], - "top_p": 0.0, - "truncation_strategy": {"type": "str", "last_messages": 0}, - }, - assistant_id="str", - ) - - # please add some check logic here by yourself - # ... - - @AzureAIPreparer() - @recorded_by_proxy - def test_agents_list_runs(self, azureai_endpoint): - client = self.create_client(endpoint=azureai_endpoint) - response = client.agents.list_runs( - thread_id="str", - ) - - # please add some check logic here by yourself - # ... - - @AzureAIPreparer() - @recorded_by_proxy - def test_agents_get_run(self, azureai_endpoint): - client = self.create_client(endpoint=azureai_endpoint) - response = client.agents.get_run( - thread_id="str", - run_id="str", - ) - - # please add some check logic here by yourself - # ... - - @AzureAIPreparer() - @recorded_by_proxy - def test_agents_update_run(self, azureai_endpoint): - client = self.create_client(endpoint=azureai_endpoint) - response = client.agents.update_run( - thread_id="str", - run_id="str", - body={"metadata": {"str": "str"}}, - ) - - # please add some check logic here by yourself - # ... - - @AzureAIPreparer() - @recorded_by_proxy - def test_agents_submit_tool_outputs_to_run(self, azureai_endpoint): - client = self.create_client(endpoint=azureai_endpoint) - response = client.agents.submit_tool_outputs_to_run( - thread_id="str", - run_id="str", - body={"tool_outputs": [{"output": "str", "tool_call_id": "str"}], "stream": bool}, - tool_outputs=[{"output": "str", "tool_call_id": "str"}], - ) - - # please add some check logic here by yourself - # ... - - @AzureAIPreparer() - @recorded_by_proxy - def test_agents_cancel_run(self, azureai_endpoint): - client = self.create_client(endpoint=azureai_endpoint) - response = client.agents.cancel_run( - thread_id="str", - run_id="str", - ) - - # please add some check logic here by yourself - # ... - - @AzureAIPreparer() - @recorded_by_proxy - def test_agents_create_thread_and_run(self, azureai_endpoint): - client = self.create_client(endpoint=azureai_endpoint) - response = client.agents.create_thread_and_run( - body={ - "assistant_id": "str", - "instructions": "str", - "max_completion_tokens": 0, - "max_prompt_tokens": 0, - "metadata": {"str": "str"}, - "model": "str", - "response_format": "str", - "stream": bool, - "temperature": 0.0, - "thread": { - "messages": [ - { - "content": "str", - "role": "str", - "attachments": [{"file_id": "str", "tools": [{"type": "code_interpreter"}]}], - "metadata": {"str": "str"}, - } - ], - "metadata": {"str": "str"}, - "tool_resources": { - "code_interpreter": {"file_ids": ["str"]}, - "file_search": {"vector_store_ids": ["str"]}, - }, - }, - "tool_choice": "str", - "tool_resources": { - "code_interpreter": {"file_ids": ["str"]}, - "file_search": {"vector_store_ids": ["str"]}, - }, - "tools": ["tool_definition"], - "top_p": 0.0, - "truncation_strategy": {"type": "str", "last_messages": 0}, - }, - assistant_id="str", - ) - - # please add some check logic here by yourself - # ... - - @AzureAIPreparer() - @recorded_by_proxy - def test_agents_get_run_step(self, azureai_endpoint): - client = self.create_client(endpoint=azureai_endpoint) - response = client.agents.get_run_step( - thread_id="str", - run_id="str", - step_id="str", - ) - - # please add some check logic here by yourself - # ... - - @AzureAIPreparer() - @recorded_by_proxy - def test_agents_list_run_steps(self, azureai_endpoint): - client = self.create_client(endpoint=azureai_endpoint) - response = client.agents.list_run_steps( - thread_id="str", - run_id="str", - ) - - # please add some check logic here by yourself - # ... - - @AzureAIPreparer() - @recorded_by_proxy - def test_agents_list_files(self, azureai_endpoint): - client = self.create_client(endpoint=azureai_endpoint) - response = client.agents.list_files() - - # please add some check logic here by yourself - # ... - - @AzureAIPreparer() - @recorded_by_proxy - def test_agents_upload_file(self, azureai_endpoint): - client = self.create_client(endpoint=azureai_endpoint) - response = client.agents.upload_file( - body={"file": "filetype", "purpose": "str", "filename": "str"}, - file="filetype", - purpose="str", - ) - - # please add some check logic here by yourself - # ... - - @AzureAIPreparer() - @recorded_by_proxy - def test_agents_delete_file(self, azureai_endpoint): - client = self.create_client(endpoint=azureai_endpoint) - response = client.agents.delete_file( - file_id="str", - ) - - # please add some check logic here by yourself - # ... - - @AzureAIPreparer() - @recorded_by_proxy - def test_agents_get_file(self, azureai_endpoint): - client = self.create_client(endpoint=azureai_endpoint) - response = client.agents.get_file( - file_id="str", - ) - - # please add some check logic here by yourself - # ... - - @AzureAIPreparer() - @recorded_by_proxy - def test_agents_get_file_content(self, azureai_endpoint): - client = self.create_client(endpoint=azureai_endpoint) - response = client.agents.get_file_content( - file_id="str", - ) - - # please add some check logic here by yourself - # ... - - @AzureAIPreparer() - @recorded_by_proxy - def test_agents_list_vector_stores(self, azureai_endpoint): - client = self.create_client(endpoint=azureai_endpoint) - response = client.agents.list_vector_stores() - - # please add some check logic here by yourself - # ... - - @AzureAIPreparer() - @recorded_by_proxy - def test_agents_create_vector_store(self, azureai_endpoint): - client = self.create_client(endpoint=azureai_endpoint) - response = client.agents.create_vector_store( - body={ - "chunking_strategy": "vector_store_chunking_strategy_request", - "expires_after": {"anchor": "str", "days": 0}, - "file_ids": ["str"], - "metadata": {"str": "str"}, - "name": "str", - }, - ) - - # please add some check logic here by yourself - # ... - - @AzureAIPreparer() - @recorded_by_proxy - def test_agents_get_vector_store(self, azureai_endpoint): - client = self.create_client(endpoint=azureai_endpoint) - response = client.agents.get_vector_store( - vector_store_id="str", - ) - - # please add some check logic here by yourself - # ... - - @AzureAIPreparer() - @recorded_by_proxy - def test_agents_modify_vector_store(self, azureai_endpoint): - client = self.create_client(endpoint=azureai_endpoint) - response = client.agents.modify_vector_store( - vector_store_id="str", - body={"expires_after": {"anchor": "str", "days": 0}, "metadata": {"str": "str"}, "name": "str"}, - ) - - # please add some check logic here by yourself - # ... - - @AzureAIPreparer() - @recorded_by_proxy - def test_agents_delete_vector_store(self, azureai_endpoint): - client = self.create_client(endpoint=azureai_endpoint) - response = client.agents.delete_vector_store( - vector_store_id="str", - ) - - # please add some check logic here by yourself - # ... - - @AzureAIPreparer() - @recorded_by_proxy - def test_agents_list_vector_store_files(self, azureai_endpoint): - client = self.create_client(endpoint=azureai_endpoint) - response = client.agents.list_vector_store_files( - vector_store_id="str", - ) - - # please add some check logic here by yourself - # ... - - @AzureAIPreparer() - @recorded_by_proxy - def test_agents_create_vector_store_file(self, azureai_endpoint): - client = self.create_client(endpoint=azureai_endpoint) - response = client.agents.create_vector_store_file( - vector_store_id="str", - body={"file_id": "str", "chunking_strategy": "vector_store_chunking_strategy_request"}, - file_id="str", - ) - - # please add some check logic here by yourself - # ... - - @AzureAIPreparer() - @recorded_by_proxy - def test_agents_get_vector_store_file(self, azureai_endpoint): - client = self.create_client(endpoint=azureai_endpoint) - response = client.agents.get_vector_store_file( - vector_store_id="str", - file_id="str", - ) - - # please add some check logic here by yourself - # ... - - @AzureAIPreparer() - @recorded_by_proxy - def test_agents_delete_vector_store_file(self, azureai_endpoint): - client = self.create_client(endpoint=azureai_endpoint) - response = client.agents.delete_vector_store_file( - vector_store_id="str", - file_id="str", - ) - - # please add some check logic here by yourself - # ... - - @AzureAIPreparer() - @recorded_by_proxy - def test_agents_create_vector_store_file_batch(self, azureai_endpoint): - client = self.create_client(endpoint=azureai_endpoint) - response = client.agents.create_vector_store_file_batch( - vector_store_id="str", - body={"file_ids": ["str"], "chunking_strategy": "vector_store_chunking_strategy_request"}, - file_ids=["str"], - ) - - # please add some check logic here by yourself - # ... - - @AzureAIPreparer() - @recorded_by_proxy - def test_agents_get_vector_store_file_batch(self, azureai_endpoint): - client = self.create_client(endpoint=azureai_endpoint) - response = client.agents.get_vector_store_file_batch( - vector_store_id="str", - batch_id="str", - ) - - # please add some check logic here by yourself - # ... - - @AzureAIPreparer() - @recorded_by_proxy - def test_agents_cancel_vector_store_file_batch(self, azureai_endpoint): - client = self.create_client(endpoint=azureai_endpoint) - response = client.agents.cancel_vector_store_file_batch( - vector_store_id="str", - batch_id="str", - ) - - # please add some check logic here by yourself - # ... - - @AzureAIPreparer() - @recorded_by_proxy - def test_agents_list_vector_store_file_batch_files(self, azureai_endpoint): - client = self.create_client(endpoint=azureai_endpoint) - response = client.agents.list_vector_store_file_batch_files( - vector_store_id="str", - batch_id="str", - ) - - # please add some check logic here by yourself - # ... diff --git a/sdk/ai/azure-ai-client/generated_tests/test_azure_ai_agents_operations_async.py b/sdk/ai/azure-ai-client/generated_tests/test_azure_ai_agents_operations_async.py deleted file mode 100644 index e893c51c1732..000000000000 --- a/sdk/ai/azure-ai-client/generated_tests/test_azure_ai_agents_operations_async.py +++ /dev/null @@ -1,607 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) Python Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -import pytest -from devtools_testutils.aio import recorded_by_proxy_async -from testpreparer import AzureAIPreparer -from testpreparer_async import AzureAIClientTestBaseAsync - - -@pytest.mark.skip("you may need to update the auto-generated test case before run it") -class TestAzureAIAgentsOperationsAsync(AzureAIClientTestBaseAsync): - @AzureAIPreparer() - @recorded_by_proxy_async - async def test_agents_create_agent(self, azureai_endpoint): - client = self.create_async_client(endpoint=azureai_endpoint) - response = await client.agents.create_agent( - body={ - "model": "str", - "description": "str", - "instructions": "str", - "metadata": {"str": "str"}, - "name": "str", - "response_format": "str", - "temperature": 0.0, - "tool_resources": { - "code_interpreter": {"file_ids": ["str"]}, - "file_search": {"vector_store_ids": ["str"]}, - }, - "tools": ["tool_definition"], - "top_p": 0.0, - }, - model="str", - ) - - # please add some check logic here by yourself - # ... - - @AzureAIPreparer() - @recorded_by_proxy_async - async def test_agents_list_agents(self, azureai_endpoint): - client = self.create_async_client(endpoint=azureai_endpoint) - response = await client.agents.list_agents() - - # please add some check logic here by yourself - # ... - - @AzureAIPreparer() - @recorded_by_proxy_async - async def test_agents_get_agent(self, azureai_endpoint): - client = self.create_async_client(endpoint=azureai_endpoint) - response = await client.agents.get_agent( - assistant_id="str", - ) - - # please add some check logic here by yourself - # ... - - @AzureAIPreparer() - @recorded_by_proxy_async - async def test_agents_update_agent(self, azureai_endpoint): - client = self.create_async_client(endpoint=azureai_endpoint) - response = await client.agents.update_agent( - assistant_id="str", - body={ - "description": "str", - "instructions": "str", - "metadata": {"str": "str"}, - "model": "str", - "name": "str", - "response_format": "str", - "temperature": 0.0, - "tool_resources": { - "code_interpreter": {"file_ids": ["str"]}, - "file_search": {"vector_store_ids": ["str"]}, - }, - "tools": ["tool_definition"], - "top_p": 0.0, - }, - ) - - # please add some check logic here by yourself - # ... - - @AzureAIPreparer() - @recorded_by_proxy_async - async def test_agents_delete_agent(self, azureai_endpoint): - client = self.create_async_client(endpoint=azureai_endpoint) - response = await client.agents.delete_agent( - assistant_id="str", - ) - - # please add some check logic here by yourself - # ... - - @AzureAIPreparer() - @recorded_by_proxy_async - async def test_agents_create_thread(self, azureai_endpoint): - client = self.create_async_client(endpoint=azureai_endpoint) - response = await client.agents.create_thread( - body={ - "messages": [ - { - "content": "str", - "role": "str", - "attachments": [{"file_id": "str", "tools": [{"type": "code_interpreter"}]}], - "metadata": {"str": "str"}, - } - ], - "metadata": {"str": "str"}, - "tool_resources": { - "code_interpreter": {"file_ids": ["str"]}, - "file_search": {"vector_store_ids": ["str"]}, - }, - }, - ) - - # please add some check logic here by yourself - # ... - - @AzureAIPreparer() - @recorded_by_proxy_async - async def test_agents_get_thread(self, azureai_endpoint): - client = self.create_async_client(endpoint=azureai_endpoint) - response = await client.agents.get_thread( - thread_id="str", - ) - - # please add some check logic here by yourself - # ... - - @AzureAIPreparer() - @recorded_by_proxy_async - async def test_agents_update_thread(self, azureai_endpoint): - client = self.create_async_client(endpoint=azureai_endpoint) - response = await client.agents.update_thread( - thread_id="str", - body={ - "metadata": {"str": "str"}, - "tool_resources": { - "code_interpreter": {"file_ids": ["str"]}, - "file_search": {"vector_store_ids": ["str"]}, - }, - }, - ) - - # please add some check logic here by yourself - # ... - - @AzureAIPreparer() - @recorded_by_proxy_async - async def test_agents_delete_thread(self, azureai_endpoint): - client = self.create_async_client(endpoint=azureai_endpoint) - response = await client.agents.delete_thread( - thread_id="str", - ) - - # please add some check logic here by yourself - # ... - - @AzureAIPreparer() - @recorded_by_proxy_async - async def test_agents_create_message(self, azureai_endpoint): - client = self.create_async_client(endpoint=azureai_endpoint) - response = await client.agents.create_message( - thread_id="str", - body={ - "content": "str", - "role": "str", - "attachments": [{"file_id": "str", "tools": [{"type": "code_interpreter"}]}], - "metadata": {"str": "str"}, - }, - role="str", - content="str", - ) - - # please add some check logic here by yourself - # ... - - @AzureAIPreparer() - @recorded_by_proxy_async - async def test_agents_list_messages(self, azureai_endpoint): - client = self.create_async_client(endpoint=azureai_endpoint) - response = await client.agents.list_messages( - thread_id="str", - ) - - # please add some check logic here by yourself - # ... - - @AzureAIPreparer() - @recorded_by_proxy_async - async def test_agents_get_message(self, azureai_endpoint): - client = self.create_async_client(endpoint=azureai_endpoint) - response = await client.agents.get_message( - thread_id="str", - message_id="str", - ) - - # please add some check logic here by yourself - # ... - - @AzureAIPreparer() - @recorded_by_proxy_async - async def test_agents_update_message(self, azureai_endpoint): - client = self.create_async_client(endpoint=azureai_endpoint) - response = await client.agents.update_message( - thread_id="str", - message_id="str", - body={"metadata": {"str": "str"}}, - ) - - # please add some check logic here by yourself - # ... - - @AzureAIPreparer() - @recorded_by_proxy_async - async def test_agents_create_run(self, azureai_endpoint): - client = self.create_async_client(endpoint=azureai_endpoint) - response = await client.agents.create_run( - thread_id="str", - body={ - "assistant_id": "str", - "additional_instructions": "str", - "additional_messages": [ - { - "assistant_id": "str", - "attachments": [{"file_id": "str", "tools": [{"type": "code_interpreter"}]}], - "completed_at": "2020-02-20 00:00:00", - "content": ["message_content"], - "created_at": "2020-02-20 00:00:00", - "id": "str", - "incomplete_at": "2020-02-20 00:00:00", - "incomplete_details": {"reason": "str"}, - "metadata": {"str": "str"}, - "object": "thread.message", - "role": "str", - "run_id": "str", - "status": "str", - "thread_id": "str", - } - ], - "instructions": "str", - "max_completion_tokens": 0, - "max_prompt_tokens": 0, - "metadata": {"str": "str"}, - "model": "str", - "response_format": "str", - "stream": bool, - "temperature": 0.0, - "tool_choice": "str", - "tools": ["tool_definition"], - "top_p": 0.0, - "truncation_strategy": {"type": "str", "last_messages": 0}, - }, - assistant_id="str", - ) - - # please add some check logic here by yourself - # ... - - @AzureAIPreparer() - @recorded_by_proxy_async - async def test_agents_list_runs(self, azureai_endpoint): - client = self.create_async_client(endpoint=azureai_endpoint) - response = await client.agents.list_runs( - thread_id="str", - ) - - # please add some check logic here by yourself - # ... - - @AzureAIPreparer() - @recorded_by_proxy_async - async def test_agents_get_run(self, azureai_endpoint): - client = self.create_async_client(endpoint=azureai_endpoint) - response = await client.agents.get_run( - thread_id="str", - run_id="str", - ) - - # please add some check logic here by yourself - # ... - - @AzureAIPreparer() - @recorded_by_proxy_async - async def test_agents_update_run(self, azureai_endpoint): - client = self.create_async_client(endpoint=azureai_endpoint) - response = await client.agents.update_run( - thread_id="str", - run_id="str", - body={"metadata": {"str": "str"}}, - ) - - # please add some check logic here by yourself - # ... - - @AzureAIPreparer() - @recorded_by_proxy_async - async def test_agents_submit_tool_outputs_to_run(self, azureai_endpoint): - client = self.create_async_client(endpoint=azureai_endpoint) - response = await client.agents.submit_tool_outputs_to_run( - thread_id="str", - run_id="str", - body={"tool_outputs": [{"output": "str", "tool_call_id": "str"}], "stream": bool}, - tool_outputs=[{"output": "str", "tool_call_id": "str"}], - ) - - # please add some check logic here by yourself - # ... - - @AzureAIPreparer() - @recorded_by_proxy_async - async def test_agents_cancel_run(self, azureai_endpoint): - client = self.create_async_client(endpoint=azureai_endpoint) - response = await client.agents.cancel_run( - thread_id="str", - run_id="str", - ) - - # please add some check logic here by yourself - # ... - - @AzureAIPreparer() - @recorded_by_proxy_async - async def test_agents_create_thread_and_run(self, azureai_endpoint): - client = self.create_async_client(endpoint=azureai_endpoint) - response = await client.agents.create_thread_and_run( - body={ - "assistant_id": "str", - "instructions": "str", - "max_completion_tokens": 0, - "max_prompt_tokens": 0, - "metadata": {"str": "str"}, - "model": "str", - "response_format": "str", - "stream": bool, - "temperature": 0.0, - "thread": { - "messages": [ - { - "content": "str", - "role": "str", - "attachments": [{"file_id": "str", "tools": [{"type": "code_interpreter"}]}], - "metadata": {"str": "str"}, - } - ], - "metadata": {"str": "str"}, - "tool_resources": { - "code_interpreter": {"file_ids": ["str"]}, - "file_search": {"vector_store_ids": ["str"]}, - }, - }, - "tool_choice": "str", - "tool_resources": { - "code_interpreter": {"file_ids": ["str"]}, - "file_search": {"vector_store_ids": ["str"]}, - }, - "tools": ["tool_definition"], - "top_p": 0.0, - "truncation_strategy": {"type": "str", "last_messages": 0}, - }, - assistant_id="str", - ) - - # please add some check logic here by yourself - # ... - - @AzureAIPreparer() - @recorded_by_proxy_async - async def test_agents_get_run_step(self, azureai_endpoint): - client = self.create_async_client(endpoint=azureai_endpoint) - response = await client.agents.get_run_step( - thread_id="str", - run_id="str", - step_id="str", - ) - - # please add some check logic here by yourself - # ... - - @AzureAIPreparer() - @recorded_by_proxy_async - async def test_agents_list_run_steps(self, azureai_endpoint): - client = self.create_async_client(endpoint=azureai_endpoint) - response = await client.agents.list_run_steps( - thread_id="str", - run_id="str", - ) - - # please add some check logic here by yourself - # ... - - @AzureAIPreparer() - @recorded_by_proxy_async - async def test_agents_list_files(self, azureai_endpoint): - client = self.create_async_client(endpoint=azureai_endpoint) - response = await client.agents.list_files() - - # please add some check logic here by yourself - # ... - - @AzureAIPreparer() - @recorded_by_proxy_async - async def test_agents_upload_file(self, azureai_endpoint): - client = self.create_async_client(endpoint=azureai_endpoint) - response = await client.agents.upload_file( - body={"file": "filetype", "purpose": "str", "filename": "str"}, - file="filetype", - purpose="str", - ) - - # please add some check logic here by yourself - # ... - - @AzureAIPreparer() - @recorded_by_proxy_async - async def test_agents_delete_file(self, azureai_endpoint): - client = self.create_async_client(endpoint=azureai_endpoint) - response = await client.agents.delete_file( - file_id="str", - ) - - # please add some check logic here by yourself - # ... - - @AzureAIPreparer() - @recorded_by_proxy_async - async def test_agents_get_file(self, azureai_endpoint): - client = self.create_async_client(endpoint=azureai_endpoint) - response = await client.agents.get_file( - file_id="str", - ) - - # please add some check logic here by yourself - # ... - - @AzureAIPreparer() - @recorded_by_proxy_async - async def test_agents_get_file_content(self, azureai_endpoint): - client = self.create_async_client(endpoint=azureai_endpoint) - response = await client.agents.get_file_content( - file_id="str", - ) - - # please add some check logic here by yourself - # ... - - @AzureAIPreparer() - @recorded_by_proxy_async - async def test_agents_list_vector_stores(self, azureai_endpoint): - client = self.create_async_client(endpoint=azureai_endpoint) - response = await client.agents.list_vector_stores() - - # please add some check logic here by yourself - # ... - - @AzureAIPreparer() - @recorded_by_proxy_async - async def test_agents_create_vector_store(self, azureai_endpoint): - client = self.create_async_client(endpoint=azureai_endpoint) - response = await client.agents.create_vector_store( - body={ - "chunking_strategy": "vector_store_chunking_strategy_request", - "expires_after": {"anchor": "str", "days": 0}, - "file_ids": ["str"], - "metadata": {"str": "str"}, - "name": "str", - }, - ) - - # please add some check logic here by yourself - # ... - - @AzureAIPreparer() - @recorded_by_proxy_async - async def test_agents_get_vector_store(self, azureai_endpoint): - client = self.create_async_client(endpoint=azureai_endpoint) - response = await client.agents.get_vector_store( - vector_store_id="str", - ) - - # please add some check logic here by yourself - # ... - - @AzureAIPreparer() - @recorded_by_proxy_async - async def test_agents_modify_vector_store(self, azureai_endpoint): - client = self.create_async_client(endpoint=azureai_endpoint) - response = await client.agents.modify_vector_store( - vector_store_id="str", - body={"expires_after": {"anchor": "str", "days": 0}, "metadata": {"str": "str"}, "name": "str"}, - ) - - # please add some check logic here by yourself - # ... - - @AzureAIPreparer() - @recorded_by_proxy_async - async def test_agents_delete_vector_store(self, azureai_endpoint): - client = self.create_async_client(endpoint=azureai_endpoint) - response = await client.agents.delete_vector_store( - vector_store_id="str", - ) - - # please add some check logic here by yourself - # ... - - @AzureAIPreparer() - @recorded_by_proxy_async - async def test_agents_list_vector_store_files(self, azureai_endpoint): - client = self.create_async_client(endpoint=azureai_endpoint) - response = await client.agents.list_vector_store_files( - vector_store_id="str", - ) - - # please add some check logic here by yourself - # ... - - @AzureAIPreparer() - @recorded_by_proxy_async - async def test_agents_create_vector_store_file(self, azureai_endpoint): - client = self.create_async_client(endpoint=azureai_endpoint) - response = await client.agents.create_vector_store_file( - vector_store_id="str", - body={"file_id": "str", "chunking_strategy": "vector_store_chunking_strategy_request"}, - file_id="str", - ) - - # please add some check logic here by yourself - # ... - - @AzureAIPreparer() - @recorded_by_proxy_async - async def test_agents_get_vector_store_file(self, azureai_endpoint): - client = self.create_async_client(endpoint=azureai_endpoint) - response = await client.agents.get_vector_store_file( - vector_store_id="str", - file_id="str", - ) - - # please add some check logic here by yourself - # ... - - @AzureAIPreparer() - @recorded_by_proxy_async - async def test_agents_delete_vector_store_file(self, azureai_endpoint): - client = self.create_async_client(endpoint=azureai_endpoint) - response = await client.agents.delete_vector_store_file( - vector_store_id="str", - file_id="str", - ) - - # please add some check logic here by yourself - # ... - - @AzureAIPreparer() - @recorded_by_proxy_async - async def test_agents_create_vector_store_file_batch(self, azureai_endpoint): - client = self.create_async_client(endpoint=azureai_endpoint) - response = await client.agents.create_vector_store_file_batch( - vector_store_id="str", - body={"file_ids": ["str"], "chunking_strategy": "vector_store_chunking_strategy_request"}, - file_ids=["str"], - ) - - # please add some check logic here by yourself - # ... - - @AzureAIPreparer() - @recorded_by_proxy_async - async def test_agents_get_vector_store_file_batch(self, azureai_endpoint): - client = self.create_async_client(endpoint=azureai_endpoint) - response = await client.agents.get_vector_store_file_batch( - vector_store_id="str", - batch_id="str", - ) - - # please add some check logic here by yourself - # ... - - @AzureAIPreparer() - @recorded_by_proxy_async - async def test_agents_cancel_vector_store_file_batch(self, azureai_endpoint): - client = self.create_async_client(endpoint=azureai_endpoint) - response = await client.agents.cancel_vector_store_file_batch( - vector_store_id="str", - batch_id="str", - ) - - # please add some check logic here by yourself - # ... - - @AzureAIPreparer() - @recorded_by_proxy_async - async def test_agents_list_vector_store_file_batch_files(self, azureai_endpoint): - client = self.create_async_client(endpoint=azureai_endpoint) - response = await client.agents.list_vector_store_file_batch_files( - vector_store_id="str", - batch_id="str", - ) - - # please add some check logic here by yourself - # ... diff --git a/sdk/ai/azure-ai-client/generated_tests/test_azure_ai_evaluations_operations.py b/sdk/ai/azure-ai-client/generated_tests/test_azure_ai_evaluations_operations.py deleted file mode 100644 index bc8f590aa3cb..000000000000 --- a/sdk/ai/azure-ai-client/generated_tests/test_azure_ai_evaluations_operations.py +++ /dev/null @@ -1,146 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) Python Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -import pytest -from devtools_testutils import recorded_by_proxy -from testpreparer import AzureAIClientTestBase, AzureAIPreparer - - -@pytest.mark.skip("you may need to update the auto-generated test case before run it") -class TestAzureAIEvaluationsOperations(AzureAIClientTestBase): - @AzureAIPreparer() - @recorded_by_proxy - def test_evaluations_create(self, azureai_endpoint): - client = self.create_client(endpoint=azureai_endpoint) - response = client.evaluations.create( - evaluation={ - "data": "input_data", - "evaluators": {"str": {"id": "str", "dataMapping": {"str": "str"}, "initParams": {"str": {}}}}, - "description": "str", - "displayName": "str", - "id": "str", - "properties": {"str": "str"}, - "status": "str", - "systemData": { - "createdAt": "2020-02-20 00:00:00", - "createdBy": "str", - "createdByType": "str", - "lastModifiedAt": "2020-02-20 00:00:00", - }, - "tags": {"str": "str"}, - }, - ) - - # please add some check logic here by yourself - # ... - - @AzureAIPreparer() - @recorded_by_proxy - def test_evaluations_list(self, azureai_endpoint): - client = self.create_client(endpoint=azureai_endpoint) - response = client.evaluations.list() - result = [r for r in response] - # please add some check logic here by yourself - # ... - - @AzureAIPreparer() - @recorded_by_proxy - def test_evaluations_update(self, azureai_endpoint): - client = self.create_client(endpoint=azureai_endpoint) - response = client.evaluations.update( - id="str", - update_request={"description": "str", "displayName": "str", "tags": {"str": "str"}}, - ) - - # please add some check logic here by yourself - # ... - - @AzureAIPreparer() - @recorded_by_proxy - def test_evaluations_get(self, azureai_endpoint): - client = self.create_client(endpoint=azureai_endpoint) - response = client.evaluations.get( - id="str", - ) - - # please add some check logic here by yourself - # ... - - @AzureAIPreparer() - @recorded_by_proxy - def test_evaluations_create_schedule(self, azureai_endpoint): - client = self.create_client(endpoint=azureai_endpoint) - response = client.evaluations.create_schedule( - body={ - "data": "input_data", - "evaluators": {"str": {"id": "str", "dataMapping": {"str": "str"}, "initParams": {"str": {}}}}, - "samplingStrategy": {"rate": 0.0}, - "cronExpression": "str", - "description": "str", - "displayName": "str", - "id": "str", - "properties": {"str": "str"}, - "recurrence": { - "frequency": "str", - "interval": 0, - "schedule": {"hours": [0], "minutes": [0], "monthDays": [0], "weekDays": ["str"]}, - }, - "status": "str", - "systemData": { - "createdAt": "2020-02-20 00:00:00", - "createdBy": "str", - "createdByType": "str", - "lastModifiedAt": "2020-02-20 00:00:00", - }, - "tags": {"str": "str"}, - }, - ) - - # please add some check logic here by yourself - # ... - - @AzureAIPreparer() - @recorded_by_proxy - def test_evaluations_get_schedule(self, azureai_endpoint): - client = self.create_client(endpoint=azureai_endpoint) - response = client.evaluations.get_schedule( - id="str", - ) - - # please add some check logic here by yourself - # ... - - @AzureAIPreparer() - @recorded_by_proxy - def test_evaluations_list_schedules(self, azureai_endpoint): - client = self.create_client(endpoint=azureai_endpoint) - response = client.evaluations.list_schedules() - result = [r for r in response] - # please add some check logic here by yourself - # ... - - @AzureAIPreparer() - @recorded_by_proxy - def test_evaluations_list_schedule_evaluations(self, azureai_endpoint): - client = self.create_client(endpoint=azureai_endpoint) - response = client.evaluations.list_schedule_evaluations( - id="str", - ) - result = [r for r in response] - # please add some check logic here by yourself - # ... - - @AzureAIPreparer() - @recorded_by_proxy - def test_evaluations_delete_schedule(self, azureai_endpoint): - client = self.create_client(endpoint=azureai_endpoint) - response = client.evaluations.delete_schedule( - id="str", - ) - - # please add some check logic here by yourself - # ... diff --git a/sdk/ai/azure-ai-client/generated_tests/test_azure_ai_evaluations_operations_async.py b/sdk/ai/azure-ai-client/generated_tests/test_azure_ai_evaluations_operations_async.py deleted file mode 100644 index 8c1e28de6539..000000000000 --- a/sdk/ai/azure-ai-client/generated_tests/test_azure_ai_evaluations_operations_async.py +++ /dev/null @@ -1,147 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) Python Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -import pytest -from devtools_testutils.aio import recorded_by_proxy_async -from testpreparer import AzureAIPreparer -from testpreparer_async import AzureAIClientTestBaseAsync - - -@pytest.mark.skip("you may need to update the auto-generated test case before run it") -class TestAzureAIEvaluationsOperationsAsync(AzureAIClientTestBaseAsync): - @AzureAIPreparer() - @recorded_by_proxy_async - async def test_evaluations_create(self, azureai_endpoint): - client = self.create_async_client(endpoint=azureai_endpoint) - response = await client.evaluations.create( - evaluation={ - "data": "input_data", - "evaluators": {"str": {"id": "str", "dataMapping": {"str": "str"}, "initParams": {"str": {}}}}, - "description": "str", - "displayName": "str", - "id": "str", - "properties": {"str": "str"}, - "status": "str", - "systemData": { - "createdAt": "2020-02-20 00:00:00", - "createdBy": "str", - "createdByType": "str", - "lastModifiedAt": "2020-02-20 00:00:00", - }, - "tags": {"str": "str"}, - }, - ) - - # please add some check logic here by yourself - # ... - - @AzureAIPreparer() - @recorded_by_proxy_async - async def test_evaluations_list(self, azureai_endpoint): - client = self.create_async_client(endpoint=azureai_endpoint) - response = client.evaluations.list() - result = [r async for r in response] - # please add some check logic here by yourself - # ... - - @AzureAIPreparer() - @recorded_by_proxy_async - async def test_evaluations_update(self, azureai_endpoint): - client = self.create_async_client(endpoint=azureai_endpoint) - response = await client.evaluations.update( - id="str", - update_request={"description": "str", "displayName": "str", "tags": {"str": "str"}}, - ) - - # please add some check logic here by yourself - # ... - - @AzureAIPreparer() - @recorded_by_proxy_async - async def test_evaluations_get(self, azureai_endpoint): - client = self.create_async_client(endpoint=azureai_endpoint) - response = await client.evaluations.get( - id="str", - ) - - # please add some check logic here by yourself - # ... - - @AzureAIPreparer() - @recorded_by_proxy_async - async def test_evaluations_create_schedule(self, azureai_endpoint): - client = self.create_async_client(endpoint=azureai_endpoint) - response = await client.evaluations.create_schedule( - body={ - "data": "input_data", - "evaluators": {"str": {"id": "str", "dataMapping": {"str": "str"}, "initParams": {"str": {}}}}, - "samplingStrategy": {"rate": 0.0}, - "cronExpression": "str", - "description": "str", - "displayName": "str", - "id": "str", - "properties": {"str": "str"}, - "recurrence": { - "frequency": "str", - "interval": 0, - "schedule": {"hours": [0], "minutes": [0], "monthDays": [0], "weekDays": ["str"]}, - }, - "status": "str", - "systemData": { - "createdAt": "2020-02-20 00:00:00", - "createdBy": "str", - "createdByType": "str", - "lastModifiedAt": "2020-02-20 00:00:00", - }, - "tags": {"str": "str"}, - }, - ) - - # please add some check logic here by yourself - # ... - - @AzureAIPreparer() - @recorded_by_proxy_async - async def test_evaluations_get_schedule(self, azureai_endpoint): - client = self.create_async_client(endpoint=azureai_endpoint) - response = await client.evaluations.get_schedule( - id="str", - ) - - # please add some check logic here by yourself - # ... - - @AzureAIPreparer() - @recorded_by_proxy_async - async def test_evaluations_list_schedules(self, azureai_endpoint): - client = self.create_async_client(endpoint=azureai_endpoint) - response = client.evaluations.list_schedules() - result = [r async for r in response] - # please add some check logic here by yourself - # ... - - @AzureAIPreparer() - @recorded_by_proxy_async - async def test_evaluations_list_schedule_evaluations(self, azureai_endpoint): - client = self.create_async_client(endpoint=azureai_endpoint) - response = client.evaluations.list_schedule_evaluations( - id="str", - ) - result = [r async for r in response] - # please add some check logic here by yourself - # ... - - @AzureAIPreparer() - @recorded_by_proxy_async - async def test_evaluations_delete_schedule(self, azureai_endpoint): - client = self.create_async_client(endpoint=azureai_endpoint) - response = await client.evaluations.delete_schedule( - id="str", - ) - - # please add some check logic here by yourself - # ... diff --git a/sdk/ai/azure-ai-client/generated_tests/test_endpoints_operations.py b/sdk/ai/azure-ai-client/generated_tests/test_endpoints_operations.py deleted file mode 100644 index b3452e1889bf..000000000000 --- a/sdk/ai/azure-ai-client/generated_tests/test_endpoints_operations.py +++ /dev/null @@ -1,45 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) Python Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -import pytest -from devtools_testutils import recorded_by_proxy -from testpreparer import ClientTestBase, Preparer - - -@pytest.mark.skip("you may need to update the auto-generated test case before run it") -class TestEndpointsOperations(ClientTestBase): - @Preparer() - @recorded_by_proxy - def test_endpoints_list(self, _endpoint): - client = self.create_client(endpoint=_endpoint) - response = client.endpoints.list() - - # please add some check logic here by yourself - # ... - - @Preparer() - @recorded_by_proxy - def test_endpoints_list_secrets(self, _endpoint): - client = self.create_client(endpoint=_endpoint) - response = client.endpoints.list_secrets( - connection_name_in_url="str", - body={ - "apiVersionInBody": "str", - "connectionName": "str", - "resourceGroupName": "str", - "subscriptionId": "str", - "workspaceName": "str", - }, - connection_name="str", - subscription_id="str", - resource_group_name="str", - workspace_name="str", - api_version_in_body="str", - ) - - # please add some check logic here by yourself - # ... diff --git a/sdk/ai/azure-ai-client/generated_tests/test_endpoints_operations_async.py b/sdk/ai/azure-ai-client/generated_tests/test_endpoints_operations_async.py deleted file mode 100644 index 3bcdb63affc8..000000000000 --- a/sdk/ai/azure-ai-client/generated_tests/test_endpoints_operations_async.py +++ /dev/null @@ -1,46 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) Python Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -import pytest -from devtools_testutils.aio import recorded_by_proxy_async -from testpreparer import Preparer -from testpreparer_async import ClientTestBaseAsync - - -@pytest.mark.skip("you may need to update the auto-generated test case before run it") -class TestEndpointsOperationsAsync(ClientTestBaseAsync): - @Preparer() - @recorded_by_proxy_async - async def test_endpoints_list(self, _endpoint): - client = self.create_async_client(endpoint=_endpoint) - response = await client.endpoints.list() - - # please add some check logic here by yourself - # ... - - @Preparer() - @recorded_by_proxy_async - async def test_endpoints_list_secrets(self, _endpoint): - client = self.create_async_client(endpoint=_endpoint) - response = await client.endpoints.list_secrets( - connection_name_in_url="str", - body={ - "apiVersionInBody": "str", - "connectionName": "str", - "resourceGroupName": "str", - "subscriptionId": "str", - "workspaceName": "str", - }, - connection_name="str", - subscription_id="str", - resource_group_name="str", - workspace_name="str", - api_version_in_body="str", - ) - - # please add some check logic here by yourself - # ... diff --git a/sdk/ai/azure-ai-client/generated_tests/test_evaluations_operations.py b/sdk/ai/azure-ai-client/generated_tests/test_evaluations_operations.py deleted file mode 100644 index 13e69dbd88c1..000000000000 --- a/sdk/ai/azure-ai-client/generated_tests/test_evaluations_operations.py +++ /dev/null @@ -1,71 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) Python Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -import pytest -from devtools_testutils import recorded_by_proxy -from testpreparer import ClientTestBase, Preparer - - -@pytest.mark.skip("you may need to update the auto-generated test case before run it") -class TestEvaluationsOperations(ClientTestBase): - @Preparer() - @recorded_by_proxy - def test_evaluations_evaluations_get(self, _endpoint): - client = self.create_client(endpoint=_endpoint) - response = client.evaluations.evaluations.get( - id="str", - ) - - # please add some check logic here by yourself - # ... - - @Preparer() - @recorded_by_proxy - def test_evaluations_evaluations_create(self, _endpoint): - client = self.create_client(endpoint=_endpoint) - response = client.evaluations.evaluations.create( - body={ - "data": "input_data", - "evaluators": {"str": {"id": "str", "dataMapping": {"str": "str"}, "initParams": {"str": {}}}}, - "description": "str", - "displayName": "str", - "id": "str", - "properties": {"str": "str"}, - "status": "str", - "systemData": { - "createdAt": "2020-02-20 00:00:00", - "createdBy": "str", - "createdByType": "str", - "lastModifiedAt": "2020-02-20 00:00:00", - }, - "tags": {"str": "str"}, - }, - ) - - # please add some check logic here by yourself - # ... - - @Preparer() - @recorded_by_proxy - def test_evaluations_evaluations_list(self, _endpoint): - client = self.create_client(endpoint=_endpoint) - response = client.evaluations.evaluations.list() - result = [r for r in response] - # please add some check logic here by yourself - # ... - - @Preparer() - @recorded_by_proxy - def test_evaluations_evaluations_update(self, _endpoint): - client = self.create_client(endpoint=_endpoint) - response = client.evaluations.evaluations.update( - id="str", - body={"description": "str", "displayName": "str", "tags": {"str": "str"}}, - ) - - # please add some check logic here by yourself - # ... diff --git a/sdk/ai/azure-ai-client/generated_tests/test_evaluations_operations_async.py b/sdk/ai/azure-ai-client/generated_tests/test_evaluations_operations_async.py deleted file mode 100644 index 345d84c7d13d..000000000000 --- a/sdk/ai/azure-ai-client/generated_tests/test_evaluations_operations_async.py +++ /dev/null @@ -1,72 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) Python Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -import pytest -from devtools_testutils.aio import recorded_by_proxy_async -from testpreparer import Preparer -from testpreparer_async import ClientTestBaseAsync - - -@pytest.mark.skip("you may need to update the auto-generated test case before run it") -class TestEvaluationsOperationsAsync(ClientTestBaseAsync): - @Preparer() - @recorded_by_proxy_async - async def test_evaluations_evaluations_get(self, _endpoint): - client = self.create_async_client(endpoint=_endpoint) - response = await client.evaluations.evaluations.get( - id="str", - ) - - # please add some check logic here by yourself - # ... - - @Preparer() - @recorded_by_proxy_async - async def test_evaluations_evaluations_create(self, _endpoint): - client = self.create_async_client(endpoint=_endpoint) - response = await client.evaluations.evaluations.create( - body={ - "data": "input_data", - "evaluators": {"str": {"id": "str", "dataMapping": {"str": "str"}, "initParams": {"str": {}}}}, - "description": "str", - "displayName": "str", - "id": "str", - "properties": {"str": "str"}, - "status": "str", - "systemData": { - "createdAt": "2020-02-20 00:00:00", - "createdBy": "str", - "createdByType": "str", - "lastModifiedAt": "2020-02-20 00:00:00", - }, - "tags": {"str": "str"}, - }, - ) - - # please add some check logic here by yourself - # ... - - @Preparer() - @recorded_by_proxy_async - async def test_evaluations_evaluations_list(self, _endpoint): - client = self.create_async_client(endpoint=_endpoint) - response = client.evaluations.evaluations.list() - result = [r async for r in response] - # please add some check logic here by yourself - # ... - - @Preparer() - @recorded_by_proxy_async - async def test_evaluations_evaluations_update(self, _endpoint): - client = self.create_async_client(endpoint=_endpoint) - response = await client.evaluations.evaluations.update( - id="str", - body={"description": "str", "displayName": "str", "tags": {"str": "str"}}, - ) - - # please add some check logic here by yourself - # ... diff --git a/sdk/ai/azure-ai-client/generated_tests/testpreparer.py b/sdk/ai/azure-ai-client/generated_tests/testpreparer.py deleted file mode 100644 index 7230206c1f80..000000000000 --- a/sdk/ai/azure-ai-client/generated_tests/testpreparer.py +++ /dev/null @@ -1,24 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) Python Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -from azure.ai.client import AzureAIClient -from devtools_testutils import AzureRecordedTestCase, PowerShellPreparer -import functools - - -class AzureAIClientTestBase(AzureRecordedTestCase): - - def create_client(self, endpoint): - credential = self.get_credential(AzureAIClient) - return self.create_client_from_credential( - AzureAIClient, - credential=credential, - endpoint=endpoint, - ) - - -AzureAIPreparer = functools.partial(PowerShellPreparer, "azureai", azureai_endpoint="https://fake_azureai_endpoint.com") diff --git a/sdk/ai/azure-ai-client/generated_tests/testpreparer_async.py b/sdk/ai/azure-ai-client/generated_tests/testpreparer_async.py deleted file mode 100644 index 85d0b79b37c3..000000000000 --- a/sdk/ai/azure-ai-client/generated_tests/testpreparer_async.py +++ /dev/null @@ -1,20 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) Python Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -from azure.ai.client.aio import AzureAIClient -from devtools_testutils import AzureRecordedTestCase - - -class AzureAIClientTestBaseAsync(AzureRecordedTestCase): - - def create_async_client(self, endpoint): - credential = self.get_credential(AzureAIClient, is_async=True) - return self.create_client_from_credential( - AzureAIClient, - credential=credential, - endpoint=endpoint, - ) diff --git a/sdk/ai/azure-ai-client/samples/inference/async_samples/sample_get_azure_openai_client_async.py b/sdk/ai/azure-ai-client/samples/inference/async_samples/sample_get_azure_openai_client_async.py new file mode 100644 index 000000000000..e2d03086acf5 --- /dev/null +++ b/sdk/ai/azure-ai-client/samples/inference/async_samples/sample_get_azure_openai_client_async.py @@ -0,0 +1,65 @@ +# ------------------------------------ +# Copyright (c) Microsoft Corporation. +# Licensed under the MIT License. +# ------------------------------------ + +""" +FILE: sample_get_azure_openai_client_async.py + +DESCRIPTION: + Given an AzureAIClient, this sample demonstrates how to get an authenticated + AsyncAzureOpenAI client from the azure.ai.inference package. + +USAGE: + python sample_get_azure_openai_client_async.py + + Before running the sample: + + pip install azure.ai.client aiohttp openai_async + + Set this environment variable with your own values: + AI_CLIENT_CONNECTION_STRING - the Azure AI Project connection string, as found in your AI Studio Project. +""" +import os +import asyncio +from azure.ai.client.aio import AzureAIClient +from azure.identity import DefaultAzureCredential + +async def sample_get_azure_openai_client_async(): + + # Create an Azure AI Client from a connection string, copied from your AI Studio project. + # It should have the format ";;;" + async with AzureAIClient.from_connection_string( + credential=DefaultAzureCredential(), + connection=os.environ["AI_CLIENT_CONNECTION_STRING"], + ) as ai_client: + + # Or, you can create the Azure AI Client by giving all required parameters directly + # async with AzureAIClient( + # credential=DefaultAzureCredential(), + # endpoint=os.environ["AI_CLIENT_ENDPOINT"], + # subscription_id=os.environ["AI_CLIENT_SUBSCRIPTION_ID"], + # resource_group_name=os.environ["AI_CLIENT_RESOURCE_GROUP_NAME"], + # workspace_name=os.environ["AI_CLIENT_WORKSPACE_NAME"], + # ) as ai_client: + + # Get an authenticated AsyncAzureOpenAI client for your default Azure OpenAI connection: + async with await ai_client.inference.get_azure_openai_client() as client: + + response = await client.chat.completions.create( + model="gpt-4-0613", + messages=[ + { + "role": "user", + "content": "How many feet are in a mile?", + }, + ], + ) + + print(response.choices[0].message.content) + +async def main(): + await sample_get_azure_openai_client_async() + +if __name__ == "__main__": + asyncio.run(main()) diff --git a/sdk/ai/azure-ai-client/samples/inference/async_samples/sample_get_chat_completions_client_async.py b/sdk/ai/azure-ai-client/samples/inference/async_samples/sample_get_chat_completions_client_async.py index 9406ed579964..27201ddef947 100644 --- a/sdk/ai/azure-ai-client/samples/inference/async_samples/sample_get_chat_completions_client_async.py +++ b/sdk/ai/azure-ai-client/samples/inference/async_samples/sample_get_chat_completions_client_async.py @@ -7,8 +7,8 @@ FILE: sample_get_chat_completions_client_async.py DESCRIPTION: - This sample demonstrates how to get an authenticated ChatCompletionsClient - from the azure.ai.inference package, from an AzureAIClient. + Given an AzureAIClient, this sample demonstrates how to get an authenticated + async ChatCompletionsClient from the azure.ai.inference package. USAGE: python sample_get_chat_completions_client_async.py @@ -17,8 +17,8 @@ pip install azure.ai.client aiohttp azure-identity - Set the environment variables with your own values: - 1) AI_CLIENT_CONNECTION_STRING - the Azure AI Project connection string, as found in your AI Studio Project. + Set this environment variables with your own values: + AI_CLIENT_CONNECTION_STRING - the Azure AI Project connection string, as found in your AI Studio Project. """ import os import asyncio diff --git a/sdk/ai/azure-ai-client/samples/inference/async_samples/sample_get_embeddings_client_async.py b/sdk/ai/azure-ai-client/samples/inference/async_samples/sample_get_embeddings_client_async.py new file mode 100644 index 000000000000..051ba27eb26d --- /dev/null +++ b/sdk/ai/azure-ai-client/samples/inference/async_samples/sample_get_embeddings_client_async.py @@ -0,0 +1,63 @@ +# ------------------------------------ +# Copyright (c) Microsoft Corporation. +# Licensed under the MIT License. +# ------------------------------------ + +""" +FILE: sample_get_embeddings_client_async.py + +DESCRIPTION: + Given an AzureAIClient, this sample demonstrates how to get an authenticated + async EmbeddingsClient from the azure.ai.inference package. + +USAGE: + python sample_get_embeddings_client_async.py + + Before running the sample: + + pip install azure.ai.client aiohttp azure-identity + + Set this environment variable with your own values: + AI_CLIENT_CONNECTION_STRING - the Azure AI Project connection string, as found in your AI Studio Project. +""" +import asyncio +import os +from azure.ai.client.aio import AzureAIClient +from azure.identity import DefaultAzureCredential + +async def sample_get_embeddings_client_async(): + + # Create an Azure AI Client from a connection string, copied from your AI Studio project. + # It should have the format ";;;" + async with AzureAIClient.from_connection_string( + credential=DefaultAzureCredential(), + connection=os.environ["AI_CLIENT_CONNECTION_STRING"], + ) as ai_client: + + # Or, you can create the Azure AI Client by giving all required parameters directly + # async with AzureAIClient( + # credential=DefaultAzureCredential(), + # endpoint=os.environ["AI_CLIENT_ENDPOINT"], + # subscription_id=os.environ["AI_CLIENT_SUBSCRIPTION_ID"], + # resource_group_name=os.environ["AI_CLIENT_RESOURCE_GROUP_NAME"], + # workspace_name=os.environ["AI_CLIENT_WORKSPACE_NAME"], + # ) as ai_client: + + # Get an authenticated async azure.ai.inference embeddings client for your default Serverless connection: + async with await ai_client.inference.get_embeddings_client() as client: + + response = await client.embed(input=["first phrase", "second phrase", "third phrase"]) + + for item in response.data: + length = len(item.embedding) + print( + f"data[{item.index}]: length={length}, [{item.embedding[0]}, {item.embedding[1]}, " + f"..., {item.embedding[length-2]}, {item.embedding[length-1]}]" + ) + + +async def main(): + await sample_get_embeddings_client_async() + +if __name__ == "__main__": + asyncio.run(main()) \ No newline at end of file diff --git a/sdk/ai/azure-ai-client/samples/inference/sample_get_azure_openai_client.py b/sdk/ai/azure-ai-client/samples/inference/sample_get_azure_openai_client.py index 82ffeecdd8ef..73f8c00ccd6e 100644 --- a/sdk/ai/azure-ai-client/samples/inference/sample_get_azure_openai_client.py +++ b/sdk/ai/azure-ai-client/samples/inference/sample_get_azure_openai_client.py @@ -2,6 +2,24 @@ # Copyright (c) Microsoft Corporation. # Licensed under the MIT License. # ------------------------------------ + +""" +FILE: sample_get_azure_openai_client.py + +DESCRIPTION: + Given an AzureAIClient, this sample demonstrates how to get an authenticated + AsyncAzureOpenAI client from the azure.ai.inference package. + +USAGE: + python sample_get_azure_openai_client.py + + Before running the sample: + + pip install azure.ai.client openai + + Set this environment variable with your own values: + AI_CLIENT_CONNECTION_STRING - the Azure AI Project connection string, as found in your AI Studio Project. +""" import os from azure.ai.client import AzureAIClient from azure.identity import DefaultAzureCredential diff --git a/sdk/ai/azure-ai-client/samples/inference/sample_get_chat_completions_client.py b/sdk/ai/azure-ai-client/samples/inference/sample_get_chat_completions_client.py index 07613f1ff1a8..20ac52c8dd0a 100644 --- a/sdk/ai/azure-ai-client/samples/inference/sample_get_chat_completions_client.py +++ b/sdk/ai/azure-ai-client/samples/inference/sample_get_chat_completions_client.py @@ -2,6 +2,24 @@ # Copyright (c) Microsoft Corporation. # Licensed under the MIT License. # ------------------------------------ + +""" +FILE: sample_get_chat_completions_client.py + +DESCRIPTION: + Given an AzureAIClient, this sample demonstrates how to get an authenticated + async ChatCompletionsClient from the azure.ai.inference package. + +USAGE: + python sample_get_chat_completions_client.py + + Before running the sample: + + pip install azure.ai.client azure-identity + + Set this environment variables with your own values: + AI_CLIENT_CONNECTION_STRING - the Azure AI Project connection string, as found in your AI Studio Project. +""" import os from azure.ai.client import AzureAIClient from azure.ai.inference.models import UserMessage diff --git a/sdk/ai/azure-ai-client/samples/inference/sample_get_embeddings_client.py b/sdk/ai/azure-ai-client/samples/inference/sample_get_embeddings_client.py index e0b6bf7d6e81..cc6a306685ad 100644 --- a/sdk/ai/azure-ai-client/samples/inference/sample_get_embeddings_client.py +++ b/sdk/ai/azure-ai-client/samples/inference/sample_get_embeddings_client.py @@ -2,6 +2,24 @@ # Copyright (c) Microsoft Corporation. # Licensed under the MIT License. # ------------------------------------ + +""" +FILE: sample_get_embeddings_client.py + +DESCRIPTION: + Given an AzureAIClient, this sample demonstrates how to get an authenticated + async EmbeddingsClient from the azure.ai.inference package. + +USAGE: + python sample_get_embeddings_client.py + + Before running the sample: + + pip install azure.ai.client azure-identity + + Set this environment variable with your own values: + AI_CLIENT_CONNECTION_STRING - the Azure AI Project connection string, as found in your AI Studio Project. +""" import os from azure.ai.client import AzureAIClient from azure.identity import DefaultAzureCredential