Skip to content

Commit f013460

Browse files
fix aiServicesConnection issue and read model name from env in app.py
1 parent ce31524 commit f013460

File tree

3 files changed

+35
-59
lines changed

3 files changed

+35
-59
lines changed

infra/deploy_ai_foundry.bicep

Lines changed: 1 addition & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -371,7 +371,7 @@ resource aiHub 'Microsoft.MachineLearningServices/workspaces@2023-08-01-preview'
371371
resource aiServicesConnection 'connections@2024-07-01-preview' = {
372372
name: '${aiHubName}-connection-AzureOpenAI'
373373
properties: {
374-
category: 'AzureOpenAI'
374+
category: 'AIServices'
375375
target: aiServices.properties.endpoint
376376
authType: 'ApiKey'
377377
isSharedToAll: true
@@ -387,26 +387,6 @@ resource aiHub 'Microsoft.MachineLearningServices/workspaces@2023-08-01-preview'
387387
aiServicesDeployments,aiSearch
388388
]
389389
}
390-
391-
// resource aiServicesConnection_m 'connections@2024-07-01-preview' = {
392-
// name: '${aiHubName}-connection-AzureOpenAI_m'
393-
// properties: {
394-
// category: 'AIServices'
395-
// target: aiServices_m.properties.endpoint
396-
// authType: 'ApiKey'
397-
// isSharedToAll: true
398-
// credentials: {
399-
// key: aiServices_m.listKeys().key1
400-
// }
401-
// metadata: {
402-
// ApiType: 'Azure'
403-
// ResourceId: aiServices_m.id
404-
// }
405-
// }
406-
// dependsOn: [
407-
// aiServicesDeployments,aiSearch,aiServicesConnection
408-
// ]
409-
// }
410390

411391
resource aiSearchConnection 'connections@2024-07-01-preview' = {
412392
name: '${aiHubName}-connection-AzureAISearch'

infra/main.json

Lines changed: 30 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@
44
"metadata": {
55
"_generator": {
66
"name": "bicep",
7-
"version": "0.30.23.60470",
8-
"templateHash": "237990510880029303"
7+
"version": "0.33.93.31351",
8+
"templateHash": "8738349847337458840"
99
}
1010
},
1111
"parameters": {
@@ -125,8 +125,8 @@
125125
"metadata": {
126126
"_generator": {
127127
"name": "bicep",
128-
"version": "0.30.23.60470",
129-
"templateHash": "8775325455752085588"
128+
"version": "0.33.93.31351",
129+
"templateHash": "4123789684929590981"
130130
}
131131
},
132132
"parameters": {
@@ -217,8 +217,8 @@
217217
"metadata": {
218218
"_generator": {
219219
"name": "bicep",
220-
"version": "0.30.23.60470",
221-
"templateHash": "11860640957904055727"
220+
"version": "0.33.93.31351",
221+
"templateHash": "4388214478635448075"
222222
}
223223
},
224224
"parameters": {
@@ -361,8 +361,8 @@
361361
"metadata": {
362362
"_generator": {
363363
"name": "bicep",
364-
"version": "0.30.23.60470",
365-
"templateHash": "3506203473882985077"
364+
"version": "0.33.93.31351",
365+
"templateHash": "18123322246729358641"
366366
}
367367
},
368368
"parameters": {
@@ -464,7 +464,7 @@
464464
"apiVersion": "2024-07-01-preview",
465465
"name": "[format('{0}/{1}', variables('aiHubName'), format('{0}-connection-AzureOpenAI', variables('aiHubName')))]",
466466
"properties": {
467-
"category": "AzureOpenAI",
467+
"category": "AIServices",
468468
"target": "[reference(resourceId('Microsoft.CognitiveServices/accounts', variables('aiServicesName')), '2021-10-01').endpoint]",
469469
"authType": "ApiKey",
470470
"isSharedToAll": true,
@@ -1053,8 +1053,8 @@
10531053
"metadata": {
10541054
"_generator": {
10551055
"name": "bicep",
1056-
"version": "0.30.23.60470",
1057-
"templateHash": "16012222996233768636"
1056+
"version": "0.33.93.31351",
1057+
"templateHash": "1505719283486163574"
10581058
}
10591059
},
10601060
"parameters": {
@@ -1151,7 +1151,8 @@
11511151
"publicAccess": "None"
11521152
},
11531153
"dependsOn": [
1154-
"[resourceId('Microsoft.Storage/storageAccounts/blobServices', parameters('saName'), 'default')]"
1154+
"[resourceId('Microsoft.Storage/storageAccounts/blobServices', parameters('saName'), 'default')]",
1155+
"[resourceId('Microsoft.Storage/storageAccounts', parameters('saName'))]"
11551156
]
11561157
},
11571158
{
@@ -1236,8 +1237,8 @@
12361237
"metadata": {
12371238
"_generator": {
12381239
"name": "bicep",
1239-
"version": "0.30.23.60470",
1240-
"templateHash": "16978185825890155480"
1240+
"version": "0.33.93.31351",
1241+
"templateHash": "3100365088410602500"
12411242
}
12421243
},
12431244
"parameters": {
@@ -1284,7 +1285,7 @@
12841285
"resources": [
12851286
{
12861287
"copy": {
1287-
"name": "list",
1288+
"name": "database::list",
12881289
"count": "[length(variables('containers'))]"
12891290
},
12901291
"type": "Microsoft.DocumentDB/databaseAccounts/sqlDatabases/containers",
@@ -1442,8 +1443,8 @@
14421443
"metadata": {
14431444
"_generator": {
14441445
"name": "bicep",
1445-
"version": "0.30.23.60470",
1446-
"templateHash": "15098887909027168557"
1446+
"version": "0.33.93.31351",
1447+
"templateHash": "6170430466600233564"
14471448
}
14481449
},
14491450
"parameters": {
@@ -1616,8 +1617,8 @@
16161617
"metadata": {
16171618
"_generator": {
16181619
"name": "bicep",
1619-
"version": "0.30.23.60470",
1620-
"templateHash": "17839258927315286319"
1620+
"version": "0.33.93.31351",
1621+
"templateHash": "509460209037223451"
16211622
}
16221623
},
16231624
"parameters": {
@@ -1699,8 +1700,8 @@
16991700
"metadata": {
17001701
"_generator": {
17011702
"name": "bicep",
1702-
"version": "0.30.23.60470",
1703-
"templateHash": "791776652570337614"
1703+
"version": "0.33.93.31351",
1704+
"templateHash": "16955379019952955448"
17041705
}
17051706
},
17061707
"parameters": {
@@ -1795,8 +1796,8 @@
17951796
"metadata": {
17961797
"_generator": {
17971798
"name": "bicep",
1798-
"version": "0.30.23.60470",
1799-
"templateHash": "9921196024510733075"
1799+
"version": "0.33.93.31351",
1800+
"templateHash": "11218339316665984116"
18001801
}
18011802
},
18021803
"parameters": {
@@ -2031,8 +2032,8 @@
20312032
"metadata": {
20322033
"_generator": {
20332034
"name": "bicep",
2034-
"version": "0.30.23.60470",
2035-
"templateHash": "5998444423979411260"
2035+
"version": "0.33.93.31351",
2036+
"templateHash": "13267579186151664804"
20362037
}
20372038
},
20382039
"parameters": {
@@ -2285,8 +2286,8 @@
22852286
"metadata": {
22862287
"_generator": {
22872288
"name": "bicep",
2288-
"version": "0.30.23.60470",
2289-
"templateHash": "6322893930132489795"
2289+
"version": "0.33.93.31351",
2290+
"templateHash": "11904916764630875140"
22902291
}
22912292
},
22922293
"parameters": {
@@ -2412,8 +2413,8 @@
24122413
"metadata": {
24132414
"_generator": {
24142415
"name": "bicep",
2415-
"version": "0.30.23.60470",
2416-
"templateHash": "7158665245075871559"
2416+
"version": "0.33.93.31351",
2417+
"templateHash": "17494211244945916977"
24172418
}
24182419
},
24192420
"parameters": {

src/App/app.py

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -209,15 +209,10 @@ def process_rag_response(rag_response, query):
209209
"""
210210

211211
try:
212-
# Fetch API URL and key from environment variables
213-
AZURE_OPENAI_ENDPOINT = os.getenv("AZURE_OPENAI_ENDPOINT")
214-
API_KEY = os.getenv("AZURE_OPENAI_API_KEY")
215-
logger.info(f">>>AZURE_OPENAI_ENDPOINT: {AZURE_OPENAI_ENDPOINT}")
216-
217-
endpoint = AZURE_OPENAI_ENDPOINT # os.environ.get("AZURE_OPEN_AI_ENDPOINT")
218-
api_key = API_KEY # os.environ.get("AZURE_OPEN_AI_API_KEY")
219-
api_version = "2024-05-01-preview" # os.environ.get("OPENAI_API_VERSION")
220-
deployment = "gpt-4o-mini" # os.environ.get("AZURE_OPEN_AI_DEPLOYMENT_MODEL")
212+
endpoint = AZURE_OPENAI_ENDPOINT
213+
api_key = AZURE_OPENAI_API_KEY
214+
api_version = AZURE_OPENAI_PREVIEW_API_VERSION
215+
deployment = AZURE_OPENAI_DEPLOYMENT_NAME
221216

222217
# "2023-09-01-preview"
223218
client = openai.AzureOpenAI(

0 commit comments

Comments
 (0)