Skip to content

Commit

Permalink
Merge branch 'main' into demo
Browse files Browse the repository at this point in the history
  • Loading branch information
Roopan-Microsoft committed Jan 20, 2025
2 parents 8216d78 + 9edc403 commit 225afc2
Show file tree
Hide file tree
Showing 12 changed files with 283 additions and 266 deletions.
44 changes: 0 additions & 44 deletions .github/workflows/sync-branches.yml

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,8 @@ def __init__(self) -> None:
self.message_id = str(uuid4())
self.tokens = {"prompt": 0, "completion": 0, "total": 0}
logger.debug(f"New message id: {self.message_id} with tokens {self.tokens}")
self.conversation_logger: ConversationLogger = ConversationLogger()
if str(self.config.logging.log_user_interactions).lower() == "true":
self.conversation_logger: ConversationLogger = ConversationLogger()
self.content_safety_checker = ContentSafetyChecker()
self.output_parser = OutputParserTool()

Expand Down
9 changes: 6 additions & 3 deletions code/backend/batch/utilities/parser/output_parser_tool.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,13 @@ def _get_source_docs_from_answer(self, answer):

def _make_doc_references_sequential(self, answer):
doc_matches = list(re.finditer(r"\[doc\d+\]", answer))
updated_answer = answer
offset = 0
for i, match in enumerate(doc_matches):
start, end = match.span()
answer = answer[:start] + f"[doc{i + 1}]" + answer[end:]
return answer
start, end = match.start() + offset, match.end() + offset
updated_answer = updated_answer[:start] + f"[doc{i + 1}]" + updated_answer[end:]
offset += len(f"[doc{i + 1}]") - (end - start)
return updated_answer

def parse(
self,
Expand Down
20 changes: 11 additions & 9 deletions infra/app/adminweb.bicep
Original file line number Diff line number Diff line change
Expand Up @@ -62,15 +62,17 @@ module adminweb '../core/host/appservice.bicep' = {
).key1
AZURE_SEARCH_KEY: useKeyVault
? searchKeyName
: listAdminKeys(
resourceId(
subscription().subscriptionId,
resourceGroup().name,
'Microsoft.Search/searchServices',
azureAISearchName
),
'2021-04-01-preview'
).primaryKey
: (azureAISearchName != ''
? listAdminKeys(
resourceId(
subscription().subscriptionId,
resourceGroup().name,
'Microsoft.Search/searchServices',
azureAISearchName
),
'2021-04-01-preview'
).primaryKey
: '')
AZURE_BLOB_ACCOUNT_KEY: useKeyVault
? storageAccountKeyName
: listKeys(
Expand Down
20 changes: 11 additions & 9 deletions infra/app/function.bicep
Original file line number Diff line number Diff line change
Expand Up @@ -61,15 +61,17 @@ module function '../core/host/functions.bicep' = {
).key1
AZURE_SEARCH_KEY: useKeyVault
? searchKeyName
: listAdminKeys(
resourceId(
subscription().subscriptionId,
resourceGroup().name,
'Microsoft.Search/searchServices',
azureAISearchName
),
'2021-04-01-preview'
).primaryKey
: (azureAISearchName != ''
? listAdminKeys(
resourceId(
subscription().subscriptionId,
resourceGroup().name,
'Microsoft.Search/searchServices',
azureAISearchName
),
'2021-04-01-preview'
).primaryKey
: '')
AZURE_BLOB_ACCOUNT_KEY: useKeyVault
? storageAccountKeyName
: listKeys(
Expand Down
11 changes: 8 additions & 3 deletions infra/app/machinelearning.bicep
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ resource machineLearningWorkspace 'Microsoft.MachineLearningServices/workspaces@
}
}

resource aisearch_connection 'Microsoft.MachineLearningServices/workspaces/connections@2024-01-01-preview' = {
resource aisearch_connection 'Microsoft.MachineLearningServices/workspaces/connections@2024-01-01-preview' = if (azureAISearchName != '') {
parent: machineLearningWorkspace
name: 'aisearch_connection'
properties: {
Expand All @@ -42,7 +42,12 @@ resource aisearch_connection 'Microsoft.MachineLearningServices/workspaces/conne
}
}

var azureOpenAIId = resourceId(subscription().subscriptionId, resourceGroup().name, 'Microsoft.CognitiveServices/accounts', azureOpenAIName)
var azureOpenAIId = resourceId(
subscription().subscriptionId,
resourceGroup().name,
'Microsoft.CognitiveServices/accounts',
azureOpenAIName
)

resource openai_connection 'Microsoft.MachineLearningServices/workspaces/connections@2024-01-01-preview' = {
parent: machineLearningWorkspace
Expand All @@ -61,4 +66,4 @@ resource openai_connection 'Microsoft.MachineLearningServices/workspaces/connect
}
}

output workspaceName string = machineLearningWorkspace.name
output workspaceName string = machineLearningWorkspace.name
4 changes: 2 additions & 2 deletions infra/app/storekeys.bicep
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ resource openAIKeySecret 'Microsoft.KeyVault/vaults/secrets@2022-07-01' = {
}
}

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

output CONTENT_SAFETY_KEY_NAME string = contentSafetyKeySecret.name
output FORM_RECOGNIZER_KEY_NAME string = formRecognizerKeySecret.name
output SEARCH_KEY_NAME string = searchKeySecret.name
output SEARCH_KEY_NAME string = azureAISearchName != '' ? searchKeySecret.name : ''
output OPENAI_KEY_NAME string = openAIKeySecret.name
output STORAGE_ACCOUNT_KEY_NAME string = storageAccountKeySecret.name
output SPEECH_KEY_NAME string = speechKeySecret.name
Expand Down
20 changes: 11 additions & 9 deletions infra/app/web.bicep
Original file line number Diff line number Diff line change
Expand Up @@ -79,15 +79,17 @@ module web '../core/host/appservice.bicep' = {
).key1
AZURE_SEARCH_KEY: useKeyVault
? searchKeyName
: listAdminKeys(
resourceId(
subscription().subscriptionId,
resourceGroup().name,
'Microsoft.Search/searchServices',
azureAISearchName
),
'2021-04-01-preview'
).primaryKey
: (azureAISearchName != ''
? listAdminKeys(
resourceId(
subscription().subscriptionId,
resourceGroup().name,
'Microsoft.Search/searchServices',
azureAISearchName
),
'2021-04-01-preview'
).primaryKey
: '')
AZURE_BLOB_ACCOUNT_KEY: useKeyVault
? storageAccountKeyName
: listKeys(
Expand Down
Loading

0 comments on commit 225afc2

Please sign in to comment.