Skip to content

Commit 1d9a3f8

Browse files
Merge pull request #5526 from glharper/patch-1
[AI Agents] update AI Search Python code
2 parents 55d1538 + ca1366f commit 1d9a3f8

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

articles/ai-services/agents/how-to/tools/azure-ai-search-samples.md

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,9 +58,12 @@ Using the connection ID of your Azure AI Search resource, configure the Azure AI
5858

5959
```python
6060
from azure.ai.agents.models import AzureAISearchTool, AzureAISearchQueryType
61+
from azure.ai.projects.models import ConnectionType
6162

6263
# Define the Azure AI Search connection ID and index name
63-
azure_ai_conn_id = os.environ["AZURE_AI_CONNECTION_ID"]
64+
azure_ai_conn_id = project_client.connections.get_default(ConnectionType.AZURE_AI_SEARCH).id
65+
66+
# find the index name in your AI Search Azure resource page under Search Management -> Indexes
6467
index_name = "sample_index"
6568

6669
# Initialize the Azure AI Search tool

0 commit comments

Comments
 (0)