|
29 | 29 | "\n", |
30 | 30 | "- [Azure OpenAI](https://learn.microsoft.com/azure/ai-services/openai/how-to/create-resource)\n", |
31 | 31 | "\n", |
32 | | - " - Deploy a chat completion model (gpt-4o, gpt-4o-mini, or equivalent model).\n", |
| 32 | + " - [Choose a region](https://learn.microsoft.com/azure/ai-services/openai/concepts/models?tabs=global-standard%2Cstandard-chat-completions#global-standard-model-availability) that supports the chat completion model you want to use (gpt-4o, gpt-4o-mini, or equivalent model). \n", |
| 33 | + " - [Deploy the chat completion model](https://learn.microsoft.com/azure/ai-studio/how-to/deploy-models-openai) in Azure AI Foundry or [use another approach](https://learn.microsoft.com/azure/ai-services/openai/how-to/working-with-models?tabs=powershell).\n", |
33 | 34 | "\n", |
34 | 35 | "- [Azure AI Search](https://learn.microsoft.com/azure/search/search-create-service-portal)\n", |
35 | 36 | "\n", |
36 | 37 | " - Basic tier or higher is recommended.\n", |
37 | | - " - Choose the same region as Azure OpenAI.\n", |
38 | 38 | " - Enable semantic ranking.\n", |
39 | 39 | " - Enable role-based access control.\n", |
40 | 40 | " - Enable a system identity for Azure AI Search.\n", |
|
116 | 116 | "az login --tenant <PUT YOUR TENANT ID HERE>\n", |
117 | 117 | "```\n", |
118 | 118 | "\n", |
119 | | - "You should now be logged in to Azure.\n", |
| 119 | + "You should now be logged in to Azure from your local device.\n", |
120 | 120 | "\n", |
121 | 121 | "## Run the code" |
122 | 122 | ] |
|
149 | 149 | "source": [ |
150 | 150 | "## Basic RAG Query\n", |
151 | 151 | "\n", |
152 | | - "The following code demonstrates how to query fields such as strings or string collections in a search index, and send the results to a chat completion model. The response returned to the user is from the chat completion model." |
| 152 | + "The following code demonstrates how to set up a query on string fields and string collections in a search index, and how to send the results to a chat completion model. The response returned to the user is from the chat completion model." |
153 | 153 | ] |
154 | 154 | }, |
155 | 155 | { |
|
192 | 192 | "# Query is the question being asked. It's sent to the search engine and the LLM.\n", |
193 | 193 | "query=\"Can you recommend a few hotels with complimentary breakfast?\"\n", |
194 | 194 | "\n", |
195 | | - "# Set up the search results and the chat thread.\n", |
196 | | - "# Retrieve the selected fields from the search index related to the question.\n", |
| 195 | + "# Search results are created by the search client.\n", |
| 196 | + "# Search results are composed of the top 5 results and the fields selected from the search index.\n", |
| 197 | + "# Search results include the top 5 matches to your query.\n", |
197 | 198 | "search_results = search_client.search(\n", |
198 | 199 | " search_text=query,\n", |
199 | 200 | " top=5,\n", |
|
202 | 203 | ")\n", |
203 | 204 | "sources_formatted = \"\\n\".join([f'{document[\"HotelName\"]}:{document[\"Description\"]}:{document[\"Tags\"]}' for document in search_results])\n", |
204 | 205 | "\n", |
205 | | - "# Send the search results to the LLM to generate a response based on the prompt.\n", |
| 206 | + "# Send the search results and the query to the LLM to generate a response based on the prompt.\n", |
206 | 207 | "response = openai_client.chat.completions.create(\n", |
207 | 208 | " messages=[\n", |
208 | 209 | " {\n", |
|
240 | 241 | "source": [ |
241 | 242 | "## Complex RAG Query\n", |
242 | 243 | "\n", |
243 | | - "Use complex types and collections in RAG by converting the result to JSON before sending it to the LLM" |
| 244 | + "Use complex types and collections in a RAG pattern by converting the result to JSON before sending it to the chat completion models. This query is similar to the basic query, but it includes fields from the \"Address\" complex type and the \"Rooms\" complex collection. This query shows you how to pull in data from parts of the index that aren't just simple text fields." |
244 | 245 | ] |
245 | 246 | }, |
246 | 247 | { |
|
282 | 283 | ], |
283 | 284 | "metadata": { |
284 | 285 | "kernelspec": { |
285 | | - "display_name": "Python 3", |
| 286 | + "display_name": ".venv", |
286 | 287 | "language": "python", |
287 | 288 | "name": "python3" |
288 | 289 | }, |
|
296 | 297 | "name": "python", |
297 | 298 | "nbconvert_exporter": "python", |
298 | 299 | "pygments_lexer": "ipython3", |
299 | | - "version": "3.10.11" |
| 300 | + "version": "3.11.9" |
300 | 301 | } |
301 | 302 | }, |
302 | 303 | "nbformat": 4, |
|
0 commit comments