|
6 | 6 | "source": [ |
7 | 7 | "# RAG Quickstart for Azure AI Search\n", |
8 | 8 | "\n", |
9 | | - "This quickstart provides a query for RAG scenarios. It demonstrates a approach for grounding chat queries with data in a search index on Azure AI Search.\n", |
| 9 | + "This quickstart provides a query for RAG scenarios. It demonstrates an approach for grounding chat queries with data in a search index on Azure AI Search.\n", |
10 | 10 | "\n", |
11 | 11 | "We took a few shortcuts to keep the exercise basic and focused on query definitions:\n", |
12 | 12 | "\n", |
|
24 | 24 | "source": [ |
25 | 25 | "## Prerequisites\n", |
26 | 26 | "\n", |
27 | | - "- Azure AI Search, any tier\n", |
| 27 | + "- Azure AI Search, Basic tier or higher is recommended. Enable semantic ranking and role-based access control.\n", |
28 | 28 | "\n", |
29 | | - "- Azure OpenAI, in the same region as Azure AI Search\n", |
| 29 | + "- Azure OpenAI, in the same region as Azure AI Search. Configure Azure OpenAI to use a system managed identity.\n", |
30 | 30 | "\n", |
31 | | - "- Deployment GPT-3.5-Turbo, GPT-4, or equivalent LLM\n", |
| 31 | + "- Deployment GPT-3.5-Turbo, GPT-4, or equivalent LLM.\n", |
32 | 32 | "\n", |
33 | | - "### Configuration requirements\n", |
34 | | - "\n", |
35 | | - "Use the Azure portal for these steps.\n", |
36 | | - "\n", |
37 | | - "1. Configure Azure OpenAI to use a system-assigned managed identity.\n", |
38 | | - "\n", |
39 | | - "1. Configure Azure AI Search to use a system-assigned managed identity.\n", |
40 | | - "\n", |
41 | | - "1. Create the hotels-sample-index using the Import data wizard.\n", |
42 | | - "\n", |
43 | | - "1. Add a semantic configuration named \"semantic-config\" and make it the default configuration:\n", |
| 33 | + "- Create the hotels-sample-index using [this quickstart](https://learn.microsoft.com/azure/search/search-get-started-portal), and then modify it to use this semantic configuration:\n", |
44 | 34 | " \n", |
45 | 35 | " ```json\n", |
46 | 36 | " \"semantic\": {\n", |
|
58 | 48 | " }]},\n", |
59 | 49 | " ```\n", |
60 | 50 | "\n", |
61 | | - "1. On Azure AI Search, create a role assignment for the Azure OpenAI managed identity. Required roles: Search Index Data Reader, Search Service Contributor.\n", |
| 51 | + "- On Azure AI Search, create a role assignment for the Azure OpenAI managed identity. Required roles: Search Index Data Reader, Search Service Contributor.\n", |
62 | 52 | "\n", |
63 | | - "1. On Azure OpenAI, create a role assigmnet for the user running the code: Required role: Cognitive Services OpenAI User." |
| 53 | + "- On Azure OpenAI, create a role assigmnet for the user running the code: Required role: Cognitive Services OpenAI User." |
64 | 54 | ] |
65 | 55 | }, |
66 | 56 | { |
67 | 57 | "cell_type": "code", |
68 | | - "execution_count": 1, |
| 58 | + "execution_count": null, |
69 | 59 | "metadata": {}, |
70 | 60 | "outputs": [], |
71 | 61 | "source": [ |
|
77 | 67 | }, |
78 | 68 | { |
79 | 69 | "cell_type": "code", |
80 | | - "execution_count": 2, |
| 70 | + "execution_count": null, |
81 | 71 | "metadata": {}, |
82 | 72 | "outputs": [], |
83 | 73 | "source": [ |
|
89 | 79 | }, |
90 | 80 | { |
91 | 81 | "cell_type": "code", |
92 | | - "execution_count": 3, |
| 82 | + "execution_count": null, |
93 | 83 | "metadata": {}, |
94 | 84 | "outputs": [], |
95 | 85 | "source": [ |
|
102 | 92 | }, |
103 | 93 | { |
104 | 94 | "cell_type": "code", |
105 | | - "execution_count": 11, |
| 95 | + "execution_count": null, |
106 | 96 | "metadata": {}, |
107 | 97 | "outputs": [], |
108 | 98 | "source": [ |
109 | | - "# Set up the query for generating responses\n", |
| 99 | + "# Set up the clients, define a chat instance, create a search function\n", |
110 | 100 | "from azure.core.credentials_async import AsyncTokenCredential\n", |
111 | 101 | "from azure.identity.aio import get_bearer_token_provider\n", |
112 | 102 | "from azure.search.documents.aio import SearchClient\n", |
|
131 | 121 | " credential=credential\n", |
132 | 122 | " )\n", |
133 | 123 | "\n", |
134 | | - "# This quickstart is only using text at the moment\n", |
| 124 | + "# This quickstart is only using text at this time\n", |
135 | 125 | "class SearchType(Enum):\n", |
136 | 126 | " TEXT = \"text\"\n", |
137 | 127 | " VECTOR = \"vector\"\n", |
|
197 | 187 | }, |
198 | 188 | { |
199 | 189 | "cell_type": "code", |
200 | | - "execution_count": 12, |
| 190 | + "execution_count": null, |
201 | 191 | "metadata": {}, |
202 | | - "outputs": [ |
203 | | - { |
204 | | - "name": "stdout", |
205 | | - "output_type": "stream", |
206 | | - "text": [ |
207 | | - "Based on your request, here are a few hotel recommendations with beach access and good views:\n", |
208 | | - "\n", |
209 | | - "1. Ocean Air Motel - oceanfront hotel with a private balcony and indoor and outdoor pools\n", |
210 | | - "2. Marquis Plaza & Suites - offers a view, free Wi-Fi, and a pool\n", |
211 | | - "3. Pull'r Inn Motel - offers a view, a pool, and free Wi-Fi\n", |
212 | | - "\n", |
213 | | - "I hope this helps! Let me know if you need any further assistance.\n" |
214 | | - ] |
215 | | - } |
216 | | - ], |
| 192 | + "outputs": [], |
217 | 193 | "source": [ |
| 194 | + "# Instantiate the chat thread and run the conversation\n", |
218 | 195 | "import azure.identity.aio\n", |
219 | 196 | "\n", |
220 | 197 | "chat_thread = ChatThread()\n", |
|
0 commit comments