diff --git a/src/backend/.env.sample b/src/backend/.env.sample index ddc1103d3..b0c3738b5 100644 --- a/src/backend/.env.sample +++ b/src/backend/.env.sample @@ -12,10 +12,10 @@ AZURE_AI_PROJECT_ENDPOINT= AZURE_AI_SUBSCRIPTION_ID= AZURE_AI_RESOURCE_GROUP= AZURE_AI_PROJECT_NAME= -AZURE_AI_AGENT_PROJECT_CONNECTION_STRING= AZURE_AI_MODEL_DEPLOYMENT_NAME=gpt-4o +AZURE_AI_AGENT_MODEL_DEPLOYMENT_NAME=gpt-4o APPLICATIONINSIGHTS_CONNECTION_STRING= +AZURE_AI_AGENT_ENDPOINT= - -BACKEND_API_URL='http://localhost:8000' -FRONTEND_SITE_NAME='http://127.0.0.1:3000' \ No newline at end of file +BACKEND_API_URL=http://localhost:8000 +FRONTEND_SITE_NAME=http://127.0.0.1:3000 \ No newline at end of file diff --git a/src/backend/app_config.py b/src/backend/app_config.py index 798a510d2..d4b1a9e9a 100644 --- a/src/backend/app_config.py +++ b/src/backend/app_config.py @@ -49,9 +49,7 @@ def __init__(self): self.AZURE_AI_SUBSCRIPTION_ID = self._get_required("AZURE_AI_SUBSCRIPTION_ID") self.AZURE_AI_RESOURCE_GROUP = self._get_required("AZURE_AI_RESOURCE_GROUP") self.AZURE_AI_PROJECT_NAME = self._get_required("AZURE_AI_PROJECT_NAME") - self.AZURE_AI_AGENT_PROJECT_CONNECTION_STRING = self._get_required( - "AZURE_AI_AGENT_PROJECT_CONNECTION_STRING" - ) + self.AZURE_AI_AGENT_ENDPOINT = self._get_required("AZURE_AI_AGENT_ENDPOINT") # Cached clients and resources self._azure_credentials = None @@ -177,10 +175,8 @@ def get_ai_project_client(self): "Unable to acquire Azure credentials; ensure DefaultAzureCredential is configured" ) - connection_string = self.AZURE_AI_AGENT_PROJECT_CONNECTION_STRING - self._ai_project_client = AIProjectClient.from_connection_string( - credential=credential, conn_str=connection_string - ) + endpoint = self.AZURE_AI_AGENT_ENDPOINT + self._ai_project_client = AIProjectClient(endpoint=endpoint, credential=credential) return self._ai_project_client except Exception as exc: diff --git a/src/backend/app_kernel.py b/src/backend/app_kernel.py index a1ba44567..217371d20 100644 --- a/src/backend/app_kernel.py +++ b/src/backend/app_kernel.py @@ -10,7 +10,7 @@ from auth.auth_utils import get_authenticated_user_details # Azure monitoring -from azure.monitor.opentelemetry import configure_azure_monitor +# from azure.monitor.opentelemetry import configure_azure_monitor from config_kernel import Config from event_utils import track_event_if_configured @@ -38,7 +38,7 @@ connection_string = os.getenv("APPLICATIONINSIGHTS_CONNECTION_STRING") if connection_string: # Configure Application Insights if the Instrumentation Key is found - #configure_azure_monitor(connection_string=connection_string) + # configure_azure_monitor(connection_string=connection_string) logging.info( "Application Insights configured with the provided Instrumentation Key" ) diff --git a/src/backend/config_kernel.py b/src/backend/config_kernel.py index 6227292dd..80d0738af 100644 --- a/src/backend/config_kernel.py +++ b/src/backend/config_kernel.py @@ -26,9 +26,7 @@ class Config: AZURE_AI_SUBSCRIPTION_ID = config.AZURE_AI_SUBSCRIPTION_ID AZURE_AI_RESOURCE_GROUP = config.AZURE_AI_RESOURCE_GROUP AZURE_AI_PROJECT_NAME = config.AZURE_AI_PROJECT_NAME - AZURE_AI_AGENT_PROJECT_CONNECTION_STRING = ( - config.AZURE_AI_AGENT_PROJECT_CONNECTION_STRING - ) + AZURE_AI_AGENT_ENDPOINT = config.AZURE_AI_AGENT_ENDPOINT @staticmethod def GetAzureCredentials(): diff --git a/src/backend/kernel_agents/agent_base.py b/src/backend/kernel_agents/agent_base.py index 9abab5fbe..2214751b5 100644 --- a/src/backend/kernel_agents/agent_base.py +++ b/src/backend/kernel_agents/agent_base.py @@ -276,8 +276,8 @@ async def _create_azure_ai_agent_definition( # # First try to get an existing agent with this name as assistant_id try: agent_id = None - agent_list = await client.agents.list_agents() - for agent in agent_list.data: + agent_list = client.agents.list_agents() + async for agent in agent_list: if agent.name == agent_name: agent_id = agent.id break diff --git a/src/backend/kernel_agents/agent_factory.py b/src/backend/kernel_agents/agent_factory.py index 440fa2058..770dcf94f 100644 --- a/src/backend/kernel_agents/agent_factory.py +++ b/src/backend/kernel_agents/agent_factory.py @@ -6,8 +6,8 @@ # Import the new AppConfig instance from app_config import config -from azure.ai.projects.models import (ResponseFormatJsonSchema, - ResponseFormatJsonSchemaType) +from azure.ai.agents.models import (ResponseFormatJsonSchema, + ResponseFormatJsonSchemaType) from context.cosmos_memory_kernel import CosmosMemoryContext from kernel_agents.agent_base import BaseAgent from kernel_agents.generic_agent import GenericAgent diff --git a/src/backend/kernel_agents/planner_agent.py b/src/backend/kernel_agents/planner_agent.py index 2bc5ad5b8..c87516542 100644 --- a/src/backend/kernel_agents/planner_agent.py +++ b/src/backend/kernel_agents/planner_agent.py @@ -3,8 +3,8 @@ import uuid from typing import Any, Dict, List, Optional, Tuple -from azure.ai.projects.models import (ResponseFormatJsonSchema, - ResponseFormatJsonSchemaType) +from azure.ai.agents.models import (ResponseFormatJsonSchema, + ResponseFormatJsonSchemaType) from context.cosmos_memory_kernel import CosmosMemoryContext from event_utils import track_event_if_configured from kernel_agents.agent_base import BaseAgent diff --git a/src/backend/pyproject.toml b/src/backend/pyproject.toml index b989b2f14..e02186fdb 100644 --- a/src/backend/pyproject.toml +++ b/src/backend/pyproject.toml @@ -26,6 +26,6 @@ dependencies = [ "pytest-cov==5.0.0", "python-dotenv>=1.1.0", "python-multipart>=0.0.20", - "semantic-kernel>=1.28.1", + "semantic-kernel>=1.32.2", "uvicorn>=0.34.2", ] diff --git a/src/backend/requirements.txt b/src/backend/requirements.txt index 76568fc86..5cac25b2f 100644 --- a/src/backend/requirements.txt +++ b/src/backend/requirements.txt @@ -14,9 +14,9 @@ opentelemetry-instrumentation-fastapi opentelemetry-instrumentation-openai opentelemetry-exporter-otlp-proto-http -semantic-kernel[azure]==1.28.1 -azure-ai-projects==1.0.0b10 -openai +semantic-kernel[azure]==1.32.2 +azure-ai-projects==1.0.0b11 +openai==1.84.0 azure-ai-inference==1.0.0b9 azure-search-documents azure-ai-evaluation