Skip to content

Commit d4fb8ea

Browse files
Merge pull request #286 from HeidiSteen/heidist-rag
misc edits
2 parents 8a0a97a + d04ff3d commit d4fb8ea

File tree

4 files changed

+16
-20
lines changed

4 files changed

+16
-20
lines changed

articles/search/tutorial-rag-build-solution-index-schema.md

Lines changed: 6 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -41,17 +41,11 @@ When LLMs generate a response, they operate on chunks of content for message inp
4141

4242
Chunks are the focus of the schema, and each chunk is the defining element of a search document in a RAG pattern. You can think of your index as a large collection of chunks, as opposed to traditional search documents that probably have more structure, such as fields containing uniform content for a name, descriptions, categories, and addresses.
4343

44-
### Content centricity and structured data
44+
### Enhanced with generated data
4545

46-
In addition to structural considerations, like chunked content, you also want to consider the substance of your content because it also informs what fields are indexed.
46+
In this tutorial, sample data consists of PDFs and content from the [NASA Earth Book](https://www.nasa.gov/ebooks/earth/). This content is descriptive and informative, with numerous references to geographies, countries, and areas across the world. All of the textual content is captured in chunks, but these recurring instances of place names create an opportunity for adding structure to the index. Using skills, it's possible to recognize entities in the text and capture them in an index for use in queries and filters. In this tutorial, we include an [entity recognition skill](cognitive-search-skill-entity-recognition-v3.md) that recognizes and extracts location entities, loading it into a searchable and filterable `locations` field. Adding structured content to your index gives you more options for filtering, improved relevance, and richer answers.
4747

48-
In this tutorial, sample data consists of PDFs and content from the NASA Earth Book. This content is descriptive and informative, with numerous references to geographies, countries, and areas across the world. To capture this information in our index and potentially use it in queries, we include skills in our indexing pipeline that recognize and extract this information, loading it into a searchable and filterable `locations` field. Adding structured content to your index gives you more options for filtering, relevance tuning, and richer answers.
49-
50-
The original ebook is large, over 100 pages and 35 MB in size. We broke it up into smaller PDFs, one per page of text, to stay under the REST API payload limit of 16 MB per API call.
51-
52-
For simplicity, we omit image vectorization for this exercise.
53-
54-
### Parent-child fields in one or two indexes
48+
### Parent-child fields in one or two indexes?
5549

5650
Chunked content typically derives from a larger document. And although the schema is organized around chunks, you also want to capture properties and content at the parent level. Examples of these properties might include the parent file path, title, authors, publication date, or a summary.
5751

@@ -104,11 +98,11 @@ A minimal index for LLM is designed to store chunks of content. It typically inc
10498
}
10599
```
106100

107-
Fields must include key field (`"id"`) and should include vector chunks for similarity search, and nonvector chunks for inputs to the LLM.
101+
Fields must include key field (`"id"` in this example) and should include vector chunks for similarity search, and nonvector chunks for inputs to the LLM.
108102

109-
Vector fields have [specific types](/rest/api/searchservice/supported-data-types#edm-data-types-for-vector-fields) and extra attributes for embedding model dimensions and configuration. `Edm.Single` is a data type that works for commonly used LLMs. For more information about vector fields, see [Create a vector index](vector-search-how-to-create-index.md).
103+
Vector fields are associated with algorithms that determine the search paths at query time. The index has a vectorSearch section for specifying multiple algorithm configurations. Vector fields also have [specific types](/rest/api/searchservice/supported-data-types#edm-data-types-for-vector-fields) and extra attributes for embedding model dimensions. `Edm.Single` is a data type that works for commonly used LLMs. For more information about vector fields, see [Create a vector index](vector-search-how-to-create-index.md).
110104

111-
Metadata fields might be file path, creation date, or content type and are useful for [filters](vector-search-filters.md).
105+
Metadata fields might be the parent file path, creation date, or content type and are useful for [filters](vector-search-filters.md).
112106

113107
1. Here's the index schema for the [tutorial source code](https://github.com/Azure-Samples/azure-search-python-samples/blob/main/Tutorial-RAG/Tutorial-rag.ipynb) and the [Earth Book content](https://github.com/Azure-Samples/azure-search-sample-data/tree/main/nasa-e-book/earth_book_2019_text_pages).
114108

articles/search/tutorial-rag-build-solution-pipeline.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ In this tutorial, you:
2222
> - Provide the index schema from the previous tutorial
2323
> - Create a data source connection
2424
> - Create an indexer
25-
> - Create a skillset
25+
> - Create a skillset that chunks, vectorizes, and recognizes entities
2626
> - Run the indexer and check results
2727
2828
If you don't have an Azure subscription, create a [free account](https://azure.microsoft.com/free/?WT.mc_id=A261C142F) before you begin.
@@ -99,6 +99,8 @@ print(f"{result.name} created")
9999

100100
In this step, set up the sample data and a connection to Azure Blob Storage. The indexer retrieves PDFs from a container. You create the container and upload files in this step.
101101

102+
The original ebook is large, over 100 pages and 35 MB in size. We broke it up into smaller PDFs, one per page of text, to stay under the REST API payload limit of 16 MB per API call. For simplicity, we omit image vectorization for this exercise.
103+
102104
1. Sign in to the Azure portal and find your Azure Storage account.
103105

104106
1. Create a container and upload the PDFs from [earth_book_2019_text_pages](https://github.com/Azure-Samples/azure-search-sample-data/tree/main/nasa-e-book/earth_book_2019_text_pages).

articles/search/tutorial-rag-build-solution-query.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,7 @@ print(response.choices[0].message.content)
119119

120120
In this response, the answer is based on a single input (`top=1`) consisting of the one chunk determined by the search engine to be the most relevant. Instructions in the prompt tell the LLM to use only the information in the `sources`, or formatted search results.
121121

122-
Results from the first query`"how much of earth is covered by water"` should look similar to the following example.
122+
Results from the first query `"how much of earth is covered by water"` should look similar to the following example.
123123

124124
:::image type="content" source="media/tutorial-rag-solution/chat-results-1.png" alt-text="Screenshot of an LLM response to a simple question using a single match from search results.":::
125125

@@ -130,7 +130,7 @@ It's expected for LLMs to return different answers, even if the prompt and queri
130130
131131
## Add a filter
132132

133-
Recall that you created a `locations` field using applied AI, populated with places recognized by the Entity Recognition skill. The field definition for locations includes the `filterable` attribute. Let's repeat the previous request, but this time adding a filter that selects on the term *ice* in the locations field. For more information about filtering on string collections, see [text filter fundamentals](search-filters.md#text-filter-fundamentals) and [Understand collection filters](search-query-understand-collection-filters.md).
133+
Recall that you created a `locations` field using applied AI, populated with places recognized by the Entity Recognition skill. The field definition for locations includes the `filterable` attribute. Let's repeat the previous request, but this time adding a filter that selects on the term *ice* in the locations field. A filter introduces inclusion or exclusion criteria. The search engine is still doing a vector search on `"how much of earth is covered by water"`, but it's now excluding matches that don't include *ice*. For more information about filtering on string collections and on vector queries, see [text filter fundamentals](search-filters.md#text-filter-fundamentals),[Understand collection filters](search-query-understand-collection-filters.md), and [Add filters to a vector query](vector-search-filters.md).
134134

135135
Replace the search_results definition with the following example that includes a filter:
136136

@@ -142,7 +142,7 @@ search_results = search_client.search(
142142
select="title, chunk, locations"
143143
```
144144

145-
Results from the filtered query should now look similar to the following response.
145+
Results from the filtered query should now look similar to the following response. Notice the emphasis on ice cover.
146146

147147
:::image type="content" source="media/tutorial-rag-solution/chat-results-filter.png" alt-text="Screenshot of an LLM response after a filter is added.":::
148148

@@ -160,7 +160,7 @@ Because the model is bound to just the grounding data, the answer becomes more e
160160

161161
You can also change the prompt to control the format of the output, tone, and whether you want the model to supplement the answer with its own training data by changing the prompt.
162162

163-
Here's another example of LLM output if we refocus the prompt.
163+
Here's another example of LLM output if we refocus the prompt on fact collection.
164164

165165
```python
166166
# Provide instructions to the model

articles/search/tutorial-rag-build-solution.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ This tutorial series demonstrates a pattern for building RAG solutions on Azure
1818

1919
Sample data is a [collection of PDFs](https://github.com/Azure-Samples/azure-search-sample-data/tree/main/nasa-e-book/earth_book_2019_text_pages) uploaded to Azure Storage.
2020

21-
Sample code can be found in [this Python notebook](https://github.com/Azure-Samples/azure-search-python-samples/blob/main/Tutorial-RAG/Tutorial-rag.ipynb), but we recommend using this series for context, insights, and alternative approaches.
21+
Sample code can be found in [this Python notebook](https://github.com/Azure-Samples/azure-search-python-samples/blob/main/Tutorial-RAG/Tutorial-rag.ipynb), but we recommend using this series for context, insights, and for exploring alternative approaches.
2222

2323
## Exercises in this series
2424

@@ -38,9 +38,9 @@ Sample code can be found in [this Python notebook](https://github.com/Azure-Samp
3838

3939
We omitted a few aspects of a RAG pattern to reduce complexity:
4040

41-
- No chat history and context. Chat history must be stored and managed separately from your grounding data, which means extra steps and code. This tutorial assumes atomic question and answers from the LLM.
41+
- No management of chat history and context. Chat history is typically stored and managed separately from your grounding data, which means extra steps and code. This tutorial assumes atomic question and answers from the LLM.
4242

43-
- No per-user user access controls over results (what we refer to as "security trimming"). For more information and resources, start with [Security trimming](search-security-trimming-for-azure-search.md) and make sure to review the links at the end of the article.
43+
- No per-user user security over results (what we refer to as "security trimming"). For more information and resources, start with [Security trimming](search-security-trimming-for-azure-search.md) and make sure to review the links at the end of the article.
4444

4545
This series covers the fundamentals of RAG solution development. Once you understand the basics, continue with accelerators and other code samples that provide more abstraction or are otherwise better suited for production environments and more complex workloads.
4646

0 commit comments

Comments
 (0)