Skip to content

Commit 4c7ca81

Browse files
Merge pull request #80 from microsoft/updateContinerName
Update continer name
2 parents 6a5cf17 + c57ed5b commit 4c7ca81

File tree

7 files changed

+84
-14
lines changed

7 files changed

+84
-14
lines changed

infra/deploy_ai_foundry.bicep

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -298,3 +298,5 @@ output storageAccountName string = storageNameCleaned
298298

299299
output logAnalyticsId string = logAnalytics.id
300300
output storageAccountId string = storage.id
301+
302+
output projectConnectionString string = '${split(aiHubProject.properties.discoveryUrl, '/')[2]};${subscription().subscriptionId};${resourceGroup().name};${aiHubProject.name}'

infra/main.bicep

Lines changed: 37 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ param capacity int = 5
3636
var uniqueId = toLower(uniqueString(subscription().id, Prefix, resourceGroup().location))
3737
var UniquePrefix = 'cm${padLeft(take(uniqueId, 12), 12, '0')}'
3838
var ResourcePrefix = take('cm${Prefix}${UniquePrefix}', 15)
39-
var imageVersion = 'rc1' // Change to 'fnd01' when ready
39+
var imageVersion = 'fnd01'
4040
var location = resourceGroup().location
4141
var dblocation = resourceGroup().location
4242
var cosmosdbDatabase = 'cmsadb'
@@ -341,6 +341,26 @@ resource containerAppBackend 'Microsoft.App/containerApps@2023-05-01' = {
341341
name: 'TERMINATION_MODEL_DEPLOY'
342342
value: llmModel
343343
}
344+
{
345+
name: 'AZURE_AI_AGENT_MODEL_DEPLOYMENT_NAME'
346+
value: llmModel
347+
}
348+
{
349+
name: 'AZURE_AI_AGENT_PROJECT_NAME'
350+
value: azureAifoundry.outputs.aiProjectName
351+
}
352+
{
353+
name: 'AZURE_AI_AGENT_RESOURCE_GROUP_NAME'
354+
value: resourceGroup().name
355+
}
356+
{
357+
name: 'AZURE_AI_AGENT_SUBSCRIPTION_ID'
358+
value: subscription().subscriptionId
359+
}
360+
{
361+
name: 'AZURE_AI_AGENT_PROJECT_CONNECTION_STRING'
362+
value: azureAifoundry.outputs.projectConnectionString
363+
}
344364
]
345365
resources: {
346366
cpu: 1
@@ -434,6 +454,22 @@ resource containers 'Microsoft.Storage/storageAccounts/blobServices/containers@2
434454
dependsOn: [azureAifoundry]
435455
}]
436456

457+
resource aiHubProject 'Microsoft.MachineLearningServices/workspaces@2024-01-01-preview' existing = {
458+
name: '${ResourcePrefix}-prj' // aiProjectName must be calculated - available at main start.
459+
}
460+
461+
resource aiDeveloper 'Microsoft.Authorization/roleDefinitions@2022-04-01' existing = {
462+
name: '64702f94-c441-49e6-a78b-ef80e0188fee'
463+
}
464+
465+
resource aiDeveloperAccessProj 'Microsoft.Authorization/roleAssignments@2022-04-01' = {
466+
name: guid(containerAppBackend.name, aiHubProject.id, aiDeveloper.id)
467+
scope: aiHubProject
468+
properties: {
469+
roleDefinitionId: aiDeveloper.id
470+
principalId: containerAppBackend.identity.principalId
471+
}
472+
}
437473

438474
resource contributorRoleDefinition 'Microsoft.DocumentDB/databaseAccounts/sqlRoleDefinitions@2021-06-15' existing = {
439475
name: '${databaseAccount.name}/00000000-0000-0000-0000-000000000002'

infra/main.json

Lines changed: 29 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
"_generator": {
66
"name": "bicep",
77
"version": "0.34.44.8038",
8-
"templateHash": "1388245659062904286"
8+
"templateHash": "8953208502938265930"
99
}
1010
},
1111
"parameters": {
@@ -216,6 +216,26 @@
216216
{
217217
"name": "TERMINATION_MODEL_DEPLOY",
218218
"value": "[variables('llmModel')]"
219+
},
220+
{
221+
"name": "AZURE_AI_AGENT_MODEL_DEPLOYMENT_NAME",
222+
"value": "[variables('llmModel')]"
223+
},
224+
{
225+
"name": "AZURE_AI_AGENT_PROJECT_NAME",
226+
"value": "[reference(extensionResourceId(format('/subscriptions/{0}/resourceGroups/{1}', subscription().subscriptionId, resourceGroup().name), 'Microsoft.Resources/deployments', 'deploy_ai_foundry'), '2022-09-01').outputs.aiProjectName.value]"
227+
},
228+
{
229+
"name": "AZURE_AI_AGENT_RESOURCE_GROUP_NAME",
230+
"value": "[resourceGroup().name]"
231+
},
232+
{
233+
"name": "AZURE_AI_AGENT_SUBSCRIPTION_ID",
234+
"value": "[subscription().subscriptionId]"
235+
},
236+
{
237+
"name": "AZURE_AI_AGENT_PROJECT_CONNECTION_STRING",
238+
"value": "[reference(extensionResourceId(format('/subscriptions/{0}/resourceGroups/{1}', subscription().subscriptionId, resourceGroup().name), 'Microsoft.Resources/deployments', 'deploy_ai_foundry'), '2022-09-01').outputs.projectConnectionString.value]"
219239
}
220240
],
221241
"resources": {
@@ -354,7 +374,7 @@
354374
"_generator": {
355375
"name": "bicep",
356376
"version": "0.34.44.8038",
357-
"templateHash": "107965290127824528"
377+
"templateHash": "17863870312619064541"
358378
}
359379
},
360380
"parameters": {
@@ -453,6 +473,8 @@
453473
"name": "bicep",
454474
"version": "0.34.44.8038",
455475
"templateHash": "10664495342911727649"
476+
"version": "0.34.44.8038",
477+
"templateHash": "10664495342911727649"
456478
}
457479
},
458480
"parameters": {
@@ -590,7 +612,7 @@
590612
"_generator": {
591613
"name": "bicep",
592614
"version": "0.34.44.8038",
593-
"templateHash": "9573081501419024290"
615+
"templateHash": "8087543237770345715"
594616
}
595617
},
596618
"parameters": {
@@ -939,6 +961,10 @@
939961
"storageAccountId": {
940962
"type": "string",
941963
"value": "[resourceId('Microsoft.Storage/storageAccounts', variables('storageNameCleaned'))]"
964+
},
965+
"projectConnectionString": {
966+
"type": "string",
967+
"value": "[format('{0};{1};{2};{3}', split(reference(resourceId('Microsoft.MachineLearningServices/workspaces', variables('aiProjectName')), '2024-01-01-preview').discoveryUrl, '/')[2], subscription().subscriptionId, resourceGroup().name, variables('aiProjectName'))]"
942968
}
943969
}
944970
}

src/backend/sql_agents/agents/semantic_verifier/prompt.txt

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,5 +7,6 @@
77
- Do not hallucinate or assume any functionality that is not explicitly mentioned in the scripts.
88
- Avoid using any first person language in any of the output.
99
- You are allowed to make common sense assumptions about the backend data and the return types. of the sql queries.
10-
- If the scripts are not semantically equivalent, judgement would be 'Semantically Not Equivalent' and the differences would be listed in the 'differences' field.
11-
- If the scripts are semantically equivalent, judgement would be 'Semantically Equivalent' and the 'differences' field would be an empty list.
10+
- If the scripts are not semantically equivalent, judgement would be 'Semantically Not Equivalent' and the differences would be listed in the differences field.
11+
- If the scripts are semantically equivalent, judgement would be 'Semantically Equivalent' and the differences field would be an empty list.
12+
- Include a one sentence summary of your response at the end of each evaluation, in the summary field.
Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,13 @@
1-
from semantic_kernel.kernel_pydantic import KernelBaseModel
1+
"""SQL semantic verifier response models"""
2+
3+
from semantic_kernel.kernel_pydantic import KernelBaseModel
24

35

46
class SemanticVerifierResponse(KernelBaseModel):
57
"""
6-
Response model for the semantic verifier agent
7-
Args:
8-
analysis (str): The analysis of the SQL query.
9-
judgement (str): The judgement of the SQL query.
10-
differences (list[str]): List of differences found in the SQL query.
11-
summary (str): A one sentence summary of the response.
8+
Model for the response of the semantic verifier agent
129
"""
1310

14-
analysis: str
1511
judgement: str
1612
differences: list[str]
1713
summary: str

src/backend/sql_agents/convert_script.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
and updates the database with the results.
55
"""
66

7+
import asyncio
78
import json
89
import logging
910

@@ -65,6 +66,8 @@ async def convert_script(
6566
)
6667
carry_response = None
6768
async for response in chat.invoke():
69+
# TEMPORARY: awaiting bug fix for rate limits
70+
await asyncio.sleep(5)
6871
carry_response = response
6972
if response.role == AuthorRole.ASSISTANT.value:
7073
# Our process can terminate with either of these as the last response
@@ -120,6 +123,9 @@ async def convert_script(
120123
)
121124
current_migration = result.fixed_query
122125
case AgentType.SEMANTIC_VERIFIER.value:
126+
logger.info(
127+
"Semantic verifier agent response: %s", response.content
128+
)
123129
result = SemanticVerifierResponse.model_validate_json(
124130
response.content or ""
125131
)

src/backend/sql_agents/process_batch.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
It is the main entry point for the SQL migration process.
55
"""
66

7+
import asyncio
78
import logging
89

910
from azure.identity.aio import DefaultAzureCredential
@@ -124,6 +125,8 @@ async def process_batch_async(
124125
)
125126
else:
126127
await batch_service.update_file_counts(file["file_id"])
128+
# TEMPORARY: awaiting bug fix for rate limits
129+
await asyncio.sleep(5)
127130
except UnicodeDecodeError as ucde:
128131
logger.error("Error decoding file: %s", file)
129132
logger.error("Error decoding file. %s", ucde)

0 commit comments

Comments
 (0)