Skip to content

Commit de908ce

Browse files
committed
Tweaks
1 parent e7824b6 commit de908ce

File tree

1 file changed

+70
-70
lines changed

1 file changed

+70
-70
lines changed

articles/search/includes/quickstarts/search-get-started-rag-dotnet.md

Lines changed: 70 additions & 70 deletions
Original file line numberDiff line numberDiff line change
@@ -222,7 +222,7 @@ To access the completed sample app for this article:
222222
```
223223

224224
1. Navigate into the `quickstart-rag` folder.
225-
1. Open the project you want to test in Visual Studio Code or Visual Studio.
225+
1. Open the `quickstart-rag` folder in Visual Studio Code or open the solution file using Visual Studio.
226226

227227
### Create the sample app
228228

@@ -256,41 +256,43 @@ Complete the following steps to create a .NET console app to connect to an AI mo
256256

257257
## Set up the query and chat thread
258258

259-
If you are following along with the completed sample repo, open the project in the `minimal-query` folder. If you created the project yourself, add the following code to connect to and query the Azure AI Search and Azure OpenAI services:
260-
261-
> [!NOTE]
262-
> Make sure to replace the placeholders for the Azure OpenAI endpoint and model name, as well as the Azure AI Search endpoint and index name.
263-
264-
:::code language="csharp" source="~/azure-search-dotnet-samples/quickstart-rag/minimal-query/Program.cs" :::
265-
266-
The preceding code accomplishes the following:
267-
268-
- Searches an Azure Search index for hotels matching a user query about complimentary breakfast, retrieving hotel name, description, and tags.
269-
- Formats the search results into a structured list to serve as contextual sources for the generative AI model.
270-
- Constructs a prompt instructing the Azure OpenAI model to answer using only the provided sources.
271-
- Sends the prompt to the AI model and streams the generated response.
272-
- Outputs the AI’s response to the console, displaying both the role and content as it streams.
273-
274-
The output from Azure OpenAI consists of recommendations for several hotels, such as the following example:
275-
276-
```output
277-
Sure! Here are a few hotels that offer complimentary breakfast:
278-
279-
- **Head Wind Resort**
280-
- Complimentary continental breakfast in the lobby
281-
- Free Wi-Fi throughout the hotel
282-
283-
- **Double Sanctuary Resort**
284-
- Continental breakfast included
285-
286-
- **White Mountain Lodge & Suites**
287-
- Continental breakfast available
288-
289-
- **Swan Bird Lake Inn**
290-
- Continental-style breakfast each morning with a variety of food and drinks
291-
such as caramel cinnamon rolls, coffee, orange juice, milk, cereal,
292-
instant oatmeal, bagels, and muffins
293-
```
259+
THe following example demonstrates how to set up a minimal RAG scenario using Azure AI Search to provide an OpenAI model with contextual resources to improve the generated responses.
260+
261+
1. In the `minimal-query` project of the sample repo, open the `Program.cs` file to view the first example. If you created the project yourself, add the following code to connect to and query the Azure AI Search and Azure OpenAI services.
262+
263+
> [!NOTE]
264+
> Make sure to replace the placeholders for the Azure OpenAI endpoint and model name, as well as the Azure AI Search endpoint and index name.
265+
266+
:::code language="csharp" source="~/azure-search-dotnet-samples/quickstart-rag/minimal-query/Program.cs" :::
267+
268+
The preceding code accomplishes the following:
269+
270+
- Searches an Azure Search index for hotels matching a user query about complimentary breakfast, retrieving hotel name, description, and tags.
271+
- Formats the search results into a structured list to serve as contextual sources for the generative AI model.
272+
- Constructs a prompt instructing the Azure OpenAI model to answer using only the provided sources.
273+
- Sends the prompt to the AI model and streams the generated response.
274+
- Outputs the AI’s response to the console, displaying both the role and content as it streams.
275+
276+
1. Run the project to initiate a basic RAG scenario. The output from Azure OpenAI consists of recommendations for several hotels, such as the following example:
277+
278+
```output
279+
Sure! Here are a few hotels that offer complimentary breakfast:
280+
281+
- **Head Wind Resort**
282+
- Complimentary continental breakfast in the lobby
283+
- Free Wi-Fi throughout the hotel
284+
285+
- **Double Sanctuary Resort**
286+
- Continental breakfast included
287+
288+
- **White Mountain Lodge & Suites**
289+
- Continental breakfast available
290+
291+
- **Swan Bird Lake Inn**
292+
- Continental-style breakfast each morning with a variety of food and drinks
293+
such as caramel cinnamon rolls, coffee, orange juice, milk, cereal,
294+
instant oatmeal, bagels, and muffins
295+
```
294296

295297
To experiment further, change the query and rerun the last step to better understand how the model works with the grounding data. You can also modify the prompt to change the tone or structure of the output.
296298

@@ -304,40 +306,38 @@ You might receive any of the following errors while testing:
304306

305307
## Send a complex RAG query
306308

307-
Azure AI Search supports [complex types](../../search-howto-complex-data-types.md) for nested JSON structures. In the hotels-sample-index, `Address` is an example of a complex type, consisting of `Address.StreetAddress`, `Address.City`, `Address.StateProvince`, `Address.PostalCode`, and `Address.Country`. The index also has complex collection of `Rooms` for each hotel.
308-
309-
If your index has complex types, your query can provide those fields if you first convert the search results output to JSON, and then pass the JSON to the chat model.
310-
311-
The following example updates the user prompt and adds complex types to the request:
312-
313-
:::code language="csharp" source="~/azure-search-dotnet-samples/quickstart-rag/complex-query/Program.cs" :::
314-
315-
The output from Azure OpenAI consists of recommendations for several hotels, such as the following example:
316-
317-
```output
318-
1. **Double Sanctuary Resort**
319-
- **Description**: 5-star luxury hotel with the biggest rooms in the city. Recognized as the #1 hotel in the area by Traveler magazine. Features include free WiFi, flexible check-in/out, a fitness center, and in-room espresso.
320-
- **Address**: 2211 Elliott Ave, Seattle, WA, 98121, USA
321-
- **Tags**: view, pool, restaurant, bar, continental breakfast
322-
- **Room Rate for 4 People**:
323-
- Suite, 2 Queen Beds: $254.99 per night
324-
325-
2. **Starlight Suites**
326-
- **Description**: Spacious all-suite hotel with complimentary airport shuttle and WiFi. Facilities include an indoor/outdoor pool, fitness center, and Florida Green certification. Complimentary coffee and HDTV are also available.
327-
- **Address**: 19575 Biscayne Blvd, Aventura, FL, 33180, USA
328-
- **Tags**: pool, coffee in lobby, free wifi
329-
- **Room Rate for 4 People**:
330-
- Suite, 2 Queen Beds (Cityside): $231.99 per night
331-
- Deluxe Room, 2 Queen Beds (Waterfront View): $148.99 per night
332-
333-
3. **Good Business Hotel**
334-
- **Description**: Located one mile from the airport with free WiFi, an outdoor pool, and a complimentary airport shuttle. Close proximity to Lake Lanier and downtown. The business center includes printers, a copy machine, fax, and a work area.
335-
- **Address**: 4400 Ashford Dunwoody Rd NE, Atlanta, GA, 30346, USA
336-
- **Tags**: pool, continental breakfast, free parking
337-
- **Room Rate for 4 People**:
338-
- Budget Room, 2 Queen Beds (Amenities): $60.99 per night
339-
- Deluxe Room, 2 Queen Beds (Amenities): $139.99 per night
340-
```
309+
Azure AI Search supports [complex types](../../search-howto-complex-data-types.md) for nested JSON structures. In the hotels-sample-index, `Address` is an example of a complex type, consisting of `Address.StreetAddress`, `Address.City`, `Address.StateProvince`, `Address.PostalCode`, and `Address.Country`. The index also has complex collection of `Rooms` for each hotel. If your index has complex types, your query can provide those fields if you first convert the search results output to JSON, and then pass the JSON to the chat model.
310+
311+
1. In the `complex-query` project of the sample repo, open the `Program.cs` file. If you created the project yourself, replace your code with the following::
312+
313+
:::code language="csharp" source="~/azure-search-dotnet-samples/quickstart-rag/complex-query/Program.cs" :::
314+
315+
2. Run the project to initiate a basic RAG scenario. The output from Azure OpenAI consists of recommendations for several hotels, such as the following example:
316+
317+
```output
318+
1. **Double Sanctuary Resort**
319+
- **Description**: 5-star luxury hotel with the biggest rooms in the city. Recognized as the #1 hotel in the area by Traveler magazine. Features include free WiFi, flexible check-in/out, a fitness center, and in-room espresso.
320+
- **Address**: 2211 Elliott Ave, Seattle, WA, 98121, USA
321+
- **Tags**: view, pool, restaurant, bar, continental breakfast
322+
- **Room Rate for 4 People**:
323+
- Suite, 2 Queen Beds: $254.99 per night
324+
325+
2. **Starlight Suites**
326+
- **Description**: Spacious all-suite hotel with complimentary airport shuttle and WiFi. Facilities include an indoor/outdoor pool, fitness center, and Florida Green certification. Complimentary coffee and HDTV are also available.
327+
- **Address**: 19575 Biscayne Blvd, Aventura, FL, 33180, USA
328+
- **Tags**: pool, coffee in lobby, free wifi
329+
- **Room Rate for 4 People**:
330+
- Suite, 2 Queen Beds (Cityside): $231.99 per night
331+
- Deluxe Room, 2 Queen Beds (Waterfront View): $148.99 per night
332+
333+
3. **Good Business Hotel**
334+
- **Description**: Located one mile from the airport with free WiFi, an outdoor pool, and a complimentary airport shuttle. Close proximity to Lake Lanier and downtown. The business center includes printers, a copy machine, fax, and a work area.
335+
- **Address**: 4400 Ashford Dunwoody Rd NE, Atlanta, GA, 30346, USA
336+
- **Tags**: pool, continental breakfast, free parking
337+
- **Room Rate for 4 People**:
338+
- Budget Room, 2 Queen Beds (Amenities): $60.99 per night
339+
- Deluxe Room, 2 Queen Beds (Amenities): $139.99 per night
340+
```
341341

342342
## Troubleshooting
343343

0 commit comments

Comments
 (0)