diff --git a/samples/microsoft/python/getting-started-agents/azure_ai_search.py b/samples/microsoft/python/getting-started-agents/azure_ai_search.py index debd9076..81bea5f8 100644 --- a/samples/microsoft/python/getting-started-agents/azure_ai_search.py +++ b/samples/microsoft/python/getting-started-agents/azure_ai_search.py @@ -36,7 +36,6 @@ project_client = AIProjectClient( endpoint=project_endpoint, credential=DefaultAzureCredential(exclude_interactive_browser_credential=False), # Use Azure Default Credential for authentication - api_version="latest", ) with project_client: @@ -81,7 +80,7 @@ # Fetch and log all messages from the thread messages = project_client.agents.messages.list(thread_id=thread.id, order=ListSortOrder.ASCENDING) - for message in messages.data: + for message in messages: print(f"Role: {message.role}, Content: {message.content}") # Delete the agent when done to clean up resources diff --git a/samples/microsoft/python/getting-started-agents/azure_functions.py b/samples/microsoft/python/getting-started-agents/azure_functions.py index b5c9e581..8ee32009 100644 --- a/samples/microsoft/python/getting-started-agents/azure_functions.py +++ b/samples/microsoft/python/getting-started-agents/azure_functions.py @@ -8,17 +8,17 @@ DESCRIPTION: This sample demonstrates how to use azure function agent operations from the Azure Agents service using a synchronous client. - + USAGE: python sample_agents_azure_functions.py - + Before running the sample: - + pip install azure-ai-agents azure-identity - + Set these environment variables with your own values: 1) PROJECT_ENDPOINT - the Azure AI Agents endpoint. - 2) MODEL_DEPLOYMENT_NAME - The deployment name of the AI model, as found under the "Name" column in + 2) MODEL_DEPLOYMENT_NAME - The deployment name of the AI model, as found under the "Name" column in the "Models + endpoints" tab in your Azure AI Foundry project. 3) STORAGE_SERVICE_ENDPONT - the storage service queue endpoint, triggering Azure function. Please see Getting Started with Azure Functions page for more information on Azure Functions: @@ -38,7 +38,6 @@ project_client = AIProjectClient( endpoint=project_endpoint, credential=DefaultAzureCredential(), - api_version="latest", # Use the latest API version ) # Use the project client within a context manager to ensure proper resource cleanup diff --git a/samples/microsoft/python/getting-started-agents/basic_agent.py b/samples/microsoft/python/getting-started-agents/basic_agent.py index 1d02ae6e..bd552a7c 100644 --- a/samples/microsoft/python/getting-started-agents/basic_agent.py +++ b/samples/microsoft/python/getting-started-agents/basic_agent.py @@ -37,7 +37,6 @@ project_client = AIProjectClient( endpoint=project_endpoint, credential=DefaultAzureCredential(exclude_interactive_browser_credential=False), # Use Azure Default Credential for authentication - api_version="latest", ) with project_client: diff --git a/samples/microsoft/python/getting-started-agents/bing_grounding.py b/samples/microsoft/python/getting-started-agents/bing_grounding.py index 62748f64..f491ba9b 100644 --- a/samples/microsoft/python/getting-started-agents/bing_grounding.py +++ b/samples/microsoft/python/getting-started-agents/bing_grounding.py @@ -33,14 +33,13 @@ project_endpoint = os.environ["PROJECT_ENDPOINT"] # Ensure the PROJECT_ENDPOINT environment variable is set # Ensure the BING_CONNECTION_ID environment variable is set, following the format: #"/subscriptions//resourceGroups//providers/Microsoft.CognitiveServices/accounts//projects//connections/" -conn_id = os.environ["BING_CONNECTION_ID"] +conn_id = os.environ["BING_CONNECTION_ID"] model_deployment_name = os.environ["MODEL_DEPLOYMENT_NAME"] # Ensure the MODEL_DEPLOYMENT_NAME environment variable is set # Initialize the AIProjectClient with the endpoint and credentials project_client = AIProjectClient( endpoint=project_endpoint, credential=DefaultAzureCredential(), # Use Azure Default Credential for authentication - api_version="latest", ) with project_client: diff --git a/samples/microsoft/python/getting-started-agents/enterprise_search.py b/samples/microsoft/python/getting-started-agents/enterprise_search.py index 04d1035e..bc0abc7c 100644 --- a/samples/microsoft/python/getting-started-agents/enterprise_search.py +++ b/samples/microsoft/python/getting-started-agents/enterprise_search.py @@ -19,7 +19,7 @@ Set these environment variables with your own values: 1) PROJECT_ENDPOINT - The Azure AI Agents endpoint. - 2) MODEL_DEPLOYMENT_NAME - The deployment name of the AI model, as found under the "Name" column in + 2) MODEL_DEPLOYMENT_NAME - The deployment name of the AI model, as found under the "Name" column in the "Models + endpoints" tab in your Azure AI Foundry project. """ @@ -43,7 +43,6 @@ project_client = AIProjectClient( endpoint=project_endpoint, credential=DefaultAzureCredential(exclude_interactive_browser_credential=False), # Use Azure Default Credential for authentication - api_version="latest", ) with project_client: @@ -85,7 +84,7 @@ # Fetch and log all messages from the thread messages = project_client.agents.messages.list(thread_id=thread.id) - for message in messages.data: + for message in messages: print(f"Role: {message.role}, Content: {message.content}") # Delete the agent after use diff --git a/samples/microsoft/python/getting-started-agents/file_search.py b/samples/microsoft/python/getting-started-agents/file_search.py index cfb70bd2..eab441c1 100644 --- a/samples/microsoft/python/getting-started-agents/file_search.py +++ b/samples/microsoft/python/getting-started-agents/file_search.py @@ -40,7 +40,6 @@ project_client = AIProjectClient( endpoint=project_endpoint, credential=DefaultAzureCredential(exclude_interactive_browser_credential=False), # Use Azure Default Credential for authentication - api_version="latest", ) with project_client: @@ -103,5 +102,5 @@ # Fetch and log all messages from the thread messages = project_client.agents.messages.list(thread_id=thread.id) - for message in messages.data: + for message in messages: print(f"Role: {message.role}, Content: {message.content}") \ No newline at end of file diff --git a/samples/microsoft/python/getting-started-agents/functions_calling.py b/samples/microsoft/python/getting-started-agents/functions_calling.py index 2abd34c4..8613fbdc 100644 --- a/samples/microsoft/python/getting-started-agents/functions_calling.py +++ b/samples/microsoft/python/getting-started-agents/functions_calling.py @@ -17,7 +17,7 @@ Set these environment variables with your own values: 1) PROJECT_ENDPOINT - the Azure AI Agents endpoint. - 2) MODEL_DEPLOYMENT_NAME - The deployment name of the AI model, as found under the "Name" column in + 2) MODEL_DEPLOYMENT_NAME - The deployment name of the AI model, as found under the "Name" column in the "Models + endpoints" tab in your Azure AI Foundry project. """ # Import necessary modules @@ -33,7 +33,6 @@ project_client = AIProjectClient( endpoint=project_endpoint, # Azure AI Agents endpoint credential=DefaultAzureCredential(), # Use Azure Default Credential for authentication - api_version="latest", # Use the latest API version ) # Initialize the FunctionTool with user-defined functions diff --git a/samples/microsoft/python/getting-started-agents/logic_apps.py b/samples/microsoft/python/getting-started-agents/logic_apps.py index 644263e5..a5d5cc98 100644 --- a/samples/microsoft/python/getting-started-agents/logic_apps.py +++ b/samples/microsoft/python/getting-started-agents/logic_apps.py @@ -7,24 +7,24 @@ """ DESCRIPTION: This sample demonstrates how to use agents with Logic Apps to execute the task of sending an email. - + PREREQUISITES: 1) Create a Logic App within the same resource group as your Azure AI Project in Azure Portal - 2) To configure your Logic App to send emails, you must include an HTTP request trigger that is + 2) To configure your Logic App to send emails, you must include an HTTP request trigger that is configured to accept JSON with 'to', 'subject', and 'body'. The guide to creating a Logic App Workflow - can be found here: + can be found here: https://learn.microsoft.com/en-us/azure/ai-services/openai/how-to/agents-logic-apps#create-logic-apps-workflows-for-function-calling - + USAGE: python sample_agents_logic_apps.py - + Before running the sample: - + pip install azure-ai-agents azure-identity Set this environment variables with your own values: 1) PROJECT_ENDPOINT - the Azure AI Agents endpoint. - 2) MODEL_DEPLOYMENT_NAME - The deployment name of the AI model, as found under the "Name" column in + 2) MODEL_DEPLOYMENT_NAME - The deployment name of the AI model, as found under the "Name" column in the "Models + endpoints" tab in your Azure AI Foundry project. Replace the following values in the sample with your own values: @@ -40,7 +40,7 @@ from typing import Set from azure.ai.agents.models import ToolSet, FunctionTool from azure.identity import DefaultAzureCredential -from azure.ai.projects import AIProjectClient +from azure.ai.projects import AIProjectClient # Import user-defined functions and tools from user_functions import fetch_current_datetime # Example user function to fetch current datetime @@ -52,7 +52,6 @@ project_client = AIProjectClient( endpoint=os.environ["PROJECT_ENDPOINT"], # Azure AI Agents endpoint from environment variables credential=DefaultAzureCredential(), # Use Azure Default Credential for authentication - api_version="latest", # Use the latest API version ) # Extract subscription ID and resource group name from environment variables diff --git a/samples/microsoft/python/getting-started-agents/quickstart.py b/samples/microsoft/python/getting-started-agents/quickstart.py index 09323144..d29f9912 100644 --- a/samples/microsoft/python/getting-started-agents/quickstart.py +++ b/samples/microsoft/python/getting-started-agents/quickstart.py @@ -37,7 +37,6 @@ project_client = AIProjectClient( endpoint=os.environ["PROJECT_ENDPOINT"], # Ensure the PROJECT_ENDPOINT environment variable is set credential=DefaultAzureCredential(), # Use Azure Default Credential for authentication - api_version="latest", ) # Access the Azure OpenAI client for chat completions @@ -85,7 +84,7 @@ # Fetch and log all messages from the thread messages = project_client.agents.messages.list(thread_id=thread.id) -for message in messages.data: +for message in messages: print(f"Role: {message.role}, Content: {message.content}") # Delete the agent after use @@ -133,7 +132,7 @@ result = project.evaluation.create_agent_evaluation( thread=thread.id, - run=run.id, + run=run.id, evaluators=[EvaluatorIds.AGENT_QUALITY_EVALUATOR]) # wait for evaluation to complete