You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: articles/ai-foundry/agents/concepts/threads-runs-messages.md
+1-1Lines changed: 1 addition & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -19,7 +19,7 @@ Azure AI Foundry Agent Service supports persistent threads, runs, and messages,
19
19
20
20
When you use an Agent, there are a series of steps that are involved.
21
21
22
-
-**Creating an agent:** You create an agent to start sending messages and recieving responses.
22
+
-**Creating an agent:** You create an agent to start sending messages and receiving responses.
23
23
-**Creating a thread:** You create a thread once and append messages to it as users reply. This ensures that the conversation history is maintained and managed automatically.
24
24
-**Sending messages:** Messages can be sent by both the agent and the user. These messages can include text, images, and other files, providing a rich interaction experience.
25
25
-**Running the agent:** When a run is initiated, the agent processes the messages in the thread and performs tasks based on its configuration. It may append new messages to the thread as part of its response.
# Use an existing AI Search index with the Azure AI Search tool
16
16
17
-
Use an existing Azure AI Search index with the agent's Azure AI Search tool.
17
+
You can use an existing Azure AI Search index with the agent's Azure AI Search tool.
18
18
19
-
> [!NOTE]
20
-
> Azure AI Search indexes must meet the following requirements:
21
-
> - The index must contain at least one searchable & retrievable text field (type Edm.String)
22
-
> - The index must contain at least one searchable vector field (type Collection(Edm.Single))
23
-
> - The index is assumed to be configured properly
19
+
> [!TIP]
20
+
> You can create a new index without leaving the Azure AI Foundry portal. For more information, see the [Add the Azure AI Search tool to an agent](#add-the-azure-ai-search-tool-to-an-agent) section.
21
+
22
+
Azure AI Search indexes must be configured properly and meet the following requirements:
23
+
- The index must contain at least one searchable & retrievable text field (type Edm.String)
24
+
- The index must contain at least one searchable vector field (type Collection(Edm.Single))
24
25
25
26
## Search types
27
+
26
28
You can specify the search type for your index by choosing one of the following
27
29
- Simple
28
30
- Semantic
29
31
- Vector
30
32
- Hybrid (Vector + Keyword)
31
33
- Hybrid (Vector + Keyword + Semantic)
32
34
33
-
34
-
**Indexes without a specified search type**
35
-
- By default, the Azure AI Search tool runs a hybrid search (keyword + vector) on all text fields
35
+
You can have indexes without a specified search type. By default, the Azure AI Search tool runs a hybrid search (keyword + vector) on all text fields.
36
36
37
37
## Usage support
38
38
@@ -47,7 +47,7 @@ A prerequisite of using the Azure AI Search tool is to have an existing Azure AI
47
47
-[Quickstart: Create a vector index with the import and vectorize data wizard in the Azure portal](../../../../search\search-get-started-portal-import-vectors.md)
48
48
49
49
### Create a project connection to the Azure AI Search resource with the index you want to use
50
-
Once you have completed the agent setup, you must create a project connection to the Azure AI Search resource that contains the index you want to use.
50
+
Once you complete the agent setup, you must create a project connection to the Azure AI Search resource that contains the index you want to use.
51
51
52
52
If you already connected the AI Search resource that contains the index you want to use to your project, skip this step.
53
53
@@ -56,13 +56,13 @@ If you already connected the AI Search resource that contains the index you want
56
56
- In the Azure portal, navigate to the AI Search resource that contains the index you want to use.
57
57
2. Copy the connection endpoint.
58
58
- In the Overview tab, copy the URL of your resource. The URL should be in the format `https://<your-resource-name>.search.windows.net/`.
59
-
:::image type="content" source="../../media\tools\ai-search\connection-endpoint.png" alt-text="A screenshot of an AI Search resource Overview tab in the Azure portal." lightbox="../../media\tools\ai-search\connection-endpoint.png":::
59
+
:::image type="content" source="../../media/tools/ai-search\connection-endpoint.png" alt-text="A screenshot of an AI Search resource Overview tab in the Azure portal." lightbox="../../media/tools/ai-search\connection-endpoint.png":::
60
60
61
61
3. Verify API Access control is set to **Both** and copy one of the keys under **Manage admin keys**.
62
62
- From the left-hand navigation bar, scroll down to the Settings section and select **Keys**.
63
63
- Under the **API Access Control** section, ensure the option **Both** API key and Role-based access control is selected.
64
64
- If you want the connection to use API Keys for authentication, copy one of the keys under **Manage admin keys**.
65
-
:::image type="content" source="../../media\tools\ai-search\azure-portal.png" alt-text="A screenshot of an AI Search resource Keys tab in the Azure portal." lightbox="../../media\tools\ai-search\azure-portal.png":::
65
+
:::image type="content" source="../../media/tools/ai-search\azure-portal.png" alt-text="A screenshot of an AI Search resource Keys tab in the Azure portal." lightbox="../../media/tools/ai-search\azure-portal.png":::
66
66
67
67
#### Create an Azure AI Search project connection
68
68
If you use Microsoft Entra ID for the connection authentication type, you need to manually assign the project managed identity the roles Search Index Data Contributor and Search Service Contributor to the Azure AI Search resource. The connection **name** must be the AI Search **index** name.
@@ -71,32 +71,37 @@ If you use Microsoft Entra ID for the connection authentication type, you need t
71
71
72
72
**Create the following connections.yml file**
73
73
74
+
You can use either an API key or keyless YAML configuration file. Replace the ```name```, ```endpoint```, and ```api_key``` placeholders with your Azure AI Search resource values. For more information on the YAML configuration file, see the [Azure AI Search connection YAML schema](../../../../machine-learning\reference-yaml-connection-ai-search.md).
74
75
75
-
You can use either an API key or credential-less YAML configuration file. Replace the placeholders for ```name```, ```endpoint``` and ```api_key``` with your Azure AI Search resource values. For more information on the YAML configuration file, see the [Azure AI Search connection YAML schema](../../../../machine-learning\reference-yaml-connection-ai-search.md).
76
-
- API Key example:
76
+
Here's an API Key example:
77
77
78
-
```yml
79
-
name: my_project_acs_connection_keys
80
-
type: azure_ai_search
81
-
endpoint: https://contoso.search.windows.net/
82
-
api_key: XXXXXXXXXXXXXXX
83
-
```
78
+
```yml
79
+
name: my_project_acs_connection_keys
80
+
type: azure_ai_search
81
+
endpoint: https://contoso.search.windows.net/
82
+
api_key: XXXXXXXXXXXXXXX
83
+
```
84
84
85
-
- Credential-less
85
+
Here's a keyless example:
86
+
87
+
```yml
88
+
name: my_project_acs_connection_credentialless
89
+
type: azure_ai_search
90
+
endpoint: https://contoso.search.windows.net/
91
+
```
86
92
87
-
```yml
88
-
name: my_project_acs_connection_credentialless
89
-
type: azure_ai_search
90
-
endpoint: https://contoso.search.windows.net/
91
-
```
92
93
**Then, run the following command:**
93
94
94
95
Replace ```my_resource``` and ```my_project_name``` with your resource group and project name created in the agent setup.
96
+
95
97
```azurecli
96
98
az ml connection create --file {connection.yml} --resource-group {my_resource_group} --workspace-name {my_project_name}
97
99
```
100
+
98
101
# [Python](#tab/pythonsdk)
99
-
Replace the placeholders ```my_connection_name```, ```my_endpoint```, and ```my_key``` (optional) with your Azure AI Search connection details and run the following code to create a project connection to your Azure AI Search resource.
102
+
103
+
To create a project connection to your Azure AI Search resource, replace the ```my_connection_name```, ```my_endpoint```, and ```my_key``` (optional) placeholders with your Azure AI Search connection details and run the following code:
104
+
100
105
```python
101
106
from azure.ai.ml.entities import AzureAISearchConnection
1. In Azure AI Foundry, navigate to the project you created in the agent setup. Click on **Open in management center**.
118
-
:::image type="content" source="../../media\tools\ai-search\project-studio.png" alt-text="A screenshot of a project in Azure AI Foundry." lightbox="../../media\tools\ai-search\project-studio.png":::
119
122
120
-
2. Click on the **Connections** tab and select **Add Connection**.
121
-
:::image type="content" source="../../media\tools\ai-search\project-connections-page.png" alt-text="A screenshot of the project connections page." lightbox="../../media\tools\ai-search\project-connections-page.png":::
123
+
1. In Azure AI Foundry, navigate to the project you created in the agent setup. Select **Open in management center**.
124
+
:::image type="content" source="../../media/tools/ai-search\project-studio.png" alt-text="A screenshot of a project in Azure AI Foundry." lightbox="../../media/tools/ai-search\project-studio.png":::
125
+
126
+
1. Select the **Connections** tab and then select **Add Connection**.
127
+
:::image type="content" source="../../media/tools/ai-search\project-connections-page.png" alt-text="A screenshot of the project connections page." lightbox="../../media/tools/ai-search\project-connections-page.png":::
122
128
123
-
3. Select **Azure AI Search**.
124
-
:::image type="content" source="../../media\tools\ai-search\select.png" alt-text="A screenshot of the Azure AI Search connection type the user should select." lightbox="../../media\tools\ai-search\select.png":::
129
+
1. Select **Azure AI Search**.
130
+
:::image type="content" source="../../media/tools/ai-search\select.png" alt-text="A screenshot of the Azure AI Search connection type the user should select." lightbox="../../media/tools/ai-search\select.png":::
125
131
126
-
4. Provide the required connection details for the Azure AI Search resource you want to use. Both Managed Identity and Key-based authentication are supported. Once all the fields are filled in, click **Add connection**.
127
-
:::image type="content" source="../../media\tools\ai-search\connection-2.png" alt-text="A screenshot the required fields to add a new Azure AI Search connection." lightbox="../../media\tools\ai-search\connection-2.png":::
132
+
1. Provide the required connection details for the Azure AI Search resource you want to use. Both Managed Identity and Key-based authentication are supported. Once all the fields are filled in, select **Add connection**.
133
+
:::image type="content" source="../../media/tools/ai-search\connection-2.png" alt-text="A screenshot the required fields to add a new Azure AI Search connection." lightbox="../../media/tools/ai-search\connection-2.png":::
128
134
129
-
5. Verify that the connection was successfully created and now appears in the project's Connections tab.
130
-
:::image type="content" source="../../media\tools\ai-search\success-connection.png" alt-text="A screenshot of the project connections page with a new Azure AI Search connection added." lightbox="../../media\tools\ai-search\success-connection.png":::
135
+
1. Verify that the connection was successfully created and now appears in the project's Connections tab.
136
+
:::image type="content" source="../../media/tools/ai-search\success-connection.png" alt-text="A screenshot of the project connections page with a new Azure AI Search connection added." lightbox="../../media/tools/ai-search\success-connection.png":::
131
137
---
132
138
133
-
Now that you have created a project connection to your Azure AI Search resource, you can configure and start using the Azure AI Search tool with the SDK. See the code examples tab to get started.
139
+
Now that you created a project connection to your Azure AI Search resource, you can configure and start using the Azure AI Search tool with the SDK. See the code examples tab to get started.
134
140
135
141
-------------------------
136
142
## Add the Azure AI Search tool to an agent
137
143
138
144
You can add the Azure AI Search tool to an agent programmatically using the code examples listed at the top of this article, or the Azure AI Foundry portal. If you want to use the portal:
139
145
140
-
1. In the **Agents** screen for your agent, scroll down the **Setup** pane on the right to **knowledge**. Then select **Add**.
146
+
1. In the **Agents** screen for your agent, scroll down the **Setup** pane. Then select **Knowledge** > **+ Add**.
147
+
148
+
:::image type="content" source="../../media/tools/knowledge-tools.png" alt-text="A screenshot showing the available tool categories in the Azure AI Foundry portal." lightbox="../../media/tools/knowledge-tools.png":::
149
+
150
+
1. Select **Azure AI Search**.
151
+
152
+
:::image type="content" source="../../media/tools/knowledge-tools-list.png" alt-text="A screenshot showing the available knowledge tools in the Azure AI Foundry portal." lightbox="../../media/tools/knowledge-tools-list.png":::
153
+
154
+
1. Under **Connect to an index**, you can either select an existing Azure AI Search connection or create a new one. Let's select **Indexes that are not part of this project**.
155
+
1. Select an existing Azure AI Search connection. You can create a new one in the Azure portal and then return to this wizard.
156
+
1. After you select the connection, you can select or create an index to use with the Azure AI Search tool. Let's select **Create a new index**.
157
+
158
+
> [!TIP]
159
+
> You can create a new index without leaving the Azure AI Foundry portal. If you select **Create a new index**, you're prompted to provide the index name and select the search type.
160
+
161
+
:::image type="content" source="../../media/tools/knowledge-tools-ai-search-connect-index.png" alt-text="A screenshot with the option to connect to an index that doesn't yet exist in the project." lightbox="../../media/tools/knowledge-tools-ai-search-connect-index.png":::
141
162
142
-
:::image type="content" source="../../media\tools\knowledge-tools.png" alt-text="A screenshot showing the available tool categories in the Azure AI Foundry portal." lightbox="../../media\tools\knowledge-tools.png":::
163
+
1. Enter the index name, connect your data, choose an embedding model, and agree to the terms. Then select **Create index**.
143
164
144
-
1. Select **Azure AI Search** and follow the prompts to add the tool.
165
+
:::image type="content" source="../../media/tools/knowledge-tools-ai-search-create-index.png" alt-text="A screenshot with the option to create a new index in the Azure AI Foundry portal." lightbox="../../media/tools/knowledge-tools-ai-search-create-index.png":::
145
166
146
-
:::image type="content" source="../../media\tools\knowledge-tools-list.png" alt-text="A screenshot showing the available knowledge tools in the Azure AI Foundry portal." lightbox="../../media\tools\knowledge-tools-list.png":::
167
+
1. The index is created and connected to the [Azure AI Search](/azure/search/) service. You can now use the index with the Azure AI Search tool in your agent. You can also use the index outside of the agent, such as the Azure AI Search REST API or SDKs.
0 commit comments