From e8a113f4fc821dcaf315172425f8eee8b042c714 Mon Sep 17 00:00:00 2001 From: Prasanjeet-Microsoft Date: Fri, 8 Aug 2025 15:55:08 +0530 Subject: [PATCH] Added required env variables for local debugging in .env generated by azd up --- .github/workflows/CAdeploy.yml | 8 +- docs/LocalSetupAndDeploy.md | 5 +- infra/deploy_ai_foundry.bicep | 1 + infra/deploy_app_service.bicep | 3 +- infra/main.bicep | 123 +++++++++--- infra/main.json | 274 ++++++++++++++++++++++++--- infra/scripts/process_sample_data.sh | 2 +- 7 files changed, 357 insertions(+), 59 deletions(-) diff --git a/.github/workflows/CAdeploy.yml b/.github/workflows/CAdeploy.yml index 73806dbbc..786865dff 100644 --- a/.github/workflows/CAdeploy.yml +++ b/.github/workflows/CAdeploy.yml @@ -172,8 +172,8 @@ jobs: echo "STORAGE_CONTAINER=$STORAGE_CONTAINER" >> $GITHUB_ENV export KEYVAULT_NAME=$(echo "$DEPLOY_OUTPUT" | jq -r '.keY_VAULT_NAME.value') echo "KEYVAULT_NAME=$KEYVAULT_NAME" >> $GITHUB_ENV - export SQL_SERVER=$(echo "$DEPLOY_OUTPUT" | jq -r '.sqldB_SERVER.value') - echo "SQL_SERVER=$SQL_SERVER" >> $GITHUB_ENV + export SQL_SERVER_NAME=$(echo "$DEPLOY_OUTPUT" | jq -r '.sqldB_SERVER_NAME.value') + echo "SQL_SERVER_NAME=$SQL_SERVER_NAME" >> $GITHUB_ENV export SQL_DATABASE=$(echo "$DEPLOY_OUTPUT" | jq -r '.sqldB_DATABASE.value') echo "SQL_DATABASE=$SQL_DATABASE" >> $GITHUB_ENV export CLIENT_ID=$(echo "$DEPLOY_OUTPUT" | jq -r '.managedidentitY_WEBAPP_CLIENTID.value') @@ -220,7 +220,7 @@ jobs: "" \ "${{ secrets.AZURE_CLIENT_ID }}" \ "${{ env.RG_NAME }}" \ - "${{ env.SQL_SERVER }}" \ + "${{ env.SQL_SERVER_NAME }}" \ "${{ env.AI_FOUNDARY_NAME }}" \ "${{ env.SEARCH_SERVICE_NAME }}" \ "${{ env.RESOURCE_GROUP_NAME_FOUNDRY }}" @@ -232,7 +232,7 @@ jobs: ]' bash ./infra/scripts/add_user_scripts/create_sql_user_and_role.sh \ - "${{ env.SQL_SERVER }}.database.windows.net" \ + "${{ env.SQL_SERVER_NAME }}.database.windows.net" \ "${{ env.SQL_DATABASE }}" \ "$user_roles_json" \ "${{ secrets.AZURE_CLIENT_ID }}" diff --git a/docs/LocalSetupAndDeploy.md b/docs/LocalSetupAndDeploy.md index 6b7547e3e..7c2e92b87 100644 --- a/docs/LocalSetupAndDeploy.md +++ b/docs/LocalSetupAndDeploy.md @@ -13,7 +13,10 @@ Navigate to the `App` folder located in the `src` directory of the repository us ### 2. Configure Environment Variables - Copy the `.env.sample` file to a new file named `.env`. -- Update the `.env` file with the required values from your Azure resource group. +- Update the `.env` file with the required values from your Azure resource group in Azure Portal App Service environment variables. +- Alternatively, if resources were +provisioned using `azd provision` or `azd up`, a `.env` file is automatically generated in the `.azure//.env` +file. To get your `` run `azd env list` to see which env is default. ### 3. Start the Application - Run `start.cmd` (Windows) or `start.sh` (Linux/Mac) to: diff --git a/infra/deploy_ai_foundry.bicep b/infra/deploy_ai_foundry.bicep index 057c13e1c..a8baef153 100644 --- a/infra/deploy_ai_foundry.bicep +++ b/infra/deploy_ai_foundry.bicep @@ -385,6 +385,7 @@ output aiSearchService string = aiSearch.name output aiFoundryProjectName string = !empty(existingAIProjectName) ? existingAIProjectName : aiFoundryProject.name output applicationInsightsId string = applicationInsights.id +output instrumentationKey string = applicationInsights.properties.InstrumentationKey output logAnalyticsWorkspaceResourceName string = useExisting ? existingLogAnalyticsWorkspace.name : logAnalytics.name output logAnalyticsWorkspaceResourceGroup string = useExisting ? existingLawResourceGroup : resourceGroup().name diff --git a/infra/deploy_app_service.bicep b/infra/deploy_app_service.bicep index e0b1f97d5..17116fde7 100644 --- a/infra/deploy_app_service.bicep +++ b/infra/deploy_app_service.bicep @@ -10,6 +10,7 @@ param HostingPlanSku string = 'B2' param HostingPlanName string param WebsiteName string +param AppEnvironment string // @description('Name of Application Insights') // param ApplicationInsightsName string = '${ solutionName }-app-insights' @@ -187,7 +188,7 @@ resource Website 'Microsoft.Web/sites@2020-06-01' = { appSettings: [ { name: 'APP_ENV' - value: 'Prod' + value: AppEnvironment } { name: 'APPINSIGHTS_INSTRUMENTATIONKEY' diff --git a/infra/main.bicep b/infra/main.bicep index 705259f56..e6ba33798 100644 --- a/infra/main.bicep +++ b/infra/main.bicep @@ -51,6 +51,7 @@ param embeddingDeploymentCapacity int = 80 // @description('Fabric Workspace Id if you have one, else leave it empty. ') // param fabricWorkspaceId string +@description('The Docker image tag to use for the application deployment.') param imageTag string = 'latest' //restricting to these regions because assistants api for gpt-4o-mini is available only in these regions @@ -84,6 +85,34 @@ var abbrs = loadJsonContent('./abbreviations.json') //var solutionLocation = resourceGroupLocation // var baseUrl = 'https://raw.githubusercontent.com/microsoft/Build-your-own-copilot-Solution-Accelerator/main/' +var hostingPlanName = '${abbrs.compute.appServicePlan}${solutionPrefix}' +var websiteName = '${abbrs.compute.webApp}${solutionPrefix}' +var appEnvironment = 'Prod' +var azureSearchIndex = 'transcripts_index' +var azureSearchUseSemanticSearch = 'True' +var azureSearchSemanticSearchConfig = 'my-semantic-config' +var azureSearchTopK = '5' +var azureSearchContentColumns = 'content' +var azureSearchFilenameColumn = 'chunk_id' +var azureSearchTitleColumn = 'client_id' +var azureSearchUrlColumn = 'sourceurl' +var azureOpenAITemperature = '0' +var azureOpenAITopP = '1' +var azureOpenAIMaxTokens = '1000' +var azureOpenAIStopSequence = '\n' +var azureOpenAISystemMessage = '''You are a helpful Wealth Advisor assistant''' +var azureOpenAIStream = 'True' +var azureSearchQueryType = 'simple' +var azureSearchVectorFields = 'contentVector' +var azureSearchPermittedGroupsField = '' +var azureSearchStrictness = '3' +var azureSearchEnableInDomain = 'False' // Set to 'True' if you want to enable in-domain search +var azureCosmosDbEnableFeedback = 'True' +var useInternalStream = 'True' +var useAIProjectClientFlag = 'False' +var sqlServerFqdn = '${sqlDBModule.outputs.sqlServerName}.database.windows.net' + + var functionAppSqlPrompt = '''Generate a valid T-SQL query to find {query} for tables and columns provided below: 1. Table: Clients Columns: ClientId, Client, Email, Occupation, MaritalStatus, Dependents @@ -219,40 +248,41 @@ module appserviceModule 'deploy_app_service.bicep' = { name: 'deploy_app_service' params: { solutionLocation: solutionLocation - HostingPlanName: '${abbrs.compute.appServicePlan}${solutionPrefix}' - WebsiteName: '${abbrs.compute.webApp}${solutionPrefix}' + HostingPlanName: hostingPlanName + WebsiteName: websiteName + AppEnvironment: appEnvironment AzureSearchService: aifoundry.outputs.aiSearchService - AzureSearchIndex: 'transcripts_index' - AzureSearchUseSemanticSearch: 'True' - AzureSearchSemanticSearchConfig: 'my-semantic-config' - AzureSearchTopK: '5' - AzureSearchContentColumns: 'content' - AzureSearchFilenameColumn: 'chunk_id' - AzureSearchTitleColumn: 'client_id' - AzureSearchUrlColumn: 'sourceurl' + AzureSearchIndex: azureSearchIndex + AzureSearchUseSemanticSearch: azureSearchUseSemanticSearch + AzureSearchSemanticSearchConfig: azureSearchSemanticSearchConfig + AzureSearchTopK: azureSearchTopK + AzureSearchContentColumns: azureSearchContentColumns + AzureSearchFilenameColumn: azureSearchFilenameColumn + AzureSearchTitleColumn: azureSearchTitleColumn + AzureSearchUrlColumn: azureSearchUrlColumn AzureOpenAIResource: aifoundry.outputs.aiFoundryName AzureOpenAIEndpoint: aifoundry.outputs.aoaiEndpoint AzureOpenAIModel: gptModelName - AzureOpenAITemperature: '0' - AzureOpenAITopP: '1' - AzureOpenAIMaxTokens: '1000' - AzureOpenAIStopSequence: '' - AzureOpenAISystemMessage: '''You are a helpful Wealth Advisor assistant''' + AzureOpenAITemperature: azureOpenAITemperature + AzureOpenAITopP: azureOpenAITopP + AzureOpenAIMaxTokens: azureOpenAIMaxTokens + AzureOpenAIStopSequence: azureOpenAIStopSequence + AzureOpenAISystemMessage: azureOpenAISystemMessage AzureOpenAIApiVersion: azureOpenaiAPIVersion - AzureOpenAIStream: 'True' - AzureSearchQueryType: 'simple' - AzureSearchVectorFields: 'contentVector' - AzureSearchPermittedGroupsField: '' - AzureSearchStrictness: '3' + AzureOpenAIStream: azureOpenAIStream + AzureSearchQueryType: azureSearchQueryType + AzureSearchVectorFields: azureSearchVectorFields + AzureSearchPermittedGroupsField: azureSearchPermittedGroupsField + AzureSearchStrictness: azureSearchStrictness AzureOpenAIEmbeddingName: embeddingModel AzureOpenAIEmbeddingEndpoint: aifoundry.outputs.aoaiEndpoint - USE_INTERNAL_STREAM: 'True' - SQLDB_SERVER: '${sqlDBModule.outputs.sqlServerName}.database.windows.net' + USE_INTERNAL_STREAM: useInternalStream + SQLDB_SERVER: sqlServerFqdn SQLDB_DATABASE: sqlDBModule.outputs.sqlDbName AZURE_COSMOSDB_ACCOUNT: cosmosDBModule.outputs.cosmosAccountName AZURE_COSMOSDB_CONVERSATIONS_CONTAINER: cosmosDBModule.outputs.cosmosContainerName AZURE_COSMOSDB_DATABASE: cosmosDBModule.outputs.cosmosDatabaseName - AZURE_COSMOSDB_ENABLE_FEEDBACK: 'True' + AZURE_COSMOSDB_ENABLE_FEEDBACK: azureCosmosDbEnableFeedback //VITE_POWERBI_EMBED_URL: 'TBD' imageTag: imageTag userassignedIdentityClientId: managedIdentityModule.outputs.managedIdentityWebAppOutput.clientId @@ -279,10 +309,55 @@ output KEY_VAULT_NAME string = keyvaultModule.outputs.keyvaultName output COSMOSDB_ACCOUNT_NAME string = cosmosDBModule.outputs.cosmosAccountName output RESOURCE_GROUP_NAME string = resourceGroup().name output RESOURCE_GROUP_NAME_FOUNDRY string = aifoundry.outputs.resourceGroupNameFoundry -output SQLDB_SERVER string = sqlDBModule.outputs.sqlServerName +output SQLDB_SERVER_NAME string = sqlDBModule.outputs.sqlServerName output SQLDB_DATABASE string = sqlDBModule.outputs.sqlDbName output MANAGEDIDENTITY_WEBAPP_NAME string = managedIdentityModule.outputs.managedIdentityWebAppOutput.name output MANAGEDIDENTITY_WEBAPP_CLIENTID string = managedIdentityModule.outputs.managedIdentityWebAppOutput.clientId output AI_FOUNDRY_NAME string = aifoundry.outputs.aiFoundryName output AI_SEARCH_SERVICE_NAME string = aifoundry.outputs.aiSearchService output WEB_APP_NAME string = appserviceModule.outputs.webAppName +output APP_ENV string = appEnvironment +output APPINSIGHTS_INSTRUMENTATIONKEY string = aifoundry.outputs.instrumentationKey +output APPLICATIONINSIGHTS_CONNECTION_STRING string = aifoundry.outputs.applicationInsightsConnectionString +output AZURE_AI_AGENT_API_VERSION string = azureOpenaiAPIVersion +output AZURE_AI_AGENT_ENDPOINT string = aifoundry.outputs.aiFoundryProjectEndpoint +output AZURE_AI_AGENT_MODEL_DEPLOYMENT_NAME string = gptModelName +output AZURE_AI_SEARCH_ENDPOINT string = aifoundry.outputs.aiSearchTarget +output AZURE_CALL_TRANSCRIPT_SYSTEM_PROMPT string = functionAppCallTranscriptSystemPrompt +output AZURE_COSMOSDB_ACCOUNT string = cosmosDBModule.outputs.cosmosAccountName +output AZURE_COSMOSDB_CONVERSATIONS_CONTAINER string = cosmosDBModule.outputs.cosmosContainerName +output AZURE_COSMOSDB_DATABASE string = cosmosDBModule.outputs.cosmosDatabaseName +output AZURE_COSMOSDB_ENABLE_FEEDBACK string = azureCosmosDbEnableFeedback +output AZURE_OPENAI_EMBEDDING_ENDPOINT string = aifoundry.outputs.aoaiEndpoint +output AZURE_OPENAI_EMBEDDING_NAME string = embeddingModel +output AZURE_OPENAI_ENDPOINT string = aifoundry.outputs.aoaiEndpoint +output AZURE_OPENAI_MAX_TOKENS string = azureOpenAIMaxTokens +output AZURE_OPENAI_MODEL string = gptModelName +output AZURE_OPENAI_PREVIEW_API_VERSION string = azureOpenaiAPIVersion +output AZURE_OPENAI_RESOURCE string = aifoundry.outputs.aiFoundryName +output AZURE_OPENAI_STOP_SEQUENCE string = azureOpenAIStopSequence +output AZURE_OPENAI_STREAM string = azureOpenAIStream +output AZURE_OPENAI_STREAM_TEXT_SYSTEM_PROMPT string = functionAppStreamTextSystemPrompt +output AZURE_OPENAI_SYSTEM_MESSAGE string = azureOpenAISystemMessage +output AZURE_OPENAI_TEMPERATURE string = azureOpenAITemperature +output AZURE_OPENAI_TOP_P string = azureOpenAITopP +output AZURE_SEARCH_CONNECTION_NAME string = aifoundry.outputs.aiSearchFoundryConnectionName +output AZURE_SEARCH_CONTENT_COLUMNS string = azureSearchContentColumns +output AZURE_SEARCH_ENABLE_IN_DOMAIN string = azureSearchEnableInDomain +output AZURE_SEARCH_FILENAME_COLUMN string = azureSearchFilenameColumn +output AZURE_SEARCH_INDEX string = azureSearchIndex +output AZURE_SEARCH_PERMITTED_GROUPS_COLUMN string = azureSearchPermittedGroupsField +output AZURE_SEARCH_QUERY_TYPE string = azureSearchQueryType +output AZURE_SEARCH_SEMANTIC_SEARCH_CONFIG string = azureSearchSemanticSearchConfig +output AZURE_SEARCH_SERVICE string = aifoundry.outputs.aiSearchService +output AZURE_SEARCH_STRICTNESS string = azureSearchStrictness +output AZURE_SEARCH_TITLE_COLUMN string = azureSearchTitleColumn +output AZURE_SEARCH_TOP_K string = azureSearchTopK +output AZURE_SEARCH_URL_COLUMN string = azureSearchUrlColumn +output AZURE_SEARCH_USE_SEMANTIC_SEARCH string = azureSearchUseSemanticSearch +output AZURE_SEARCH_VECTOR_COLUMNS string = azureSearchVectorFields +output AZURE_SQL_SYSTEM_PROMPT string = functionAppSqlPrompt +output SQLDB_SERVER string = sqlServerFqdn +output SQLDB_USER_MID string = managedIdentityModule.outputs.managedIdentityWebAppOutput.clientId +output USE_AI_PROJECT_CLIENT string = useAIProjectClientFlag +output USE_INTERNAL_STREAM string = useInternalStream diff --git a/infra/main.json b/infra/main.json index 058de995b..43c2bf875 100644 --- a/infra/main.json +++ b/infra/main.json @@ -5,7 +5,7 @@ "_generator": { "name": "bicep", "version": "0.36.177.2456", - "templateHash": "7434704573623874481" + "templateHash": "8388189115253050142" } }, "parameters": { @@ -94,7 +94,10 @@ }, "imageTag": { "type": "string", - "defaultValue": "latest" + "defaultValue": "latest", + "metadata": { + "description": "The Docker image tag to use for the application deployment." + } }, "aiDeploymentsLocation": { "type": "string", @@ -362,6 +365,31 @@ "uniqueId": "[toLower(uniqueString(parameters('environmentName'), subscription().id, variables('solutionLocation'), resourceGroup().name))]", "solutionPrefix": "[format('ca{0}', padLeft(take(variables('uniqueId'), 12), 12, '0'))]", "abbrs": "[variables('$fxv#0')]", + "hostingPlanName": "[format('{0}{1}', variables('abbrs').compute.appServicePlan, variables('solutionPrefix'))]", + "websiteName": "[format('{0}{1}', variables('abbrs').compute.webApp, variables('solutionPrefix'))]", + "appEnvironment": "Prod", + "azureSearchIndex": "transcripts_index", + "azureSearchUseSemanticSearch": "True", + "azureSearchSemanticSearchConfig": "my-semantic-config", + "azureSearchTopK": "5", + "azureSearchContentColumns": "content", + "azureSearchFilenameColumn": "chunk_id", + "azureSearchTitleColumn": "client_id", + "azureSearchUrlColumn": "sourceurl", + "azureOpenAITemperature": "0", + "azureOpenAITopP": "1", + "azureOpenAIMaxTokens": "1000", + "azureOpenAIStopSequence": "\n", + "azureOpenAISystemMessage": "You are a helpful Wealth Advisor assistant", + "azureOpenAIStream": "True", + "azureSearchQueryType": "simple", + "azureSearchVectorFields": "contentVector", + "azureSearchPermittedGroupsField": "", + "azureSearchStrictness": "3", + "azureSearchEnableInDomain": "False", + "azureCosmosDbEnableFeedback": "True", + "useInternalStream": "True", + "useAIProjectClientFlag": "False", "functionAppSqlPrompt": "Generate a valid T-SQL query to find {query} for tables and columns provided below:\r\n 1. Table: Clients\r\n Columns: ClientId, Client, Email, Occupation, MaritalStatus, Dependents\r\n 2. Table: InvestmentGoals\r\n Columns: ClientId, InvestmentGoal\r\n 3. Table: Assets\r\n Columns: ClientId, AssetDate, Investment, ROI, Revenue, AssetType\r\n 4. Table: ClientSummaries\r\n Columns: ClientId, ClientSummary\r\n 5. Table: InvestmentGoalsDetails\r\n Columns: ClientId, InvestmentGoal, TargetAmount, Contribution\r\n 6. Table: Retirement\r\n Columns: ClientId, StatusDate, RetirementGoalProgress, EducationGoalProgress\r\n 7. Table: ClientMeetings\r\n Columns: ClientId, ConversationId, Title, StartTime, EndTime, Advisor, ClientEmail\r\n Always use the Investment column from the Assets table as the value.\r\n Assets table has snapshots of values by date. Do not add numbers across different dates for total values.\r\n Do not use client name in filters.\r\n Do not include assets values unless asked for.\r\n ALWAYS use ClientId = {clientid} in the query filter.\r\n ALWAYS select Client Name (Column: Client) in the query.\r\n Query filters are IMPORTANT. Add filters like AssetType, AssetDate, etc. if needed.\r\n When answering scheduling or time-based meeting questions, always use the StartTime column from ClientMeetings table. Use correct logic to return the most recent past meeting (last/previous) or the nearest future meeting (next/upcoming), and ensure only StartTime column is used for meeting timing comparisons.\r\n Only return the generated SQL query. Do not return anything else.", "functionAppCallTranscriptSystemPrompt": "You are an assistant who supports wealth advisors in preparing for client meetings. \r\n You have access to the client’s past meeting call transcripts. \r\n When answering questions, especially summary requests, provide a detailed and structured response that includes key topics, concerns, decisions, and trends. \r\n If no data is available, state 'No relevant data found for previous meetings.", "functionAppStreamTextSystemPrompt": "The currently selected client's name is '{SelectedClientName}'. Treat any case-insensitive or partial mention as referring to this client.\r\n If the user mentions no name, assume they are asking about '{SelectedClientName}'.\r\n If the user references a name that clearly differs from '{SelectedClientName}' or comparing with other clients, respond only with: 'Please only ask questions about the selected client or select another client.' Otherwise, provide thorough answers for every question using only data from SQL or call transcripts.'\r\n If no data is found, respond with 'No data found for that client.' Remove any client identifiers from the final response.\r\n Always send clientId as '{client_id}'." @@ -744,7 +772,7 @@ "_generator": { "name": "bicep", "version": "0.36.177.2456", - "templateHash": "13609803072209612016" + "templateHash": "5605479917210969670" } }, "parameters": { @@ -1608,6 +1636,10 @@ "type": "string", "value": "[resourceId('Microsoft.Insights/components', variables('applicationInsightsName'))]" }, + "instrumentationKey": { + "type": "string", + "value": "[reference(resourceId('Microsoft.Insights/components', variables('applicationInsightsName')), '2020-02-02').InstrumentationKey]" + }, "logAnalyticsWorkspaceResourceName": { "type": "string", "value": "[if(variables('useExisting'), variables('existingLawName'), variables('workspaceName'))]" @@ -2152,37 +2184,40 @@ "value": "[variables('solutionLocation')]" }, "HostingPlanName": { - "value": "[format('{0}{1}', variables('abbrs').compute.appServicePlan, variables('solutionPrefix'))]" + "value": "[variables('hostingPlanName')]" }, "WebsiteName": { - "value": "[format('{0}{1}', variables('abbrs').compute.webApp, variables('solutionPrefix'))]" + "value": "[variables('websiteName')]" + }, + "AppEnvironment": { + "value": "[variables('appEnvironment')]" }, "AzureSearchService": { "value": "[reference(extensionResourceId(format('/subscriptions/{0}/resourceGroups/{1}', subscription().subscriptionId, resourceGroup().name), 'Microsoft.Resources/deployments', 'deploy_ai_foundry'), '2022-09-01').outputs.aiSearchService.value]" }, "AzureSearchIndex": { - "value": "transcripts_index" + "value": "[variables('azureSearchIndex')]" }, "AzureSearchUseSemanticSearch": { - "value": "True" + "value": "[variables('azureSearchUseSemanticSearch')]" }, "AzureSearchSemanticSearchConfig": { - "value": "my-semantic-config" + "value": "[variables('azureSearchSemanticSearchConfig')]" }, "AzureSearchTopK": { - "value": "5" + "value": "[variables('azureSearchTopK')]" }, "AzureSearchContentColumns": { - "value": "content" + "value": "[variables('azureSearchContentColumns')]" }, "AzureSearchFilenameColumn": { - "value": "chunk_id" + "value": "[variables('azureSearchFilenameColumn')]" }, "AzureSearchTitleColumn": { - "value": "client_id" + "value": "[variables('azureSearchTitleColumn')]" }, "AzureSearchUrlColumn": { - "value": "sourceurl" + "value": "[variables('azureSearchUrlColumn')]" }, "AzureOpenAIResource": { "value": "[reference(extensionResourceId(format('/subscriptions/{0}/resourceGroups/{1}', subscription().subscriptionId, resourceGroup().name), 'Microsoft.Resources/deployments', 'deploy_ai_foundry'), '2022-09-01').outputs.aiFoundryName.value]" @@ -2194,37 +2229,37 @@ "value": "[parameters('gptModelName')]" }, "AzureOpenAITemperature": { - "value": "0" + "value": "[variables('azureOpenAITemperature')]" }, "AzureOpenAITopP": { - "value": "1" + "value": "[variables('azureOpenAITopP')]" }, "AzureOpenAIMaxTokens": { - "value": "1000" + "value": "[variables('azureOpenAIMaxTokens')]" }, "AzureOpenAIStopSequence": { - "value": "" + "value": "[variables('azureOpenAIStopSequence')]" }, "AzureOpenAISystemMessage": { - "value": "You are a helpful Wealth Advisor assistant" + "value": "[variables('azureOpenAISystemMessage')]" }, "AzureOpenAIApiVersion": { "value": "[parameters('azureOpenaiAPIVersion')]" }, "AzureOpenAIStream": { - "value": "True" + "value": "[variables('azureOpenAIStream')]" }, "AzureSearchQueryType": { - "value": "simple" + "value": "[variables('azureSearchQueryType')]" }, "AzureSearchVectorFields": { - "value": "contentVector" + "value": "[variables('azureSearchVectorFields')]" }, "AzureSearchPermittedGroupsField": { - "value": "" + "value": "[variables('azureSearchPermittedGroupsField')]" }, "AzureSearchStrictness": { - "value": "3" + "value": "[variables('azureSearchStrictness')]" }, "AzureOpenAIEmbeddingName": { "value": "[parameters('embeddingModel')]" @@ -2233,7 +2268,7 @@ "value": "[reference(extensionResourceId(format('/subscriptions/{0}/resourceGroups/{1}', subscription().subscriptionId, resourceGroup().name), 'Microsoft.Resources/deployments', 'deploy_ai_foundry'), '2022-09-01').outputs.aoaiEndpoint.value]" }, "USE_INTERNAL_STREAM": { - "value": "True" + "value": "[variables('useInternalStream')]" }, "SQLDB_SERVER": { "value": "[format('{0}.database.windows.net', reference(extensionResourceId(format('/subscriptions/{0}/resourceGroups/{1}', subscription().subscriptionId, resourceGroup().name), 'Microsoft.Resources/deployments', 'deploy_sql_db'), '2022-09-01').outputs.sqlServerName.value)]" @@ -2251,7 +2286,7 @@ "value": "[reference(extensionResourceId(format('/subscriptions/{0}/resourceGroups/{1}', subscription().subscriptionId, resourceGroup().name), 'Microsoft.Resources/deployments', 'deploy_cosmos_db'), '2022-09-01').outputs.cosmosDatabaseName.value]" }, "AZURE_COSMOSDB_ENABLE_FEEDBACK": { - "value": "True" + "value": "[variables('azureCosmosDbEnableFeedback')]" }, "imageTag": { "value": "[parameters('imageTag')]" @@ -2300,7 +2335,7 @@ "_generator": { "name": "bicep", "version": "0.36.177.2456", - "templateHash": "14489288067602272519" + "templateHash": "17855260504239152628" } }, "parameters": { @@ -2338,6 +2373,9 @@ "WebsiteName": { "type": "string" }, + "AppEnvironment": { + "type": "string" + }, "AzureSearchService": { "type": "string", "defaultValue": "", @@ -2674,7 +2712,7 @@ "appSettings": [ { "name": "APP_ENV", - "value": "Prod" + "value": "[parameters('AppEnvironment')]" }, { "name": "APPINSIGHTS_INSTRUMENTATIONKEY", @@ -3102,7 +3140,7 @@ "type": "string", "value": "[reference(extensionResourceId(format('/subscriptions/{0}/resourceGroups/{1}', subscription().subscriptionId, resourceGroup().name), 'Microsoft.Resources/deployments', 'deploy_ai_foundry'), '2022-09-01').outputs.resourceGroupNameFoundry.value]" }, - "SQLDB_SERVER": { + "SQLDB_SERVER_NAME": { "type": "string", "value": "[reference(extensionResourceId(format('/subscriptions/{0}/resourceGroups/{1}', subscription().subscriptionId, resourceGroup().name), 'Microsoft.Resources/deployments', 'deploy_sql_db'), '2022-09-01').outputs.sqlServerName.value]" }, @@ -3129,6 +3167,186 @@ "WEB_APP_NAME": { "type": "string", "value": "[reference(extensionResourceId(format('/subscriptions/{0}/resourceGroups/{1}', subscription().subscriptionId, resourceGroup().name), 'Microsoft.Resources/deployments', 'deploy_app_service'), '2022-09-01').outputs.webAppName.value]" + }, + "APP_ENV": { + "type": "string", + "value": "[variables('appEnvironment')]" + }, + "APPINSIGHTS_INSTRUMENTATIONKEY": { + "type": "string", + "value": "[reference(extensionResourceId(format('/subscriptions/{0}/resourceGroups/{1}', subscription().subscriptionId, resourceGroup().name), 'Microsoft.Resources/deployments', 'deploy_ai_foundry'), '2022-09-01').outputs.instrumentationKey.value]" + }, + "APPLICATIONINSIGHTS_CONNECTION_STRING": { + "type": "string", + "value": "[reference(extensionResourceId(format('/subscriptions/{0}/resourceGroups/{1}', subscription().subscriptionId, resourceGroup().name), 'Microsoft.Resources/deployments', 'deploy_ai_foundry'), '2022-09-01').outputs.applicationInsightsConnectionString.value]" + }, + "AZURE_AI_AGENT_API_VERSION": { + "type": "string", + "value": "[parameters('azureOpenaiAPIVersion')]" + }, + "AZURE_AI_AGENT_ENDPOINT": { + "type": "string", + "value": "[reference(extensionResourceId(format('/subscriptions/{0}/resourceGroups/{1}', subscription().subscriptionId, resourceGroup().name), 'Microsoft.Resources/deployments', 'deploy_ai_foundry'), '2022-09-01').outputs.aiFoundryProjectEndpoint.value]" + }, + "AZURE_AI_AGENT_MODEL_DEPLOYMENT_NAME": { + "type": "string", + "value": "[parameters('gptModelName')]" + }, + "AZURE_AI_SEARCH_ENDPOINT": { + "type": "string", + "value": "[reference(extensionResourceId(format('/subscriptions/{0}/resourceGroups/{1}', subscription().subscriptionId, resourceGroup().name), 'Microsoft.Resources/deployments', 'deploy_ai_foundry'), '2022-09-01').outputs.aiSearchTarget.value]" + }, + "AZURE_CALL_TRANSCRIPT_SYSTEM_PROMPT": { + "type": "string", + "value": "[variables('functionAppCallTranscriptSystemPrompt')]" + }, + "AZURE_COSMOSDB_ACCOUNT": { + "type": "string", + "value": "[reference(extensionResourceId(format('/subscriptions/{0}/resourceGroups/{1}', subscription().subscriptionId, resourceGroup().name), 'Microsoft.Resources/deployments', 'deploy_cosmos_db'), '2022-09-01').outputs.cosmosAccountName.value]" + }, + "AZURE_COSMOSDB_CONVERSATIONS_CONTAINER": { + "type": "string", + "value": "[reference(extensionResourceId(format('/subscriptions/{0}/resourceGroups/{1}', subscription().subscriptionId, resourceGroup().name), 'Microsoft.Resources/deployments', 'deploy_cosmos_db'), '2022-09-01').outputs.cosmosContainerName.value]" + }, + "AZURE_COSMOSDB_DATABASE": { + "type": "string", + "value": "[reference(extensionResourceId(format('/subscriptions/{0}/resourceGroups/{1}', subscription().subscriptionId, resourceGroup().name), 'Microsoft.Resources/deployments', 'deploy_cosmos_db'), '2022-09-01').outputs.cosmosDatabaseName.value]" + }, + "AZURE_COSMOSDB_ENABLE_FEEDBACK": { + "type": "string", + "value": "[variables('azureCosmosDbEnableFeedback')]" + }, + "AZURE_OPENAI_EMBEDDING_ENDPOINT": { + "type": "string", + "value": "[reference(extensionResourceId(format('/subscriptions/{0}/resourceGroups/{1}', subscription().subscriptionId, resourceGroup().name), 'Microsoft.Resources/deployments', 'deploy_ai_foundry'), '2022-09-01').outputs.aoaiEndpoint.value]" + }, + "AZURE_OPENAI_EMBEDDING_NAME": { + "type": "string", + "value": "[parameters('embeddingModel')]" + }, + "AZURE_OPENAI_ENDPOINT": { + "type": "string", + "value": "[reference(extensionResourceId(format('/subscriptions/{0}/resourceGroups/{1}', subscription().subscriptionId, resourceGroup().name), 'Microsoft.Resources/deployments', 'deploy_ai_foundry'), '2022-09-01').outputs.aoaiEndpoint.value]" + }, + "AZURE_OPENAI_MAX_TOKENS": { + "type": "string", + "value": "[variables('azureOpenAIMaxTokens')]" + }, + "AZURE_OPENAI_MODEL": { + "type": "string", + "value": "[parameters('gptModelName')]" + }, + "AZURE_OPENAI_PREVIEW_API_VERSION": { + "type": "string", + "value": "[parameters('azureOpenaiAPIVersion')]" + }, + "AZURE_OPENAI_RESOURCE": { + "type": "string", + "value": "[reference(extensionResourceId(format('/subscriptions/{0}/resourceGroups/{1}', subscription().subscriptionId, resourceGroup().name), 'Microsoft.Resources/deployments', 'deploy_ai_foundry'), '2022-09-01').outputs.aiFoundryName.value]" + }, + "AZURE_OPENAI_STOP_SEQUENCE": { + "type": "string", + "value": "[variables('azureOpenAIStopSequence')]" + }, + "AZURE_OPENAI_STREAM": { + "type": "string", + "value": "[variables('azureOpenAIStream')]" + }, + "AZURE_OPENAI_STREAM_TEXT_SYSTEM_PROMPT": { + "type": "string", + "value": "[variables('functionAppStreamTextSystemPrompt')]" + }, + "AZURE_OPENAI_SYSTEM_MESSAGE": { + "type": "string", + "value": "[variables('azureOpenAISystemMessage')]" + }, + "AZURE_OPENAI_TEMPERATURE": { + "type": "string", + "value": "[variables('azureOpenAITemperature')]" + }, + "AZURE_OPENAI_TOP_P": { + "type": "string", + "value": "[variables('azureOpenAITopP')]" + }, + "AZURE_SEARCH_CONNECTION_NAME": { + "type": "string", + "value": "[reference(extensionResourceId(format('/subscriptions/{0}/resourceGroups/{1}', subscription().subscriptionId, resourceGroup().name), 'Microsoft.Resources/deployments', 'deploy_ai_foundry'), '2022-09-01').outputs.aiSearchFoundryConnectionName.value]" + }, + "AZURE_SEARCH_CONTENT_COLUMNS": { + "type": "string", + "value": "[variables('azureSearchContentColumns')]" + }, + "AZURE_SEARCH_ENABLE_IN_DOMAIN": { + "type": "string", + "value": "[variables('azureSearchEnableInDomain')]" + }, + "AZURE_SEARCH_FILENAME_COLUMN": { + "type": "string", + "value": "[variables('azureSearchFilenameColumn')]" + }, + "AZURE_SEARCH_INDEX": { + "type": "string", + "value": "[variables('azureSearchIndex')]" + }, + "AZURE_SEARCH_PERMITTED_GROUPS_COLUMN": { + "type": "string", + "value": "[variables('azureSearchPermittedGroupsField')]" + }, + "AZURE_SEARCH_QUERY_TYPE": { + "type": "string", + "value": "[variables('azureSearchQueryType')]" + }, + "AZURE_SEARCH_SEMANTIC_SEARCH_CONFIG": { + "type": "string", + "value": "[variables('azureSearchSemanticSearchConfig')]" + }, + "AZURE_SEARCH_SERVICE": { + "type": "string", + "value": "[reference(extensionResourceId(format('/subscriptions/{0}/resourceGroups/{1}', subscription().subscriptionId, resourceGroup().name), 'Microsoft.Resources/deployments', 'deploy_ai_foundry'), '2022-09-01').outputs.aiSearchService.value]" + }, + "AZURE_SEARCH_STRICTNESS": { + "type": "string", + "value": "[variables('azureSearchStrictness')]" + }, + "AZURE_SEARCH_TITLE_COLUMN": { + "type": "string", + "value": "[variables('azureSearchTitleColumn')]" + }, + "AZURE_SEARCH_TOP_K": { + "type": "string", + "value": "[variables('azureSearchTopK')]" + }, + "AZURE_SEARCH_URL_COLUMN": { + "type": "string", + "value": "[variables('azureSearchUrlColumn')]" + }, + "AZURE_SEARCH_USE_SEMANTIC_SEARCH": { + "type": "string", + "value": "[variables('azureSearchUseSemanticSearch')]" + }, + "AZURE_SEARCH_VECTOR_COLUMNS": { + "type": "string", + "value": "[variables('azureSearchVectorFields')]" + }, + "AZURE_SQL_SYSTEM_PROMPT": { + "type": "string", + "value": "[variables('functionAppSqlPrompt')]" + }, + "SQLDB_SERVER": { + "type": "string", + "value": "[format('{0}.database.windows.net', reference(extensionResourceId(format('/subscriptions/{0}/resourceGroups/{1}', subscription().subscriptionId, resourceGroup().name), 'Microsoft.Resources/deployments', 'deploy_sql_db'), '2022-09-01').outputs.sqlServerName.value)]" + }, + "SQLDB_USER_MID": { + "type": "string", + "value": "[reference(extensionResourceId(format('/subscriptions/{0}/resourceGroups/{1}', subscription().subscriptionId, resourceGroup().name), 'Microsoft.Resources/deployments', 'deploy_managed_identity'), '2022-09-01').outputs.managedIdentityWebAppOutput.value.clientId]" + }, + "USE_AI_PROJECT_CLIENT": { + "type": "string", + "value": "[variables('useAIProjectClientFlag')]" + }, + "USE_INTERNAL_STREAM": { + "type": "string", + "value": "[variables('useInternalStream')]" } } } \ No newline at end of file diff --git a/infra/scripts/process_sample_data.sh b/infra/scripts/process_sample_data.sh index 7b6213eee..4419703f0 100644 --- a/infra/scripts/process_sample_data.sh +++ b/infra/scripts/process_sample_data.sh @@ -40,7 +40,7 @@ if [ -z "$keyvaultName" ]; then fi if [ -z "$sqlServerName" ]; then - sqlServerName=$(azd env get-value SQLDB_SERVER) + sqlServerName=$(azd env get-value SQLDB_SERVER_NAME) fi if [ -z "$SqlDatabaseName" ]; then