You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: articles/search/tutorial-rag-build-solution-index-schema.md
+8-8Lines changed: 8 additions & 8 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -8,7 +8,7 @@ author: HeidiSteen
8
8
ms.author: heidist
9
9
ms.service: cognitive-search
10
10
ms.topic: tutorial
11
-
ms.date: 10/01/2024
11
+
ms.date: 10/04/2024
12
12
13
13
---
14
14
@@ -43,7 +43,7 @@ Chunks are the focus of the schema, and each chunk is the defining element of a
43
43
44
44
### Enhanced with generated data
45
45
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 more focused answers.
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 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 more focused answers.
47
47
48
48
### Parent-child fields in one or two indexes?
49
49
@@ -61,11 +61,11 @@ In Azure AI Search, an index that works best for RAG workloads has these qualiti
61
61
62
62
- Maintains a parent-child relationship between chunks of a document and the properties of the parent document, such as the file name, file type, title, author, and so forth. To answer a query, chunks could be pulled from anywhere in the index. Association with the parent document providing the chunk is useful for context, citations, and follow up queries.
63
63
64
-
- Accommodates the queries you want create. You should have fields for vector and hybrid content, and those fields should be attributed to support specific query behaviors. You can only query one index at a time (no joins) so your fields collection should define all of your searchable content.
64
+
- Accommodates the queries you want create. You should have fields for vector and hybrid content, and those fields should be attributed to support specific query behaviors, such as searchable or filterable. You can only query one index at a time (no joins) so your fields collection should define all of your searchable content.
65
65
66
66
- Your schema should be flat (no complex types or structures). This requirement is specific to the RAG pattern in Azure AI Search.
67
67
68
-
Although Azure AI Search can't join indexes, you can create indexes that preserve parent-child relationship, and then use sequential or parallel queries in your search logic to pull from both. This exercise includes templates for parent-child elements in the same index and in separate indexes, where information from the parent index is retrieved using a lookup query.
68
+
<!--Although Azure AI Search can't join indexes, you can create indexes that preserve parent-child relationship, and then use sequential queries in your search logic to pull from both (a query on the chunked data index, a lookup on the parent index). This exercise includes templates for parent-child elements in the same index and in separate indexes, where information from the parent index is retrieved using a lookup query.-->
69
69
70
70
<!-- > [!NOTE]
71
71
> Schema design affects storage and costs. This exercise is focused on schema fundamentals. In the [Minimize storage and costs](tutorial-rag-build-solution-minimize-storage.md) tutorial, you revisit schema design to consider narrow data types, attribution, and vector configurations that offer more efficient. -->
@@ -136,7 +136,7 @@ A minimal index for LLM is designed to store chunks of content. It typically inc
@@ -157,8 +157,8 @@ A minimal index for LLM is designed to store chunks of content. It typically inc
157
157
kind="azureOpenAI",
158
158
parameters=AzureOpenAIVectorizerParameters(
159
159
resource_url=AZURE_OPENAI_ACCOUNT,
160
-
deployment_name="text-embedding-ada-002",
161
-
model_name="text-embedding-ada-002"
160
+
deployment_name="text-embedding-3-large",
161
+
model_name="text-embedding-3-large"
162
162
),
163
163
),
164
164
],
@@ -170,7 +170,7 @@ A minimal index for LLM is designed to store chunks of content. It typically inc
170
170
print(f"{result.name} created")
171
171
```
172
172
173
-
1. For an index schema that more closely mimics structured content, you would have separate indexes for parent and child (chunked) fields. You would need index projections to coordinate the indexing of the two indexes simultaneously. Queries execute against the child index. Query logic includes a lookup query, using the parent_idto retrieve content from the parent index.
173
+
1. For an index schema that more closely mimics structured content, you would have separate indexes for parent and child (chunked) fields. You would need [index projections](index-projections-concept-intro.md) to coordinate the indexing of the two indexes simultaneously. Queries execute against the child index. Query logic includes a lookup query, using the parent_idt retrieve content from the parent index.
Copy file name to clipboardExpand all lines: articles/search/tutorial-rag-build-solution-maximize-relevance.md
+93-6Lines changed: 93 additions & 6 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -27,7 +27,7 @@ In this tutorial, you modify the existing search index and queries to use:
27
27
This tutorial updates the search index created by the [indexing pipeline](tutorial-rag-build-solution-pipeline.md). Updates don't affect the existing content, so no rebuild is necessary and you don't need to rerun the indexer.
28
28
29
29
> [!NOTE]
30
-
> There are more relevance features in preview, including vector query weighting and setting minimum thresholds, but we omit them from this tutorial becaues they aren't yet available in the Azure SDK for Python.
30
+
> There are more relevance features in preview, including vector query weighting and setting minimum thresholds, but we omit them from this tutorial because they're in preview.
31
31
32
32
## Prerequisites
33
33
@@ -41,9 +41,78 @@ This tutorial updates the search index created by the [indexing pipeline](tutori
41
41
42
42
The [sample notebook](https://github.com/Azure-Samples/azure-search-python-samples/blob/main/Tutorial-RAG/Tutorial-rag.ipynb) includes an updated index and query request.
43
43
44
+
## Run a baseline query for comparison
45
+
46
+
Let's start with a new query, "Are there any cloud formations specific to oceans and large bodies of water?".
47
+
48
+
To compare outcomes after adding relevance features, run the query against the existing index schema, before you add semantic ranking or a scoring profile.
Output from this request might look like the following example.
108
+
109
+
```
110
+
Yes, there are cloud formations specific to oceans and large bodies of water. A notable example is "cloud streets," which are parallel rows of clouds that form over the Bering Strait in the Arctic Ocean. These cloud streets occur when wind blows from a cold surface like sea ice over warmer, moister air near the open ocean, leading to the formation of spinning air cylinders. Clouds form along the upward cycle of these cylinders, while skies remain clear along the downward cycle (Source: page-21.pdf).
111
+
```
112
+
44
113
## Update the index for semantic ranking and scoring profiles
45
114
46
-
In a previous tutorial, you [designed an index schema](tutorial-rag-build-solution-index-schema.md) for RAG workloads. We purposely omitted relevance enhancements from that schema so that you could focus on the fundamentals. Deferring relevance to a separate exercise also gives you a before-and-after comparison of the quality of search results after the updates are made.
115
+
In a previous tutorial, you [designed an index schema](tutorial-rag-build-solution-index-schema.md) for RAG workloads. We purposely omitted relevance enhancements from that schema so that you could focus on the fundamentals. Deferring relevance to a separate exercise gives you a before-and-after comparison of the quality of search results after the updates are made.
47
116
48
117
1. Update the import statements to include classes for semantic ranking and scoring profiles.
Output from a semantically ranked and boosted query might look like the following example.
263
+
264
+
```
265
+
Yes, there are specific cloud formations influenced by oceans and large bodies of water:
266
+
267
+
-**Stratus Clouds Over Icebergs**: Low stratus clouds can frame holes over icebergs, such as Iceberg A-56in the South Atlantic Ocean, likely due to thermal instability caused by the iceberg (source: page-39.pdf).
268
+
269
+
-**Undular Bores**: These are wave structures in the atmosphere created by the collision of cool, dry air from a continent with warm, moist air over the ocean, as seen off the coast of Mauritania (source: page-23.pdf).
270
+
271
+
-**Ship Tracks**: These are narrow clouds formed by water vapor condensing around tiny particles from ship exhaust. They are observed over the oceans, such asin the Pacific Ocean off the coast of California (source: page-31.pdf).
272
+
273
+
These specific formations are influenced by unique interactions between atmospheric conditions and the presence of large water bodies or objects within them.
274
+
```
275
+
276
+
Adding semantic ranking and scoring profiles positively affects the response from the LLM by promoting results that meet scoring criteria and are semantically relevant.
277
+
278
+
Now that you have a better understanding of index and query design, let's move on to optimizing for speed and concision. We revisit the schema definition to implement quantization and storage reduction, but the rest of the pipeline and models remain intact.
279
+
193
280
<!-- ## Update queries for minimum thresholds ** NOT AVAILABLE IN PYTHON SDK
194
281
195
282
Keyword search only returns results if there's match found in the index, up to a maximum of 50 results by default. In contrast, vector search returns `k`-results every time, even if the matching vectors aren't a close match.
0 commit comments