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-maximize-relevance.md
+92-5Lines changed: 92 additions & 5 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -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.
> If you're continuing on with the tutorial, remember to restore the prompt to its previous value (`You are an AI assistant that helps users learn from the information found in the source material`).
239
+
237
240
Changing parameters and prompts affects the response from the LLM. As you explore on your own, keep the following tips in mind:
238
241
239
242
- Raising the `top` value can exhaust available quota on the model. If there's no quota, an error message is returned or the model might return "I don't know".
0 commit comments