Skip to content

Commit 4bdc418

Browse files
committed
Tested configuration and updated steps
1 parent 33e02cf commit 4bdc418

File tree

2 files changed

+27
-20
lines changed

2 files changed

+27
-20
lines changed

articles/search/search-get-started-rag.md

Lines changed: 26 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ This quickstart shows you how to send queries to a Large Language Model (LLM) fo
1717

1818
- An Azure subscription. [Create one for free](https://azure.microsoft.com/free/).
1919

20-
- [Azure AI Search](search-create-service-portal.md), on any tier. Region must be the same one used for Azure OpenAI.
20+
- [Azure AI Search](search-create-service-portal.md), Basic tier or higher so that you can [enable semantic ranking](semantic-how-to-enable-disable.md). Region must be the same one used for Azure OpenAI.
2121

2222
- [Azure OpenAI](https://aka.ms/oai/access) resource with a deployment of `gpt-35-turbo`, `gpt-4`, or equivalent model, in the same region as Azure AI Search.
2323

@@ -33,24 +33,30 @@ You can also start a new file on your local system and create requests manually
3333

3434
Requests to the search endpoint must be authenticated and authorized. You can use API keys or roles for this task. Keys are easier to start with, but roles are more secure. This quickstart assumes roles.
3535

36-
1. Configure Azure OpenAI to use a system-assigned managed identity.
37-
1. In the Azure portal, find your Azure OpenAI resource.
38-
1. On the left menu, select **Resource management** > **Identity**.
39-
1. On the System assigned tab, set status to **On**.
36+
1. Configure Azure OpenAI to use a system-assigned managed identity:
37+
1. In the Azure portal, find your Azure OpenAI resource.
38+
1. On the left menu, select **Resource management** > **Identity**.
39+
1. On the System assigned tab, set status to **On**.
4040

41-
1. Grant Azure OpenAI permission to access Azure AI Search:
42-
1. In the Azure portal, find your Azure AI Search service.
43-
1. On the left menu, select **Access control (IAM)**.
44-
1. Add the following role assignments for Azure OpenAI managed identity: Search Index Data Reader
45-
You only need data reader for this quickstart because this scenario is limited to query operations.
41+
1. Configure Azure AI Search for role-based access and assign roles:
42+
1. In the Azure portal, find your Azure AI Search service.
43+
1. On the left menu, select **Settings** > **Keys**, and then select either **Role-based access control** or **Both**.
44+
1. On the left menu, select **Access control (IAM)**.
45+
1. Add the following role assignments for the Azure OpenAI managed identity: **Search Index Data Reader**
46+
47+
You only need data reader for this quickstart because this scenario is limited to query operations.
48+
49+
1. Assign yourself to the **Cognitive Services OpenAI User** role on Azure OpenAI. This is the only role you need for query workloads.
50+
51+
It can take several minutes for permissions to take effect.
4652

4753
## Create an index
4854

4955
We recommend the hotels-sample-index, which can be created in minutes and runs on any search service tier. This index is created using built-in sample data.
5056

5157
1. In the Azure portal, find your search service.
5258

53-
1. On the **Overview** home page, select **Import data** at the top to start the wizard.
59+
1. On the **Overview** home page, select [**Import data**](search-get-started-portal.md) to start the wizard.
5460

5561
1. On the **Connect to your data** page, select **Samples** from the dropdown list.
5662

@@ -119,13 +125,11 @@ We recommend the hotels-sample-index, which can be created in minutes and runs o
119125

120126
1. [Find your search service](https://portal.azure.com/#blade/HubsExtension/BrowseResourceBlade/resourceType/Microsoft.Search%2FsearchServices).
121127

122-
1. On the **Overview** home page, copy the URL. An example endpoint might look like `https://mydemo.search.windows.net`.
123-
124-
:::image type="content" source="media/search-get-started-rest/get-endpoint.png" lightbox="media/search-get-started-rest/get-endpoint.png" alt-text="Screenshot of the URL property on the overview page.":::
128+
1. On the **Overview** home page, copy the URL. An example endpoint might look like `https://example.search.windows.net`.
125129

126130
1. [Find your Azure OpenAI service](https://portal.azure.com/#blade/HubsExtension/BrowseResourceBlade/resourceType/Microsoft.CognitiveServices%2Faccounts).
127131

128-
1. On the **Overview** home page, select the link to view the endpoints. Copy the URL.
132+
1. On the **Overview** home page, select the link to view the endpoints. Copy the URL. An example endpoint might look like `https://example.openai.azure.com/`.
129133

130134
## Set up the query and chat thread
131135

@@ -139,15 +143,15 @@ This section uses Visual Studio Code and Python to call the chat APIs on Azure O
139143
! pip install openai --quiet
140144
```
141145

142-
1. Set the following variables, substituting placeholders with valid values.
146+
1. Set the following variables, substituting placeholders with the endpoints you collected in the previous step.
143147

144148
```python
145149
AZURE_SEARCH_SERVICE: str = "PUT YOUR SEARCH SERVICE ENDPOINT HERE"
146150
AZURE_OPENAI_ACCOUNT: str = "PUT YOUR AZURE OPENAI ENDPOINT HERE"
147151
AZURE_DEPLOYMENT_MODEL: str = "gpt-35-turbo"
148152
```
149153

150-
1. Specify query parameters. The query is a keyword search using semantic ranking. The search engine returns up to 50 matches, but the model returns just the top 5 in the response.
154+
1. Specify query parameters. The query is a keyword search using semantic ranking. The search engine 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.
151155

152156
```python
153157
# Set query parameters for grounding the conversation on your search index
@@ -157,7 +161,7 @@ This section uses Visual Studio Code and Python to call the chat APIs on Azure O
157161
sources_to_include=5
158162
```
159163

160-
1. Set up clients, functions, prompts, and chat thread. The function retrieves selected fields from the search index.
164+
1. Set up clients, a search functions prompts, and a chat. The function retrieves selected fields from the search index.
161165

162166
```python
163167
# Set up the query for generating responses
@@ -202,6 +206,7 @@ This section uses Visual Studio Code and Python to call the chat APIs on Azure O
202206

203207
return [ document async for document in response ]
204208

209+
# This prompt provides instructions to the model
205210
GROUNDED_PROMPT="""
206211
You are a friendly assistant that recommends hotels based on activities and amenities.
207212
Answer the query using only the sources provided below in a friendly and concise bulleted manner.
@@ -211,6 +216,8 @@ This section uses Visual Studio Code and Python to call the chat APIs on Azure O
211216
Query: {query}
212217
Sources:\n{sources}
213218
"""
219+
220+
# This class instantiates the chat
214221
class ChatThread:
215222
def __init__(self):
216223
self.messages = []
@@ -248,7 +255,7 @@ This section uses Visual Studio Code and Python to call the chat APIs on Azure O
248255
return self.search_results[-1]["sources"] if len(self.search_results) > 0 else None
249256
```
250257

251-
1. Invoke the chat thread and call the query function, passing in a query string to search for.
258+
1. Invoke the chat and call the search function, passing in a query string to search for.
252259

253260
```python
254261
import azure.identity.aio

articles/search/semantic-how-to-enable-disable.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ Follow these steps to enable [semantic ranker](semantic-search-overview.md) at t
3131

3232
1. Navigate to your search service. On the **Overview** page, make sure the service is a billable tier, Basic or higher.
3333

34-
1. On the left-nav pane, select **Semantic ranking**.
34+
1. On the left-nav pane, select **Settings** > **Semantic ranking**.
3535

3636
1. Select either the **Free plan** or the **Standard plan**. You can switch between the free plan and the standard plan at any time.
3737

0 commit comments

Comments
 (0)