-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.bicep
217 lines (178 loc) · 8.93 KB
/
main.bicep
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
@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 Cognitive Search Resource - Created during the "Chat with your data" Solution Accelerator')
param AzureCognitiveSearch string
@description('Azure Cognitive Search Index - Created during the "Chat with your data" Solution Accelerator')
param AzureSearchIndex string
@description('Azure Cognitive Search Conversation Log Index - Created during the "Chat with your data" Solution Accelerator')
param AzureSearchConversationLogIndex string = 'conversations'
@description('Azure Cognitive 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-07-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/cwyod_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://${AzureCognitiveSearch}.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
]
}