From b6fc8351b692423d9805148ca7dc9d5018a827ba Mon Sep 17 00:00:00 2001 From: ruandersMSFT Date: Sat, 2 Nov 2024 09:53:24 -0600 Subject: [PATCH 1/2] VersionUpgrade --- .devcontainer/Dockerfile | 2 +- .../approaches/chatreadretrieveread.py | 4 +- app/backend/approaches/mathassistant.py | 13 +++--- .../approaches/tabulardataassistant.py | 1 + app/backend/pyvenv.cfg | 2 +- app/backend/requirements.txt | 45 +++++++++---------- app/enrichment/pyvenv.cfg | 2 +- app/enrichment/requirements.txt | 24 +++++----- .../enrichment_container_image/Dockerfile | 2 +- .../webapp_container_image/Dockerfile | 2 +- functions/Dockerfile | 4 +- functions/requirements.txt | 30 +++++++------ infra/core/host/webapp/variables.tf | 2 +- infra/main.tf | 2 +- 14 files changed, 70 insertions(+), 65 deletions(-) diff --git a/.devcontainer/Dockerfile b/.devcontainer/Dockerfile index 6b54f97e5..2bd192fab 100644 --- a/.devcontainer/Dockerfile +++ b/.devcontainer/Dockerfile @@ -1,4 +1,4 @@ -FROM mcr.microsoft.com/vscode/devcontainers/python:3.10-bookworm +FROM mcr.microsoft.com/vscode/devcontainers/python:3.12-bookworm # Avoid warnings by switching to noninteractive ENV DEBIAN_FRONTEND=noninteractive diff --git a/app/backend/approaches/chatreadretrieveread.py b/app/backend/approaches/chatreadretrieveread.py index 2720b3163..e74b44a56 100644 --- a/app/backend/approaches/chatreadretrieveread.py +++ b/app/backend/approaches/chatreadretrieveread.py @@ -13,7 +13,7 @@ from openai import BadRequestError from approaches.approach import Approach from azure.search.documents import SearchClient -from azure.search.documents.models import RawVectorQuery +from azure.search.documents.models import VectorizedQuery from azure.search.documents.models import QueryType from azure.storage.blob import ( BlobSasPermissions, @@ -245,7 +245,7 @@ async def run(self, history: Sequence[dict[str, str]], overrides: dict[str, Any] return # Go no further #vector set up for pure vector search & Hybrid search & Hybrid semantic - vector = RawVectorQuery(vector=embedded_query_vector, k=top, fields="contentVector") + vector = VectorizedQuery(vector=embedded_query_vector, k_nearest_neighbors=top, fields="contentVector") #Create a filter for the search query if (folder_filter != "") & (folder_filter != "All"): diff --git a/app/backend/approaches/mathassistant.py b/app/backend/approaches/mathassistant.py index f03e8e444..1fb4c7586 100644 --- a/app/backend/approaches/mathassistant.py +++ b/app/backend/approaches/mathassistant.py @@ -6,9 +6,12 @@ import os import warnings from dotenv import load_dotenv +from typing import ClassVar + from langchain_openai import AzureChatOpenAI -from langchain.agents import initialize_agent, load_tools, AgentType +from langchain.agents import initialize_agent, AgentType from langchain.prompts import ChatPromptTemplate +from langchain_community.agent_toolkits.load_tools import load_tools from azure.identity import ManagedIdentityCredential, AzureAuthorityHosts, DefaultAzureCredential, get_bearer_token_provider warnings.filterwarnings('ignore') @@ -51,8 +54,8 @@ ) class PythagorasTool(BaseTool): - name = "Hypotenuse calculator" - description = desc + name: ClassVar[str] = "Hypotenuse calculator" + description: ClassVar[str] = desc def _run( self, @@ -83,8 +86,8 @@ def _arun(self, query: str): class CircumferenceTool(BaseTool): - name = "Circumference calculator" - description = "use this tool when you need to calculate a circumference using the radius of a circle" + name: ClassVar[str] = "Circumference calculator" + description: ClassVar[str] = "use this tool when you need to calculate a circumference using the radius of a circle" def _run(self, radius: Union[int, float]): return float(radius)*2.0*pi diff --git a/app/backend/approaches/tabulardataassistant.py b/app/backend/approaches/tabulardataassistant.py index 1a13db64a..6ee465091 100644 --- a/app/backend/approaches/tabulardataassistant.py +++ b/app/backend/approaches/tabulardataassistant.py @@ -12,6 +12,7 @@ from langchain_experimental.agents.agent_toolkits import create_pandas_dataframe_agent from langchain.agents.agent_types import AgentType from langchain_openai import AzureChatOpenAI +from langchain_community.agent_toolkits.load_tools import load_tools from azure.identity import ManagedIdentityCredential, AzureAuthorityHosts, DefaultAzureCredential, get_bearer_token_provider warnings.filterwarnings('ignore') diff --git a/app/backend/pyvenv.cfg b/app/backend/pyvenv.cfg index 0dc0b53ab..034eba0fd 100644 --- a/app/backend/pyvenv.cfg +++ b/app/backend/pyvenv.cfg @@ -1,3 +1,3 @@ home = /workspaces/info-asst/.venv/bin include-system-site-packages = false -version = 3.10.12 +version = 3.12.6 diff --git a/app/backend/requirements.txt b/app/backend/requirements.txt index 9e05aca82..6a13c5f28 100644 --- a/app/backend/requirements.txt +++ b/app/backend/requirements.txt @@ -1,28 +1,27 @@ #### Any version change made here should also be made and tested for the enrichment and function apps in /functions and /app/enrichment -azure-identity==1.16.1 -Flask==2.3.2 -langchain==0.2.10 +azure-cosmos==4.7.0 +azure-identity==1.18.0 azure-mgmt-cognitiveservices==13.5.0 -openai==1.35.8 -# azure-search-documents==11.4.0 -azure-search-documents==11.4.0b11 -azure-storage-blob==12.20.0 -azure-cosmos == 4.7.0 -tiktoken == 0.7.0 -fastapi == 0.109.1 -fastapi-utils == 0.2.1 -uvicorn == 0.23.2 -numexpr == 2.10.0 -langchain-experimental==0.0.62 +azure-search-documents==11.5.1 +azure-storage-blob==12.23.0 +fastapi==0.115.0 +fastapi-utils==0.7.0 +Flask==3.0.3 +gunicorn==23.0.0 +langchain==0.3.1 +langchain-community==0.3.1 +langchain-experimental==0.3.2 +langchain-openai==0.2.1 +matplotlib==3.9.2 microsoft-bing-websearch==1.0.0 -tabulate==0.9.0 -matplotlib==3.8.3 +numexpr==2.10.1 +openai==1.49.0 +pandas==2.2.3 +Pillow==10.4.0 +pytest==8.3.3 python-dotenv==1.0.1 -pandas==2.2.1 -python-multipart==0.0.9 -Pillow==10.3.0 +python-multipart==0.0.10 +tabulate==0.9.0 +tiktoken==0.7.0 +uvicorn==0.30.6 wikipedia==1.4.0 -langchain-openai == 0.1.14 -pytest==8.2.1 -python-dotenv==1.0.1 -langchain-community==0.2.9 diff --git a/app/enrichment/pyvenv.cfg b/app/enrichment/pyvenv.cfg index f87ec4e4c..ba6a1e9a8 100644 --- a/app/enrichment/pyvenv.cfg +++ b/app/enrichment/pyvenv.cfg @@ -1,3 +1,3 @@ home = /workspaces/info-asst/.venv/bin include-system-site-packages = false -version = 3.10.12 \ No newline at end of file +version = 3.12.6 \ No newline at end of file diff --git a/app/enrichment/requirements.txt b/app/enrichment/requirements.txt index 99365e588..b57778ba7 100644 --- a/app/enrichment/requirements.txt +++ b/app/enrichment/requirements.txt @@ -1,17 +1,17 @@ #### Any version change made here should also be made and tested for the webapp backend and function apps in /functions and /app/backend --extra-index-url https://download.pytorch.org/whl/cpu +azure-core==1.31.0 +azure-cosmos==4.7.0 +azure-storage-blob==12.23.1 +azure-storage-queue==12.12.0 +azure-search-documents==11.5.1 +azure-identity==1.18.0 +fastapi==0.115.0 +fastapi-utils==0.7.0 +openai==1.50.2 +sentence-transformers==3.1.1 +tenacity==9.0.0 torch torchvision torchaudio -sentence-transformers == 2.3.0 -fastapi == 0.109.1 -fastapi-utils == 0.2.1 -uvicorn == 0.23.2 -azure-storage-queue == 12.6.0 -azure-storage-blob==12.16.0 -azure.search.documents==11.5.1 -azure-cosmos == 4.7.0 -azure-core == 1.30.2 -azure-identity==1.16.1 -tenacity == 8.2.3 -openai==1.17.0 +uvicorn==0.31.0 diff --git a/container_images/enrichment_container_image/Dockerfile b/container_images/enrichment_container_image/Dockerfile index 7b8193403..e9359d96f 100755 --- a/container_images/enrichment_container_image/Dockerfile +++ b/container_images/enrichment_container_image/Dockerfile @@ -1,5 +1,5 @@ # Use the official Python image from Microsoft for Azure App Service -FROM mcr.microsoft.com/devcontainers/python:3.10 +FROM mcr.microsoft.com/devcontainers/python:3.12 # Set the working directory WORKDIR /app diff --git a/container_images/webapp_container_image/Dockerfile b/container_images/webapp_container_image/Dockerfile index 282df0bb2..831dfe32d 100755 --- a/container_images/webapp_container_image/Dockerfile +++ b/container_images/webapp_container_image/Dockerfile @@ -1,5 +1,5 @@ # Use the official Node.js image -FROM mcr.microsoft.com/devcontainers/python:3.10 +FROM mcr.microsoft.com/devcontainers/python:3.12 # Set the working directory WORKDIR /home/site/wwwroot diff --git a/functions/Dockerfile b/functions/Dockerfile index a7ee02182..8135764a5 100644 --- a/functions/Dockerfile +++ b/functions/Dockerfile @@ -1,6 +1,6 @@ # To enable ssh & remote debugging on app service change the base image to the one below -# FROM mcr.microsoft.com/azure-functions/python:4-python3.10-appservice -FROM mcr.microsoft.com/azure-functions/python:4-python3.10 +# FROM mcr.microsoft.com/azure-functions/python:4-python3.12-appservice +FROM mcr.microsoft.com/azure-functions/python:4-python3.12 ENV AzureWebJobsScriptRoot=/home/site/wwwroot \ AzureFunctionsJobHost__Logging__Console__IsEnabled=true diff --git a/functions/requirements.txt b/functions/requirements.txt index af5fd045f..e3f0d2ab1 100644 --- a/functions/requirements.txt +++ b/functions/requirements.txt @@ -4,18 +4,20 @@ #### Any version change made here should also be made and tested for the web apps in /app/backend and /app/enrichment -azure-functions == 1.17.0 +azure-ai-formrecognizer==3.3.3 +azure-ai-vision-imageanalysis==1.0.0b3 +azure-core==1.31.0 +azure-cosmos==4.7.0 +azure-functions==1.21.0 +azure-identity==1.18.0 +azure-search-documents==11.5.1 +azure-storage-blob==12.23.1 +azure-storage-queue==12.12.0 +beautifulsoup4==4.12.3 +cryptography==43.0.1 +lxml==5.3.0 +nltk==3.9.1 +pyoo==1.4 +tenacity==9.0.0 tiktoken==0.7.0 -azure.ai.formrecognizer==3.2.1 -azure-storage-blob==12.20.0 -azure-core == 1.30.2 -lxml == 4.9.2 -azure-cosmos == 4.7.0 -azure-storage-queue == 12.6.0 -nltk == 3.9.1 -tenacity == 8.2.3 -unstructured[csv,doc,docx,email,html,md,msg,ppt,pptx,text,xlsx,xml] == 0.15.9 -pyoo == 1.4 -azure-search-documents == 11.4.0b11 -beautifulsoup4 == 4.12.2 -azure-identity==1.17.1 +unstructured[csv,doc,docx,email,html,md,msg,ppt,pptx,text,xlsx,xml] == 0.15.13 diff --git a/infra/core/host/webapp/variables.tf b/infra/core/host/webapp/variables.tf index 4ac219f1a..164b5f193 100644 --- a/infra/core/host/webapp/variables.tf +++ b/infra/core/host/webapp/variables.tf @@ -119,7 +119,7 @@ variable "allowedOrigins" { variable "runtimeVersion" { type = string - default = "3.10" + default = "3.12" } variable "is_secure_mode" { diff --git a/infra/main.tf b/infra/main.tf index 5ef378f2e..e79841496 100644 --- a/infra/main.tf +++ b/infra/main.tf @@ -341,7 +341,7 @@ module "webapp" { resourceGroupName = azurerm_resource_group.rg.name location = var.location tags = merge(local.tags, { "azd-service-name" = "backend" }) - runtimeVersion = "3.10" + runtimeVersion = "3.12" scmDoBuildDuringDeployment = false managedIdentity = true alwaysOn = true From afdda55c0ca0e91c9c1333c6fad7fee89e2e4e38 Mon Sep 17 00:00:00 2001 From: bjakems <165402330+bjakems@users.noreply.github.com> Date: Mon, 18 Nov 2024 15:30:18 +0000 Subject: [PATCH 2/2] lock version for fluenui/react --- app/frontend/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/frontend/package.json b/app/frontend/package.json index 2f64f2168..beb5f9692 100644 --- a/app/frontend/package.json +++ b/app/frontend/package.json @@ -9,7 +9,7 @@ "watch": "tsc && vite build --watch" }, "dependencies": { - "@fluentui/react": "^8.110.7", + "@fluentui/react": "8.121.8", "@fluentui/react-icons": "^2.0.195", "@react-spring/web": "^9.7.1", "classnames": "^2.3.1",