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/search/search-get-started-rag.md
+26-22Lines changed: 26 additions & 22 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -41,17 +41,24 @@ Requests to the search endpoint must be authenticated and authorized. You can us
41
41
42
42
1. On the System assigned tab, set status to **On**.
43
43
44
-
1. Configure Azure AI Search for role-based access and assign roles:
44
+
1. Configure Azure AI Search for role-based access:
45
45
46
46
1. In the Azure portal, find your Azure AI Search service.
47
47
48
48
1. On the left menu, select **Settings** > **Keys**, and then select either **Role-based access control** or **Both**.
49
49
50
50
1. On the left menu, select **Access control (IAM)**.
51
51
52
-
1.Add the following role assignments for the Azure OpenAI managed identity: **Search Index Data Reader**, **Search Service Contributor**.
52
+
1.Assign roles:
53
53
54
-
1. Assign yourself to the **Cognitive Services OpenAI User** role on Azure OpenAI. This is the only role you need for query workloads.
54
+
1. Add the following role assignments for the Azure OpenAI managed identity:
55
+
56
+
-**Search Index Data Reader**
57
+
-**Search Service Contributor**
58
+
59
+
1. Assign yourself to a role on Azure OpenAI. In this quickstart, the requests to Azure OpenAI are sent on your behalf:
60
+
61
+
-**Cognitive Services OpenAI User**
55
62
56
63
It can take several minutes for permissions to take effect.
57
64
@@ -140,11 +147,10 @@ This section uses Visual Studio Code and Python to call the chat APIs on Azure O
140
147
AZURE_DEPLOYMENT_MODEL: str="gpt-35-turbo"
141
148
```
142
149
143
-
1.Specify query parameters. The query is a keyword search using semantic ranking. The searchengine returns up to 50 matches, but the model returns just the top 5 in the response. If you can't enable semantic ranking on your search service, set the value to false.
150
+
1.Run the following code to set query parameters. The query is a keyword search using semantic ranking. In a keyword search, the search engine returns up to 50 matches, but only the top 5 are provided to the model. If you can't enable semantic ranking on your search service, set the value to false.
144
151
145
152
```python
146
153
# Set query parameters for grounding the conversation on your search index
147
-
k=50
148
154
search_type="text"
149
155
use_semantic_reranker=True
150
156
sources_to_include=5
@@ -157,7 +163,6 @@ This section uses Visual Studio Code and Python to call the chat APIs on Azure O
157
163
from azure.core.credentials_async import AsyncTokenCredential
158
164
from azure.identity.aio import get_bearer_token_provider
159
165
from azure.search.documents.aio import SearchClient
160
-
from azure.search.documents.models import VectorizableTextQuery, HybridSearch
161
166
from openai import AsyncAzureOpenAI
162
167
from enum import Enum
163
168
from typing import List, Optional
@@ -184,7 +189,7 @@ This section uses Visual Studio Code and Python to call the chat APIs on Azure O
184
189
HYBRID="hybrid"
185
190
186
191
# This function retrieves the selected fields from the search index
Output isfrom Azure OpenAI, and it consists of recommendations for several hotels. Here's an example of what the output might look like:
269
-
270
-
```
271
-
Based on your criteria, we recommend the following hotels:
272
-
273
-
- Contoso Ocean Motel: located right on the beach and has private balconies with ocean views. They also have indoor and outdoor pools. It's located on the boardwalk near shops and art entertainment.
274
-
- Northwind Plaza & Suites: offers ocean views, free Wi-Fi, full kitchen, and a free breakfast buffet. Although not directly on the beach, this hotel has great views andis near the aquarium. They also have a pool.
272
+
Output isfrom Azure OpenAI, and it consists of recommendations for several hotels. Here's an example of what the output might look like:
275
273
276
-
Several other hotels have views and water features, but do not offer beach access or views of the ocean.
277
-
```
274
+
```
275
+
Based on your criteria, we recommend the following hotels:
276
+
277
+
- Contoso Ocean Motel: located right on the beach and has private balconies with ocean views. They also have indoor and outdoor pools. It's located on the boardwalk near shops and art entertainment.
278
+
- Northwind Plaza & Suites: offers ocean views, free Wi-Fi, full kitchen, and a free breakfast buffet. Although not directly on the beach, this hotel has great views andis near the aquarium. They also have a pool.
279
+
280
+
Several other hotels have views and water features, but do not offer beach access or views of the ocean.
281
+
```
278
282
279
-
To experiment further, change the query and rerun the last step to better understand how the model works with your data.
283
+
To experiment further, change the query and rerun the last step to better understand how the model works with your data.
280
284
281
-
You can also modify the prompt to change the tone or structure of the output.
285
+
You can also modify the prompt to change the tone or structure of the output.
0 commit comments