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
+21-11Lines changed: 21 additions & 11 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -14,25 +14,26 @@ ms.date: 10/05/2024
14
14
15
15
# Tutorial: Maximize relevance (RAG in Azure AI Search)
16
16
17
-
In this tutorial, learn how to improve the relevance of search results used in RAG solutions. Relevance tuning can be an important factor in delivering a RAG solution that meets user expectations. In Azure AI Search, relevance tuning includes L2 semantic ranking, scoring profiles, vector query weighting and minimum thresholds, and other options.
17
+
In this tutorial, learn how to improve the relevance of search results used in RAG solutions. Relevance tuning can be an important factor in delivering a RAG solution that meets user expectations. In Azure AI Search, relevance tuning includes L2 semantic rankingand scoring profiles.
18
18
19
-
To implement some of these technqiues, you revisit the index schema to add configurations for semantic ranking and scoring profiles. Other relevance tuning techniques apply to the queries themselves.
19
+
To implement some of these techniques, you revisit the index schema to add configurations for semantic ranking and scoring profiles. Other relevance tuning techniques can be applied to the queries themselves.
20
20
21
21
In this tutorial, you modify the existing search index and queries to use:
22
22
23
23
> [!div class="checklist"]
24
24
> - L2 semantic ranking
25
25
> - Scoring profile for document boosting
26
-
> - Vector weighting
27
-
> - Minimum thresholds on vector results
28
26
29
-
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 won't need to rerun the indexer.
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
+
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
31
31
32
## Prerequisites
32
33
33
34
-[Visual Studio Code](https://code.visualstudio.com/download) with the [Python extension](https://marketplace.visualstudio.com/items?itemName=ms-python.python) and the [Jupyter package](https://pypi.org/project/jupyter/).
34
35
35
-
-[Azure AI Search](search-create-service-portal.md), Basic tier or above for managed identity and semantic ranking, in the same region as Azure OpenAI and Azure AI Services.
36
+
-[Azure AI Search](search-create-service-portal.md), Basic tier or higher for managed identity and semantic ranking, in the same region as Azure OpenAI and Azure AI Services.
36
37
37
38
-[Azure OpenAI](/azure/ai-services/openai/how-to/create-resource), with a deployment of text-embedding-002 and gpt-35-turbo, in the same region as Azure AI Search.
<!--## Update queries for minimum thresholds ** NOT AVAILABLE IN PYTHON SDK
193
194
194
-
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.
195
+
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.
195
196
196
-
Using preview features, you can unpack a hybrid search score to review the individual component scores. Based on that information, you can set minimum thresholds to exclude any match that falls below it.
197
+
In the vector query portion of the request, add a threshold objectandseta minimum value for including vector matches in the results.
197
198
198
-
## Update queries for vector weighting
199
+
Vector scores rangefrom0.333 to 1.00. For more information, see [Set thresholds to exclude low-scoring results](vector-search-how-to-query.md#set-thresholds-to-exclude-low-scoring-results-preview) and [Scores in a vector search results](vector-search-ranking.md#scores-in-a-vector-search-results).
199
200
200
-
Semantic ranking and scoring profiles operate on nonvector content, but you can tune the vector portion of a hybrid query to amplify or diminish its importance based on how much value it adds to the results. For example, if you run keyword search and vector search independently and find that one of them is outperforming the other, you can adjust the weight on the vector side to higher or lower. This approach gives you more control over query processing.
201
+
```python
202
+
# Update the vector_query to include a minimum threshold.
<!-- Using preview features, you can unpack a hybrid search score to review the individual component scores. Based on that information, you can set minimum thresholds to exclude any match that falls below it.
209
+
210
+
Semantic ranking and scoring profiles operate on nonvector content, but you can tune the vector portion of a hybrid query to amplify or diminish its importance based on how much value it adds to the results. For example, if you run keyword search and vector search independently and find that one of them is outperforming the other, you can adjust the weight on the vector side to higher or lower. This approach gives you more control over query processing.
0 commit comments