Skip to content

Commit b5098a5

Browse files
Merge pull request #630 from HeidiSteen/heidist-rag
fixed vector query in rag tutorial
2 parents 4884263 + 011fd91 commit b5098a5

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

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

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ author: HeidiSteen
88
ms.author: heidist
99
ms.service: cognitive-search
1010
ms.topic: tutorial
11-
ms.date: 10/01/2024
11+
ms.date: 10/03/2024
1212

1313
---
1414

@@ -90,14 +90,17 @@ Sources:\n{sources}
9090
"""
9191

9292
# Provide the query. Notice it's sent to both the search engine and the LLM.
93+
# The query sent to the search engine is hybrid. Keyword search on "query". Text-to-vector conversion for vector search.
9394
query="how much of earth is covered by water"
95+
vector_query = VectorizableTextQuery(text=query, k_nearest_neighbors=1, fields="text_vector", exhaustive=True)
9496

9597
# Set up the search results and the chat thread.
9698
# Retrieve the selected fields from the search index related to the question.
9799
search_results = search_client.search(
98100
search_text=query,
101+
vector_queries= [vector_query],
102+
select="title, chunk, locations",
99103
top=1,
100-
select="title, chunk, locations"
101104
)
102105
sources_formatted = "\n".join([f'{document["title"]}:{document["chunk"]}:{document["locations"]}' for document in search_results])
103106

0 commit comments

Comments
 (0)