File tree Expand file tree Collapse file tree 1 file changed +12
-6
lines changed
articles/ai-services/agents/includes/azure-search Expand file tree Collapse file tree 1 file changed +12
-6
lines changed Original file line number Diff line number Diff line change @@ -85,13 +85,19 @@ Get the connection ID of the Azure AI Search connection in the project. You can
85
85
86
86
``` python
87
87
# AI Search resource connection ID
88
- # This code prints out the connection ID of all the Azure AI Search connections in the project
89
- # If you have more than one AI search connection, make sure to select the correct one that contains the index you want to use.
90
- conn_list = project_client.connections.list()
88
+ # This code looks for the AI Search Connection ID and saves it as variable conn_id
89
+
90
+ # If you have more than one AI search connection, try to establish the value in your .env file.
91
+ # Extract the connection list.
92
+ conn_list = project_client.connections._list_connections()[" value" ]
91
93
conn_id = " "
94
+
95
+ # Search in the metadata field of each connection in the list for the azure_ai_search type and get the id value to establish the variable
92
96
for conn in conn_list:
93
- if conn.connection_type == " AZURE_AI_SEARCH" :
94
- print (f " Connection ID: { conn.id} " )
97
+ metadata = conn[" properties" ].get(" metadata" , {})
98
+ if metadata.get(" type" , " " ).upper() == " AZURE_AI_SEARCH" :
99
+ conn_id = conn[" id" ]
100
+ break
95
101
```
96
102
# [ C#] ( #tab/csharp )
97
103
``` csharp
@@ -429,4 +435,4 @@ curl $AZURE_AI_AGENTS_ENDPOINT/threads/thread_abc123/messages?api-version=2024-1
429
435
- H " Authorization: Bearer $AZURE_AI_AGENTS_TOKEN"
430
436
` ` `
431
437
432
- ---
438
+ ---
You can’t perform that action at this time.
0 commit comments