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/includes/quickstarts/search-get-started-vector-python.md
+11-12Lines changed: 11 additions & 12 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -9,7 +9,7 @@ ms.date: 06/19/2025
9
9
10
10
The [Azure AI Search client library](/python/api/overview/azure/search-documents-readme) allows you to create, load, and query vectors. It provides an abstraction over the REST API for access to index operations such as data ingestion, search operations and index management operations.
11
11
12
-
In this quickstart, you'll use a Python notebook which contains the configuration, data, and code required to perform these operations.
12
+
In this quickstart, you'll use a Jupyter notebook which contains the configuration, data, and code required to perform these operations.
13
13
14
14
In Azure AI Search, a [vector store](../../vector-store.md) has an index schema that defines vector and nonvector fields, a vector search configuration for algorithms that create the embedding space, and settings on vector field definitions that are evaluated at query time. The [Create Index](/rest/api/searchservice/indexes/create-or-update) REST API creates the vector store.
15
15
@@ -24,9 +24,9 @@ In Azure AI Search, a [vector store](../../vector-store.md) has an index schema
24
24
- You can use a free search service for most of this quickstart, but we recommend the Basic tier or higher for larger data files.
25
25
- To run the query example that invokes [semantic reranking](../../semantic-search-overview.md), your search service must be at the Basic tier or higher with [semantic ranker enabled](../../semantic-how-to-enable-disable.md).
26
26
27
-
-[Visual Studio Code](https://code.visualstudio.com/download)
27
+
-[Visual Studio Code](https://code.visualstudio.com/download) with the [Python extension](https://marketplace.visualstudio.com/items?itemName=ms-python.python) and [Jupyter package](https://pypi.org/project/jupyter/).
28
28
29
-
-[Git](https://git-scm.com/downloads) to clone the repo containing the Python notebook and other related files.
29
+
-[Git](https://git-scm.com/downloads) to clone the repo containing the Jupyter notebook and other related files.
30
30
31
31
---
32
32
@@ -37,8 +37,7 @@ Requests to the search endpoint must be authenticated and authorized. While it i
37
37
This quickstart uses `DefaultAzureCredential` which simplifies authentication in both development and production scenarios. However, for production scenarios, you may have more advanced requirements that require a different approach. See [Authenticate Python apps to Azure services by using the Azure SDK for Python](/azure/developer/python/sdk/authentication/overview) to understand all of your options.
38
38
39
39
40
-
## Clone the notebook and setup environment
41
-
40
+
## Clone the code and setup environment
42
41
43
42
1. Clone the repo containing the code for this quickstart.
44
43
@@ -88,7 +87,7 @@ This quickstart uses `DefaultAzureCredential` which simplifies authentication in
88
87
1. In Visual Studio Code, open the `vector-search-quickstart.ipynb`.
89
88
90
89
> [!Note]
91
-
> If this is the first time you have used a notebook in Visual Studio Code, you will be prompted to install the Jupyter Notebook kernal and other tool. Choose to install the suggested tools to continue with this tutorial.
90
+
> If this is the first time you have used a Jupyter Notebook (.ipynb) in Visual Studio Code, you will be prompted to install the Jupyter Notebook kernal and possibly other tools. Choose to install the suggested tools to continue with this quickstart.
92
91
93
92
94
93
1. Run the cell in the section below the title "Install packages and set variables". This invokes the following code:
@@ -253,7 +252,7 @@ The code in the `vector-search-quickstart.ipynb` uses several methods from the `
253
252
254
253
- This particular index supports multiple search capabilities, such as:
@@ -371,9 +370,9 @@ In the next sections, we run queries against the `hotels-vector-quickstart` inde
371
370
The example vector queries are based on two strings:
372
371
373
372
-**Search string**: `historic hotel walk to restaurants and shopping`
374
-
-**Vector query string** (vectorized into a mathematical representation): `classic lodging near running trails, eateries, retail`
373
+
-**Vector query string** (vectorized into a mathematical representation): `quintessential lodging near running trails, eateries, retail`
375
374
376
-
The vector query string is semantically similar to the search string, but it includes terms that don't exist in the search index. If you do a keyword search for `classic lodging near running trails, eateries, retail`, results are zero. We use this example to show how you can get relevant results even if there are no matching terms.
375
+
The vector query string is semantically similar to the search string, but it includes terms that don't exist in the search index. If you do a keyword search for `quintessential lodging near running trails, eateries, retail`, results are zero. We use this example to show how you can get relevant results even if there are no matching terms.
377
376
378
377
1. Run the cell in the section below "Create the vector query string". this loads the `vector` variable with the vectorized query data required to run all of the searches in the next sections.
379
378
@@ -419,9 +418,9 @@ The first example demonstrates a basic scenario where you want to find document
419
418
420
419
This vector query is shortened for brevity. The `vectorQueries.vector` contains the vectorized text of the query input, `fields` determines which vector fields are searched, and`k` specifies the number of nearest neighbors to return.
421
420
422
-
The vector query string is`classic lodging near running trails, eateries, retail`, which is vectorized into 1,536 embeddings for this query.
421
+
The vector query string is`quintessential lodging near running trails, eateries, retail`, which is vectorized into 1,536 embeddings for this query.
423
422
424
-
The response for the vector equivalent of `classic lodging near running trails, eateries, retail` includes seven results but the code specifies `top=5` so only the first five results will be returned. Furthermore, only the fields specific by the `select` are returned.
423
+
The response for the vector equivalent of `quintessential lodging near running trails, eateries, retail` includes seven results but the code specifies `top=5` so only the first five results will be returned. Furthermore, only the fields specific by the `select` are returned.
425
424
426
425
`search_client.search()` returns a dict-like object. Each result provides a search score which can be accessed using `score = result.get("@search.score", "N/A")`. While not displayed in this example, in a similarity search, the response always includes `k` results ordered by the value similarity score.
427
426
@@ -544,7 +543,7 @@ You can add filters, but the filters are applied to the nonvector content in you
544
543
Hybrid search consists of keyword queries and vector queries in a single search request. This example runs the vector query and full text search concurrently:
545
544
546
545
-**Search string**: `historic hotel walk to restaurants and shopping`
547
-
-**Vector query string** (vectorized into a mathematical representation): `classic lodging near running trails, eateries, retail`
546
+
-**Vector query string** (vectorized into a mathematical representation): `quintessential lodging near running trails, eateries, retail`
548
547
549
548
1. Run the cell in the section titled "Hybrid Search". This block contains the request to query the search index.
0 commit comments