Skip to content

Commit 9edc403

Browse files
Roopan-MicrosoftAjitPadhi-MicrosoftPavan-Microsoftross-p-smithgpickett
authored
fix: merging dev fixes into main branch (#1622)
Signed-off-by: dependabot[bot] <[email protected]> Co-authored-by: Ajit Padhi <[email protected]> Co-authored-by: Pavan-Microsoft <[email protected]> Co-authored-by: Ross Smith <[email protected]> Co-authored-by: gpickett <[email protected]> Co-authored-by: Francia Riesco <[email protected]> Co-authored-by: Francia Riesco <[email protected]> Co-authored-by: Prajwal D C <[email protected]> Co-authored-by: Harmanpreet-Microsoft <[email protected]> Co-authored-by: UtkarshMishra-Microsoft <[email protected]> Co-authored-by: Priyanka-Microsoft <[email protected]> Co-authored-by: Prasanjeet-Microsoft <[email protected]> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
1 parent a13551b commit 9edc403

File tree

12 files changed

+328
-284
lines changed

12 files changed

+328
-284
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

code/backend/batch/utilities/parser/output_parser_tool.py

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,10 +22,13 @@ def _get_source_docs_from_answer(self, answer):
2222

2323
def _make_doc_references_sequential(self, answer):
2424
doc_matches = list(re.finditer(r"\[doc\d+\]", answer))
25+
updated_answer = answer
26+
offset = 0
2527
for i, match in enumerate(doc_matches):
26-
start, end = match.span()
27-
answer = answer[:start] + f"[doc{i + 1}]" + answer[end:]
28-
return answer
28+
start, end = match.start() + offset, match.end() + offset
29+
updated_answer = updated_answer[:start] + f"[doc{i + 1}]" + updated_answer[end:]
30+
offset += len(f"[doc{i + 1}]") - (end - start)
31+
return updated_answer
2932

3033
def parse(
3134
self,

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)