diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 234f4aa14..5e3681f35 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -22,4 +22,3 @@ repos: require_serial: true args: # Bicep files that we want to generate ARM templates from - -f=./infra/main.bicep - - -f=./extensions/infrastructure/main.bicep diff --git a/extensions/backend/.funcignore b/extensions/backend/.funcignore deleted file mode 100644 index f1110d330..000000000 --- a/extensions/backend/.funcignore +++ /dev/null @@ -1,8 +0,0 @@ -.git* -.vscode -__azurite_db*__.json -__blobstorage__ -__queuestorage__ -local.settings.json -test -.venv diff --git a/extensions/backend/.gitignore b/extensions/backend/.gitignore deleted file mode 100644 index f15ac3fc6..000000000 --- a/extensions/backend/.gitignore +++ /dev/null @@ -1,48 +0,0 @@ -bin -obj -csx -.vs -edge -Publish - -*.user -*.suo -*.cscfg -*.Cache -project.lock.json - -/packages -/TestResults - -/tools/NuGet.exe -/App_Data -/secrets -/data -.secrets -appsettings.json -local.settings.json - -node_modules -dist - -# Local python packages -.python_packages/ - -# Python Environments -.env -.venv -env/ -venv/ -ENV/ -env.bak/ -venv.bak/ - -# Byte-compiled / optimized / DLL files -__pycache__/ -*.py[cod] -*$py.class - -# Azurite artifacts -__blobstorage__ -__queuestorage__ -__azurite_db*__.json \ No newline at end of file diff --git a/extensions/backend/.vscode/extensions.json b/extensions/backend/.vscode/extensions.json deleted file mode 100644 index dde673dcd..000000000 --- a/extensions/backend/.vscode/extensions.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "recommendations": [ - "ms-azuretools.vscode-azurefunctions" - ] -} \ No newline at end of file diff --git a/extensions/backend/host.json b/extensions/backend/host.json deleted file mode 100644 index fd4bee790..000000000 --- a/extensions/backend/host.json +++ /dev/null @@ -1,15 +0,0 @@ -{ - "version": "2.0", - "logging": { - "applicationInsights": { - "samplingSettings": { - "isEnabled": true, - "excludedTypes": "Request" - } - } - }, - "extensionBundle": { - "id": "Microsoft.Azure.Functions.ExtensionBundle", - "version": "[3.*, 4.0.0)" - } -} \ No newline at end of file diff --git a/extensions/backend/http_cwyod/__init__.py b/extensions/backend/http_cwyod/__init__.py deleted file mode 100644 index b29172f06..000000000 --- a/extensions/backend/http_cwyod/__init__.py +++ /dev/null @@ -1,57 +0,0 @@ -import azure.functions as func -import logging -import json -import os -import sys - -# Add the path to the code folder to the system path so that the code can be imported -sys.path.insert(0, "../../code") - - -def main(req: func.HttpRequest) -> func.HttpResponse: - logging.info("Python HTTP trigger function processed a request.") - - from code.backend.batch.utilities.helpers.OrchestratorHelper import Orchestrator - - message_orchestrator = Orchestrator() - - try: - req_body = req.get_json() - user_message = req_body["messages"][-1]["content"] - conversation_id = req_body["conversation_id"] - user_assistant_messages = list( - filter( - lambda x: x["role"] in ("user", "assistant"), req_body["messages"][0:-1] - ) - ) - chat_history = [] - for i, k in enumerate(user_assistant_messages): - if i % 2 == 0: - chat_history.append( - ( - user_assistant_messages[i]["content"], - user_assistant_messages[i + 1]["content"], - ) - ) - from code.backend.batch.utilities.helpers.ConfigHelper import ConfigHelper - - messages = message_orchestrator.handle_message( - user_message=user_message, - chat_history=chat_history, - conversation_id=conversation_id, - orchestrator=ConfigHelper.get_active_config_or_default().orchestrator, - ) - - response_obj = { - "id": "response.id", - "model": os.getenv("AZURE_OPENAI_MODEL"), - "created": "response.created", - "object": "response.object", - "choices": [{"messages": messages}], - } - - return func.HttpResponse(json.dumps(response_obj), status_code=200) - - except Exception as e: - logging.exception("Exception in /api/conversation/custom") - return func.HttpResponse(json.dumps({"error": str(e)}), status_code=500) diff --git a/extensions/backend/http_cwyod/function.json b/extensions/backend/http_cwyod/function.json deleted file mode 100644 index 62d996d06..000000000 --- a/extensions/backend/http_cwyod/function.json +++ /dev/null @@ -1,20 +0,0 @@ -{ - "scriptFile": "__init__.py", - "bindings": [ - { - "authLevel": "Anonymous", - "type": "httpTrigger", - "direction": "in", - "name": "req", - "methods": [ - "get", - "post" - ] - }, - { - "type": "http", - "direction": "out", - "name": "$return" - } - ] -} \ No newline at end of file diff --git a/extensions/backend/http_cwyod/host.json b/extensions/backend/http_cwyod/host.json deleted file mode 100644 index 55d16424d..000000000 --- a/extensions/backend/http_cwyod/host.json +++ /dev/null @@ -1,7 +0,0 @@ -{ - "version": "2.0", - "extensionBundle": { - "id": "Microsoft.Azure.Functions.ExtensionBundle", - "version": "[4.*, 5.0.0)" - } -} \ No newline at end of file diff --git a/extensions/backend/requirements.txt b/extensions/backend/requirements.txt deleted file mode 100644 index 550f8beeb..000000000 --- a/extensions/backend/requirements.txt +++ /dev/null @@ -1,27 +0,0 @@ -# DO NOT include azure-functions-worker in this file -# The Python Worker is managed by Azure Functions platform -# Manually managing azure-functions-worker may cause unexpected issues - -azure-functions -streamlit==1.30.0 -openai==1.6.1 -scipy==1.12.0 -transformers==4.38.1 -python-dotenv==1.0.1 -azure-ai-formrecognizer==3.3.2 -azure-storage-blob==12.19.0 -azure-identity==1.15.0 -azure-ai-contentsafety==1.0.0 -requests==2.31.0 -tiktoken==0.6.0 -azure-storage-queue==12.9.0 -langchain==0.1.9 -langchain-community==0.0.24 -beautifulsoup4==4.12.3 -fake-useragent==1.4.0 -chardet==5.2.0 ---extra-index-url https://pkgs.dev.azure.com/azure-sdk/public/_packaging/azure-sdk-for-python/pypi/simple/ -azure-search-documents==11.4.0 -opencensus-ext-azure==1.1.13 -pandas==2.2.1 -python-docx==1.1.0 diff --git a/extensions/docker/Backend.Dockerfile b/extensions/docker/Backend.Dockerfile deleted file mode 100644 index 3c0446626..000000000 --- a/extensions/docker/Backend.Dockerfile +++ /dev/null @@ -1,12 +0,0 @@ -# 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.11-appservice -FROM mcr.microsoft.com/azure-functions/python:4-python3.11 - -ENV AzureWebJobsScriptRoot=/home/site/wwwroot \ - AzureFunctionsJobHost__Logging__Console__IsEnabled=true - -COPY ./extensions/backend/requirements.txt / -RUN pip install -r /requirements.txt - -COPY ./extensions/backend /home/site/wwwroot -COPY ./code/backend/batch/utilities /home/site/wwwroot/utilities \ No newline at end of file diff --git a/extensions/docker/Backend.dockerignore b/extensions/docker/Backend.dockerignore deleted file mode 100644 index a63194946..000000000 --- a/extensions/docker/Backend.dockerignore +++ /dev/null @@ -1,22 +0,0 @@ -__pycache__ -.venv -.env -.github -frontend/node_modules -admin -backend/AddURLEmbeddings -backend/BatchPushResults -backend/BatchStartProcessing -backend/images -backend/pages -backend/.frontend -backend/.github -backend/Admin.py -backend/host.json -backend/local.settings.json -backend/requirements.txt -docker -infrastructure -.gitignore -extra -data \ No newline at end of file diff --git a/extensions/infrastructure/main.bicep b/extensions/infrastructure/main.bicep deleted file mode 100644 index a6ad89062..000000000 --- a/extensions/infrastructure/main.bicep +++ /dev/null @@ -1,217 +0,0 @@ -@description('provide a 2-13 character prefix for all resources.') -param ResourcePrefix string - -@description('The name of the Azure Function app.') -param functionAppName string = '${ResourcePrefix}-func-backend' - -@description('Location for all resources.') -param location string = resourceGroup().location - -@description('Name of App Service plan') -param HostingPlanName string = '${ResourcePrefix}-hosting-plan' - -@description('The pricing tier for the App Service plan') -@allowed([ - 'F1' - 'D1' - 'B1' - 'B2' - 'B3' - 'S1' - 'S2' - 'S3' - 'P1' - 'P2' - 'P3' - 'P4' -]) -param HostingPlanSku string = 'B3' - -@description('Application Insights Connection String - Created during the "Chat with your data" Solution Accelerator') -@secure() -param AppInsightsConnectionString string - -@description('Azure AI Search Resource - Created during the "Chat with your data" Solution Accelerator') -param AzureSearchName string - -@description('Azure AI Search Index - Created during the "Chat with your data" Solution Accelerator') -param AzureSearchIndex string - -@description('Azure AI Search Conversation Log Index - Created during the "Chat with your data" Solution Accelerator') -param AzureSearchConversationLogIndex string = 'conversations' - -@description('Azure AI Search Key - Created during the "Chat with your data" Solution Accelerator') -@secure() -param AzureSearchKey string - -@description('Semantic search config - Created during the "Chat with your data" Solution Accelerator') -param AzureSearchSemanticSearchConfig string = 'default' - -@description('Is the index prechunked - Created during the "Chat with your data" Solution Accelerator') -param AzureSearchIndexIsPrechunked string = 'false' - -@description('Top K results - Created during the "Chat with your data" Solution Accelerator') -param AzureSearchTopK string = '5' - -@description('Enable in domain - Created during the "Chat with your data" Solution Accelerator') -param AzureSearchEnableInDomain string = 'false' - -@description('Content columns - Created during the "Chat with your data" Solution Accelerator') -param AzureSearchContentColumns string = 'content' - -@description('Filename column - Created during the "Chat with your data" Solution Accelerator') -param AzureSearchFilenameColumn string = 'filename' - -@description('Title column - Created during the "Chat with your data" Solution Accelerator') -param AzureSearchTitleColumn string = 'title' - -@description('Url column - Created during the "Chat with your data" Solution Accelerator') -param AzureSearchUrlColumn string = 'url' - -@description('Name of Azure OpenAI Resource - Created during the "Chat with your data" Solution Accelerator') -param AzureOpenAIResource string - -@description('Azure OpenAI Model Deployment Name - Created during the "Chat with your data" Solution Accelerator') -param AzureOpenAIModel string = 'gpt-35-turbo' - -@description('Azure OpenAI Model Name - Created during the "Chat with your data" Solution Accelerator') -param AzureOpenAIModelName string = 'gpt-35-turbo' - -@description('Azure OpenAI Key - Created during the "Chat with your data" Solution Accelerator') -@secure() -param AzureOpenAIKey string - -@description('Orchestration strategy: openai_function or langchain str. If you use a old version of turbo (0301), plese select langchain - Created during the "Chat with your data" Solution Accelerator') -@allowed([ - 'openai_function' - 'langchain' -]) -param OrchestrationStrategy string - -@description('Azure OpenAI Temperature - Created during the "Chat with your data" Solution Accelerator') -param AzureOpenAITemperature string = '0' - -@description('Azure OpenAI Top P - Created during the "Chat with your data" Solution Accelerator') -param AzureOpenAITopP string = '1' - -@description('Azure OpenAI Max Tokens - Created during the "Chat with your data" Solution Accelerator') -param AzureOpenAIMaxTokens string = '1000' - -@description('Azure OpenAI Stop Sequence - Created during the "Chat with your data" Solution Accelerator') -param AzureOpenAIStopSequence string = '\n' - -@description('Azure OpenAI System Message - Created during the "Chat with your data" Solution Accelerator') -param AzureOpenAISystemMessage string = 'You are an AI assistant that helps people find information.' - -@description('Azure OpenAI Api Version - Created during the "Chat with your data" Solution Accelerator') -param AzureOpenAIApiVersion string = '2023-12-01-preview' - -@description('Whether or not to stream responses from Azure OpenAI - Created during the "Chat with your data" Solution Accelerator') -param AzureOpenAIStream string = 'true' - -@description('Azure OpenAI Embedding Model - Created during the "Chat with your data" Solution Accelerator') -param AzureOpenAIEmbeddingModel string = 'text-embedding-ada-002' - -@description('Azure Form Recognizer Endpoint - Created during the "Chat with your data" Solution Accelerator') -param AzureFormRecognizerEndpoint string - -@description('Azure Form Recognizer Key - Created during the "Chat with your data" Solution Accelerator') -@secure() -param AzureFormRecognizerKey string - -@description('Storage Account Name - Created during the "Chat with your data" Solution Accelerator') -param AzureBlobAccountName string - -@description('Storage Account Key - Created during the "Chat with your data" Solution Accelerator') -@secure() -param AzureBlobAccountKey string - -@description('Storage Account Container Name - Created during the "Chat with your data" Solution Accelerator') -param AzureBlobContainerName string - -var BackendImageName = 'DOCKER|fruoccopublic.azurecr.io/rag-backend' - -resource HostingPlan 'Microsoft.Web/serverfarms@2020-06-01' = { - name: HostingPlanName - location: location - sku: { - name: HostingPlanSku - } - properties: { - reserved: true - } - kind: 'linux' -} - -resource Function 'Microsoft.Web/sites@2018-11-01' = { - name: functionAppName - kind: 'functionapp,linux' - location: location - tags: {} - properties: { - siteConfig: { - appSettings: [ - { name: 'FUNCTIONS_EXTENSION_VERSION', value: '~4' } - { name: 'WEBSITES_ENABLE_APP_SERVICE_STORAGE', value: 'false' } - { name: 'APPINSIGHTS_CONNECTION_STRING', value: AppInsightsConnectionString } - { name: 'AZURE_SEARCH_SERVICE', value: 'https://${AzureSearchName}.search.windows.net' } - { name: 'AZURE_SEARCH_INDEX', value: AzureSearchIndex } - { name: 'AZURE_SEARCH_CONVERSATIONS_LOG_INDEX', value: AzureSearchConversationLogIndex } - { name: 'AZURE_SEARCH_KEY', value: AzureSearchKey } - { name: 'AZURE_SEARCH_SEMANTIC_SEARCH_CONFIG', value: AzureSearchSemanticSearchConfig } - { name: 'AZURE_SEARCH_INDEX_IS_PRECHUNKED', value: AzureSearchIndexIsPrechunked } - { name: 'AZURE_SEARCH_TOP_K', value: AzureSearchTopK } - { name: 'AZURE_SEARCH_ENABLE_IN_DOMAIN', value: AzureSearchEnableInDomain } - { name: 'AZURE_SEARCH_CONTENT_COLUMNS', value: AzureSearchContentColumns } - { name: 'AZURE_SEARCH_FILENAME_COLUMN', value: AzureSearchFilenameColumn } - { name: 'AZURE_SEARCH_TITLE_COLUMN', value: AzureSearchTitleColumn } - { name: 'AZURE_SEARCH_URL_COLUMN', value: AzureSearchUrlColumn } - { name: 'AZURE_OPENAI_RESOURCE', value: AzureOpenAIResource } - { name: 'AZURE_OPENAI_KEY', value: AzureOpenAIKey } - { name: 'AZURE_OPENAI_MODEL', value: AzureOpenAIModel } - { name: 'AZURE_OPENAI_MODEL_NAME', value: AzureOpenAIModelName } - { name: 'AZURE_OPENAI_TEMPERATURE', value: AzureOpenAITemperature } - { name: 'AZURE_OPENAI_TOP_P', value: AzureOpenAITopP } - { name: 'AZURE_OPENAI_MAX_TOKENS', value: AzureOpenAIMaxTokens } - { name: 'AZURE_OPENAI_STOP_SEQUENCE', value: AzureOpenAIStopSequence } - { name: 'AZURE_OPENAI_SYSTEM_MESSAGE', value: AzureOpenAISystemMessage } - { name: 'AZURE_OPENAI_API_VERSION', value: AzureOpenAIApiVersion } - { name: 'AZURE_OPENAI_STREAM', value: AzureOpenAIStream } - { name: 'AZURE_OPENAI_EMBEDDING_MODEL', value: AzureOpenAIEmbeddingModel } - { name: 'AZURE_FORM_RECOGNIZER_ENDPOINT', value: AzureFormRecognizerEndpoint } - { name: 'AZURE_FORM_RECOGNIZER_KEY', value: AzureFormRecognizerKey } - { name: 'AZURE_BLOB_ACCOUNT_NAME', value: AzureBlobAccountName } - { name: 'AZURE_BLOB_ACCOUNT_KEY', value: AzureBlobAccountKey } - { name: 'AZURE_BLOB_CONTAINER_NAME', value: AzureBlobContainerName } - { name: 'ORCHESTRATION_STRATEGY', value: OrchestrationStrategy } - ] - cors: { - allowedOrigins: [ - 'https://portal.azure.com' - ] - } - use32BitWorkerProcess: false - linuxFxVersion: BackendImageName - appCommandLine: '' - alwaysOn: true - } - serverFarmId: HostingPlan.id - clientAffinityEnabled: false - httpsOnly: true - } -} - -resource WaitFunctionDeploymentSection 'Microsoft.Resources/deploymentScripts@2020-10-01' = { - kind: 'AzurePowerShell' - name: 'WaitFunctionDeploymentSection' - location: location - properties: { - azPowerShellVersion: '3.0' - scriptContent: 'start-sleep -Seconds 300' - cleanupPreference: 'Always' - retentionInterval: 'PT1H' - } - dependsOn: [ - Function - ] -} diff --git a/extensions/infrastructure/main.json b/extensions/infrastructure/main.json deleted file mode 100644 index 20077c138..000000000 --- a/extensions/infrastructure/main.json +++ /dev/null @@ -1,465 +0,0 @@ -{ - "$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#", - "contentVersion": "1.0.0.0", - "metadata": { - "_generator": { - "name": "bicep", - "version": "0.25.53.49325", - "templateHash": "18181665283535379791" - } - }, - "parameters": { - "ResourcePrefix": { - "type": "string", - "metadata": { - "description": "provide a 2-13 character prefix for all resources." - } - }, - "functionAppName": { - "type": "string", - "defaultValue": "[format('{0}-func-backend', parameters('ResourcePrefix'))]", - "metadata": { - "description": "The name of the Azure Function app." - } - }, - "location": { - "type": "string", - "defaultValue": "[resourceGroup().location]", - "metadata": { - "description": "Location for all resources." - } - }, - "HostingPlanName": { - "type": "string", - "defaultValue": "[format('{0}-hosting-plan', parameters('ResourcePrefix'))]", - "metadata": { - "description": "Name of App Service plan" - } - }, - "HostingPlanSku": { - "type": "string", - "defaultValue": "B3", - "allowedValues": [ - "F1", - "D1", - "B1", - "B2", - "B3", - "S1", - "S2", - "S3", - "P1", - "P2", - "P3", - "P4" - ], - "metadata": { - "description": "The pricing tier for the App Service plan" - } - }, - "AppInsightsConnectionString": { - "type": "securestring", - "metadata": { - "description": "Application Insights Connection String - Created during the \"Chat with your data\" Solution Accelerator" - } - }, - "AzureSearchName": { - "type": "string", - "metadata": { - "description": "Azure AI Search Resource - Created during the \"Chat with your data\" Solution Accelerator" - } - }, - "AzureSearchIndex": { - "type": "string", - "metadata": { - "description": "Azure AI Search Index - Created during the \"Chat with your data\" Solution Accelerator" - } - }, - "AzureSearchConversationLogIndex": { - "type": "string", - "defaultValue": "conversations", - "metadata": { - "description": "Azure AI Search Conversation Log Index - Created during the \"Chat with your data\" Solution Accelerator" - } - }, - "AzureSearchKey": { - "type": "securestring", - "metadata": { - "description": "Azure AI Search Key - Created during the \"Chat with your data\" Solution Accelerator" - } - }, - "AzureSearchSemanticSearchConfig": { - "type": "string", - "defaultValue": "default", - "metadata": { - "description": "Semantic search config - Created during the \"Chat with your data\" Solution Accelerator" - } - }, - "AzureSearchIndexIsPrechunked": { - "type": "string", - "defaultValue": "false", - "metadata": { - "description": "Is the index prechunked - Created during the \"Chat with your data\" Solution Accelerator" - } - }, - "AzureSearchTopK": { - "type": "string", - "defaultValue": "5", - "metadata": { - "description": "Top K results - Created during the \"Chat with your data\" Solution Accelerator" - } - }, - "AzureSearchEnableInDomain": { - "type": "string", - "defaultValue": "false", - "metadata": { - "description": "Enable in domain - Created during the \"Chat with your data\" Solution Accelerator" - } - }, - "AzureSearchContentColumns": { - "type": "string", - "defaultValue": "content", - "metadata": { - "description": "Content columns - Created during the \"Chat with your data\" Solution Accelerator" - } - }, - "AzureSearchFilenameColumn": { - "type": "string", - "defaultValue": "filename", - "metadata": { - "description": "Filename column - Created during the \"Chat with your data\" Solution Accelerator" - } - }, - "AzureSearchTitleColumn": { - "type": "string", - "defaultValue": "title", - "metadata": { - "description": "Title column - Created during the \"Chat with your data\" Solution Accelerator" - } - }, - "AzureSearchUrlColumn": { - "type": "string", - "defaultValue": "url", - "metadata": { - "description": "Url column - Created during the \"Chat with your data\" Solution Accelerator" - } - }, - "AzureOpenAIResource": { - "type": "string", - "metadata": { - "description": "Name of Azure OpenAI Resource - Created during the \"Chat with your data\" Solution Accelerator" - } - }, - "AzureOpenAIModel": { - "type": "string", - "defaultValue": "gpt-35-turbo", - "metadata": { - "description": "Azure OpenAI Model Deployment Name - Created during the \"Chat with your data\" Solution Accelerator" - } - }, - "AzureOpenAIModelName": { - "type": "string", - "defaultValue": "gpt-35-turbo", - "metadata": { - "description": "Azure OpenAI Model Name - Created during the \"Chat with your data\" Solution Accelerator" - } - }, - "AzureOpenAIKey": { - "type": "securestring", - "metadata": { - "description": "Azure OpenAI Key - Created during the \"Chat with your data\" Solution Accelerator" - } - }, - "OrchestrationStrategy": { - "type": "string", - "allowedValues": [ - "openai_function", - "langchain" - ], - "metadata": { - "description": "Orchestration strategy: openai_function or langchain str. If you use a old version of turbo (0301), plese select langchain - Created during the \"Chat with your data\" Solution Accelerator" - } - }, - "AzureOpenAITemperature": { - "type": "string", - "defaultValue": "0", - "metadata": { - "description": "Azure OpenAI Temperature - Created during the \"Chat with your data\" Solution Accelerator" - } - }, - "AzureOpenAITopP": { - "type": "string", - "defaultValue": "1", - "metadata": { - "description": "Azure OpenAI Top P - Created during the \"Chat with your data\" Solution Accelerator" - } - }, - "AzureOpenAIMaxTokens": { - "type": "string", - "defaultValue": "1000", - "metadata": { - "description": "Azure OpenAI Max Tokens - Created during the \"Chat with your data\" Solution Accelerator" - } - }, - "AzureOpenAIStopSequence": { - "type": "string", - "defaultValue": "\n", - "metadata": { - "description": "Azure OpenAI Stop Sequence - Created during the \"Chat with your data\" Solution Accelerator" - } - }, - "AzureOpenAISystemMessage": { - "type": "string", - "defaultValue": "You are an AI assistant that helps people find information.", - "metadata": { - "description": "Azure OpenAI System Message - Created during the \"Chat with your data\" Solution Accelerator" - } - }, - "AzureOpenAIApiVersion": { - "type": "string", - "defaultValue": "2023-12-01-preview", - "metadata": { - "description": "Azure OpenAI Api Version - Created during the \"Chat with your data\" Solution Accelerator" - } - }, - "AzureOpenAIStream": { - "type": "string", - "defaultValue": "true", - "metadata": { - "description": "Whether or not to stream responses from Azure OpenAI - Created during the \"Chat with your data\" Solution Accelerator" - } - }, - "AzureOpenAIEmbeddingModel": { - "type": "string", - "defaultValue": "text-embedding-ada-002", - "metadata": { - "description": "Azure OpenAI Embedding Model - Created during the \"Chat with your data\" Solution Accelerator" - } - }, - "AzureFormRecognizerEndpoint": { - "type": "string", - "metadata": { - "description": "Azure Form Recognizer Endpoint - Created during the \"Chat with your data\" Solution Accelerator" - } - }, - "AzureFormRecognizerKey": { - "type": "securestring", - "metadata": { - "description": "Azure Form Recognizer Key - Created during the \"Chat with your data\" Solution Accelerator" - } - }, - "AzureBlobAccountName": { - "type": "string", - "metadata": { - "description": "Storage Account Name - Created during the \"Chat with your data\" Solution Accelerator" - } - }, - "AzureBlobAccountKey": { - "type": "securestring", - "metadata": { - "description": "Storage Account Key - Created during the \"Chat with your data\" Solution Accelerator" - } - }, - "AzureBlobContainerName": { - "type": "string", - "metadata": { - "description": "Storage Account Container Name - Created during the \"Chat with your data\" Solution Accelerator" - } - } - }, - "variables": { - "BackendImageName": "DOCKER|fruoccopublic.azurecr.io/rag-backend" - }, - "resources": [ - { - "type": "Microsoft.Web/serverfarms", - "apiVersion": "2020-06-01", - "name": "[parameters('HostingPlanName')]", - "location": "[parameters('location')]", - "sku": { - "name": "[parameters('HostingPlanSku')]" - }, - "properties": { - "reserved": true - }, - "kind": "linux" - }, - { - "type": "Microsoft.Web/sites", - "apiVersion": "2018-11-01", - "name": "[parameters('functionAppName')]", - "kind": "functionapp,linux", - "location": "[parameters('location')]", - "tags": {}, - "properties": { - "siteConfig": { - "appSettings": [ - { - "name": "FUNCTIONS_EXTENSION_VERSION", - "value": "~4" - }, - { - "name": "WEBSITES_ENABLE_APP_SERVICE_STORAGE", - "value": "false" - }, - { - "name": "APPINSIGHTS_CONNECTION_STRING", - "value": "[parameters('AppInsightsConnectionString')]" - }, - { - "name": "AZURE_SEARCH_SERVICE", - "value": "[format('https://{0}.search.windows.net', parameters('AzureSearchName'))]" - }, - { - "name": "AZURE_SEARCH_INDEX", - "value": "[parameters('AzureSearchIndex')]" - }, - { - "name": "AZURE_SEARCH_CONVERSATIONS_LOG_INDEX", - "value": "[parameters('AzureSearchConversationLogIndex')]" - }, - { - "name": "AZURE_SEARCH_KEY", - "value": "[parameters('AzureSearchKey')]" - }, - { - "name": "AZURE_SEARCH_SEMANTIC_SEARCH_CONFIG", - "value": "[parameters('AzureSearchSemanticSearchConfig')]" - }, - { - "name": "AZURE_SEARCH_INDEX_IS_PRECHUNKED", - "value": "[parameters('AzureSearchIndexIsPrechunked')]" - }, - { - "name": "AZURE_SEARCH_TOP_K", - "value": "[parameters('AzureSearchTopK')]" - }, - { - "name": "AZURE_SEARCH_ENABLE_IN_DOMAIN", - "value": "[parameters('AzureSearchEnableInDomain')]" - }, - { - "name": "AZURE_SEARCH_CONTENT_COLUMNS", - "value": "[parameters('AzureSearchContentColumns')]" - }, - { - "name": "AZURE_SEARCH_FILENAME_COLUMN", - "value": "[parameters('AzureSearchFilenameColumn')]" - }, - { - "name": "AZURE_SEARCH_TITLE_COLUMN", - "value": "[parameters('AzureSearchTitleColumn')]" - }, - { - "name": "AZURE_SEARCH_URL_COLUMN", - "value": "[parameters('AzureSearchUrlColumn')]" - }, - { - "name": "AZURE_OPENAI_RESOURCE", - "value": "[parameters('AzureOpenAIResource')]" - }, - { - "name": "AZURE_OPENAI_KEY", - "value": "[parameters('AzureOpenAIKey')]" - }, - { - "name": "AZURE_OPENAI_MODEL", - "value": "[parameters('AzureOpenAIModel')]" - }, - { - "name": "AZURE_OPENAI_MODEL_NAME", - "value": "[parameters('AzureOpenAIModelName')]" - }, - { - "name": "AZURE_OPENAI_TEMPERATURE", - "value": "[parameters('AzureOpenAITemperature')]" - }, - { - "name": "AZURE_OPENAI_TOP_P", - "value": "[parameters('AzureOpenAITopP')]" - }, - { - "name": "AZURE_OPENAI_MAX_TOKENS", - "value": "[parameters('AzureOpenAIMaxTokens')]" - }, - { - "name": "AZURE_OPENAI_STOP_SEQUENCE", - "value": "[parameters('AzureOpenAIStopSequence')]" - }, - { - "name": "AZURE_OPENAI_SYSTEM_MESSAGE", - "value": "[parameters('AzureOpenAISystemMessage')]" - }, - { - "name": "AZURE_OPENAI_API_VERSION", - "value": "[parameters('AzureOpenAIApiVersion')]" - }, - { - "name": "AZURE_OPENAI_STREAM", - "value": "[parameters('AzureOpenAIStream')]" - }, - { - "name": "AZURE_OPENAI_EMBEDDING_MODEL", - "value": "[parameters('AzureOpenAIEmbeddingModel')]" - }, - { - "name": "AZURE_FORM_RECOGNIZER_ENDPOINT", - "value": "[parameters('AzureFormRecognizerEndpoint')]" - }, - { - "name": "AZURE_FORM_RECOGNIZER_KEY", - "value": "[parameters('AzureFormRecognizerKey')]" - }, - { - "name": "AZURE_BLOB_ACCOUNT_NAME", - "value": "[parameters('AzureBlobAccountName')]" - }, - { - "name": "AZURE_BLOB_ACCOUNT_KEY", - "value": "[parameters('AzureBlobAccountKey')]" - }, - { - "name": "AZURE_BLOB_CONTAINER_NAME", - "value": "[parameters('AzureBlobContainerName')]" - }, - { - "name": "ORCHESTRATION_STRATEGY", - "value": "[parameters('OrchestrationStrategy')]" - } - ], - "cors": { - "allowedOrigins": [ - "https://portal.azure.com" - ] - }, - "use32BitWorkerProcess": false, - "linuxFxVersion": "[variables('BackendImageName')]", - "appCommandLine": "", - "alwaysOn": true - }, - "serverFarmId": "[resourceId('Microsoft.Web/serverfarms', parameters('HostingPlanName'))]", - "clientAffinityEnabled": false, - "httpsOnly": true - }, - "dependsOn": [ - "[resourceId('Microsoft.Web/serverfarms', parameters('HostingPlanName'))]" - ] - }, - { - "type": "Microsoft.Resources/deploymentScripts", - "apiVersion": "2020-10-01", - "name": "WaitFunctionDeploymentSection", - "kind": "AzurePowerShell", - "location": "[parameters('location')]", - "properties": { - "azPowerShellVersion": "3.0", - "scriptContent": "start-sleep -Seconds 300", - "cleanupPreference": "Always", - "retentionInterval": "PT1H" - }, - "dependsOn": [ - "[resourceId('Microsoft.Web/sites', parameters('functionAppName'))]" - ] - } - ] -} \ No newline at end of file diff --git a/infra/main.bicep b/infra/main.bicep index 9f921ab19..00cbc0dc3 100644 --- a/infra/main.bicep +++ b/infra/main.bicep @@ -486,6 +486,7 @@ module function './app/function.bicep' = { ORCHESTRATION_STRATEGY: orchestrationStrategy AZURE_CONTENT_SAFETY_ENDPOINT: 'https://${location}.api.cognitive.microsoft.com/' APPINSIGHTS_INSTRUMENTATIONKEY: monitoring.outputs.applicationInsightsInstrumentationKey + APPINSIGHTS_CONNECTION_STRING: monitoring.outputs.applicationInsightsConnectionString } } } diff --git a/infra/main.json b/infra/main.json index 4c8317b01..7fcb680f9 100644 --- a/infra/main.json +++ b/infra/main.json @@ -5,7 +5,7 @@ "_generator": { "name": "bicep", "version": "0.25.53.49325", - "templateHash": "15449005561945929215" + "templateHash": "11044000718103660256" } }, "parameters": { @@ -4134,7 +4134,8 @@ "AZURE_SEARCH_INDEX": "[parameters('azureSearchIndex')]", "ORCHESTRATION_STRATEGY": "[parameters('orchestrationStrategy')]", "AZURE_CONTENT_SAFETY_ENDPOINT": "[format('https://{0}.api.cognitive.microsoft.com/', parameters('location'))]", - "APPINSIGHTS_INSTRUMENTATIONKEY": "[reference(extensionResourceId(format('/subscriptions/{0}/resourceGroups/{1}', subscription().subscriptionId, variables('rgName')), 'Microsoft.Resources/deployments', 'monitoring'), '2022-09-01').outputs.applicationInsightsInstrumentationKey.value]" + "APPINSIGHTS_INSTRUMENTATIONKEY": "[reference(extensionResourceId(format('/subscriptions/{0}/resourceGroups/{1}', subscription().subscriptionId, variables('rgName')), 'Microsoft.Resources/deployments', 'monitoring'), '2022-09-01').outputs.applicationInsightsInstrumentationKey.value]", + "APPINSIGHTS_CONNECTION_STRING": "[reference(extensionResourceId(format('/subscriptions/{0}/resourceGroups/{1}', subscription().subscriptionId, variables('rgName')), 'Microsoft.Resources/deployments', 'monitoring'), '2022-09-01').outputs.applicationInsightsConnectionString.value]" } } },