Skip to content

Commit 1f22786

Browse files
feat: Remove AI search service for PostgreSQL configuration to optimize deployment (#1624)
1 parent 8213f0a commit 1f22786

File tree

8 files changed

+284
-265
lines changed

8 files changed

+284
-265
lines changed

code/backend/batch/utilities/orchestrator/orchestrator_base.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,8 @@ def __init__(self) -> None:
1717
self.message_id = str(uuid4())
1818
self.tokens = {"prompt": 0, "completion": 0, "total": 0}
1919
logger.debug(f"New message id: {self.message_id} with tokens {self.tokens}")
20-
self.conversation_logger: ConversationLogger = ConversationLogger()
20+
if str(self.config.logging.log_user_interactions).lower() == "true":
21+
self.conversation_logger: ConversationLogger = ConversationLogger()
2122
self.content_safety_checker = ContentSafetyChecker()
2223
self.output_parser = OutputParserTool()
2324

infra/app/adminweb.bicep

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -62,15 +62,17 @@ module adminweb '../core/host/appservice.bicep' = {
6262
).key1
6363
AZURE_SEARCH_KEY: useKeyVault
6464
? searchKeyName
65-
: listAdminKeys(
66-
resourceId(
67-
subscription().subscriptionId,
68-
resourceGroup().name,
69-
'Microsoft.Search/searchServices',
70-
azureAISearchName
71-
),
72-
'2021-04-01-preview'
73-
).primaryKey
65+
: (azureAISearchName != ''
66+
? listAdminKeys(
67+
resourceId(
68+
subscription().subscriptionId,
69+
resourceGroup().name,
70+
'Microsoft.Search/searchServices',
71+
azureAISearchName
72+
),
73+
'2021-04-01-preview'
74+
).primaryKey
75+
: '')
7476
AZURE_BLOB_ACCOUNT_KEY: useKeyVault
7577
? storageAccountKeyName
7678
: listKeys(

infra/app/function.bicep

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -61,15 +61,17 @@ module function '../core/host/functions.bicep' = {
6161
).key1
6262
AZURE_SEARCH_KEY: useKeyVault
6363
? searchKeyName
64-
: listAdminKeys(
65-
resourceId(
66-
subscription().subscriptionId,
67-
resourceGroup().name,
68-
'Microsoft.Search/searchServices',
69-
azureAISearchName
70-
),
71-
'2021-04-01-preview'
72-
).primaryKey
64+
: (azureAISearchName != ''
65+
? listAdminKeys(
66+
resourceId(
67+
subscription().subscriptionId,
68+
resourceGroup().name,
69+
'Microsoft.Search/searchServices',
70+
azureAISearchName
71+
),
72+
'2021-04-01-preview'
73+
).primaryKey
74+
: '')
7375
AZURE_BLOB_ACCOUNT_KEY: useKeyVault
7476
? storageAccountKeyName
7577
: listKeys(

infra/app/machinelearning.bicep

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ resource machineLearningWorkspace 'Microsoft.MachineLearningServices/workspaces@
2121
}
2222
}
2323

24-
resource aisearch_connection 'Microsoft.MachineLearningServices/workspaces/connections@2024-01-01-preview' = {
24+
resource aisearch_connection 'Microsoft.MachineLearningServices/workspaces/connections@2024-01-01-preview' = if (azureAISearchName != '') {
2525
parent: machineLearningWorkspace
2626
name: 'aisearch_connection'
2727
properties: {
@@ -42,7 +42,12 @@ resource aisearch_connection 'Microsoft.MachineLearningServices/workspaces/conne
4242
}
4343
}
4444

45-
var azureOpenAIId = resourceId(subscription().subscriptionId, resourceGroup().name, 'Microsoft.CognitiveServices/accounts', azureOpenAIName)
45+
var azureOpenAIId = resourceId(
46+
subscription().subscriptionId,
47+
resourceGroup().name,
48+
'Microsoft.CognitiveServices/accounts',
49+
azureOpenAIName
50+
)
4651

4752
resource openai_connection 'Microsoft.MachineLearningServices/workspaces/connections@2024-01-01-preview' = {
4853
parent: machineLearningWorkspace
@@ -61,4 +66,4 @@ resource openai_connection 'Microsoft.MachineLearningServices/workspaces/connect
6166
}
6267
}
6368

64-
output workspaceName string = machineLearningWorkspace.name
69+
output workspaceName string = machineLearningWorkspace.name

infra/app/storekeys.bicep

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ resource openAIKeySecret 'Microsoft.KeyVault/vaults/secrets@2022-07-01' = {
4343
}
4444
}
4545

46-
resource searchKeySecret 'Microsoft.KeyVault/vaults/secrets@2022-07-01' = {
46+
resource searchKeySecret 'Microsoft.KeyVault/vaults/secrets@2022-07-01' = if (azureAISearchName != '') {
4747
parent: keyVault
4848
name: searchKeyName
4949
properties: {
@@ -135,7 +135,7 @@ resource keyVault 'Microsoft.KeyVault/vaults@2022-07-01' existing = {
135135

136136
output CONTENT_SAFETY_KEY_NAME string = contentSafetyKeySecret.name
137137
output FORM_RECOGNIZER_KEY_NAME string = formRecognizerKeySecret.name
138-
output SEARCH_KEY_NAME string = searchKeySecret.name
138+
output SEARCH_KEY_NAME string = azureAISearchName != '' ? searchKeySecret.name : ''
139139
output OPENAI_KEY_NAME string = openAIKeySecret.name
140140
output STORAGE_ACCOUNT_KEY_NAME string = storageAccountKeySecret.name
141141
output SPEECH_KEY_NAME string = speechKeySecret.name

infra/app/web.bicep

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -79,15 +79,17 @@ module web '../core/host/appservice.bicep' = {
7979
).key1
8080
AZURE_SEARCH_KEY: useKeyVault
8181
? searchKeyName
82-
: listAdminKeys(
83-
resourceId(
84-
subscription().subscriptionId,
85-
resourceGroup().name,
86-
'Microsoft.Search/searchServices',
87-
azureAISearchName
88-
),
89-
'2021-04-01-preview'
90-
).primaryKey
82+
: (azureAISearchName != ''
83+
? listAdminKeys(
84+
resourceId(
85+
subscription().subscriptionId,
86+
resourceGroup().name,
87+
'Microsoft.Search/searchServices',
88+
azureAISearchName
89+
),
90+
'2021-04-01-preview'
91+
).primaryKey
92+
: '')
9193
AZURE_BLOB_ACCOUNT_KEY: useKeyVault
9294
? storageAccountKeyName
9395
: listKeys(

0 commit comments

Comments
 (0)