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
+16-16Lines changed: 16 additions & 16 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -55,13 +55,13 @@ This quickstart uses `DefaultAzureCredential`, which simplifies authentication i
55
55
56
56
1. Rename the `sample.env` file to `.env` and modify the values in the `.env` file.
57
57
58
-
Use the Search service Url as the `AZURE_SEARCH_ENDPOINT`. You can find the url in the Azure portal. Go to your Azure AI Search service resource, on the Overview page, look for the Url field. An example endpoint might look like `https://mydemo.search.windows.net`.
58
+
Use the search service URL as the `AZURE_SEARCH_ENDPOINT`. You can find the url in the [Azure portal](https://portal.azure.com). Go to your Azure AI Search service, on the **Overview** page, look for the URL field. An example endpoint might look like `https://mydemo.search.windows.net`.
59
59
60
60
Finally, choose a new `AZURE_SEARCH_INDEX_NAME` name, or use the one provided in the file.
61
61
62
-
1. In Visual Studio Code, work in an environment. Use the View > Terminal...`Ctrl`+```.
62
+
1. In Visual Studio Code, work in an environment. On the **View** menu, select **Terminal...**, or select <kbd>Ctrl</kbd>+<kbd>`</kbd>.
63
63
64
-
1.Open the Terminal and run the command:
64
+
1.Run the following commands in the terminal:
65
65
66
66
```bash
67
67
python -m venv .venv
@@ -76,7 +76,7 @@ This quickstart uses `DefaultAzureCredential`, which simplifies authentication i
76
76
77
77
The `where python` command validates that you're working from the virtual environment by listing `python.exe` in the `Quickstart-Vector-Search\.venv\` folder, and other locations from your machine's directory.
78
78
79
-
1. Install the required libraries by running the following command.
79
+
1. Install the required libraries by running the following command:
80
80
81
81
```bash
82
82
pip install requirements.txt
@@ -85,7 +85,7 @@ This quickstart uses `DefaultAzureCredential`, which simplifies authentication i
85
85
1. In Visual Studio Code, open the `vector-search-quickstart.ipynb`.
86
86
87
87
> [!Note]
88
-
> 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.
88
+
> 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 kernel and possibly other tools. Choose to install the suggested tools to continue with this quickstart.
89
89
90
90
91
91
1. Find the cell below section titled "Install packages and set variables" and select the **Execute Cell (`Ctrl` + `Alt` + `Enter`)** button (which looks like a typical run button) to the left of the cell. Executing the cell loads the environment variables, creates the DefaultAzureCredential, and prints values to the output to confirm that the notebook's dependencies and `.env` are set up correctly.
@@ -230,7 +230,7 @@ The code in the `vector-search-quickstart.ipynb` uses several methods from the `
230
230
231
231
- This particular index supports multiple search capabilities, such as:
@@ -242,7 +242,7 @@ The code in the `vector-search-quickstart.ipynb` uses several methods from the `
242
242
243
243
Creating and loading the index are separate steps. You created the index schema [in the previous step](#create-a-vector-index). Now you need to load documents into the index.
244
244
245
-
In Azure AI Search, the index contains all searchable data and queries run on the search service.
245
+
In Azure AI Search, the index stores all searchable content, while the search engine executes queries against that index.
246
246
247
247
1. Find the cell below section titled "Create documents payload" and execute the cell. This cell contains the following code (truncated for brevity):
248
248
@@ -285,7 +285,7 @@ In Azure AI Search, the index contains all searchable data and queries run on th
285
285
]
286
286
```
287
287
288
-
This cell loads a variable named `documents` with a JSON object describing each document, along with the vectorized version of the article's description. This vector is what powers the search.
288
+
This cell loads a variable named `documents` with a JSON object describing each document, along with the vectorized version of the article's description. This vector enables similarity search, where matching is based on meaning rather than exact keywords.
289
289
290
290
> [!IMPORTANT]
291
291
> The code in this example isn't runnable. Several characters or lines are removed for brevity. Instead, run the code in the Jupyter notebook.
@@ -310,7 +310,7 @@ In Azure AI Search, the index contains all searchable data and queries run on th
310
310
311
311
This creates an instance of the search client by calling the `SearchClient()` constructor, then calls the `upload_documents()` method on the object.
312
312
313
-
When run, the status of each document is printed below the cell:
313
+
After you run the cell, the status of each document is printed below it:
314
314
315
315
```output
316
316
Key: 1, Succeeded: True, ErrorMessage: None
@@ -330,7 +330,7 @@ In Azure AI Search, the index contains all searchable data and queries run on th
- Vector fields contain floating point values. The dimensions attribute has a minimum of 2 and a maximum of 3,072 floating point values each. This quickstart sets the dimensions attribute to 1,536 because that's the size of embeddings generated by the Azure OpenAI **text-embedding-ada-002** model.
333
+
- Vector fields contain floating point values. The dimensions attribute has a minimum of 2 and a maximum of 4096 floating point values each. This quickstart sets the dimensions attribute to 1,536 because that's the size of embeddings generated by the Azure OpenAI **text-embedding-ada-002** model.
334
334
335
335
## Run queries
336
336
@@ -398,11 +398,11 @@ The first example demonstrates a basic scenario where you want to find document
398
398
399
399
The vector query string is`quintessential lodging near running trails, eateries, retail`, which is vectorized into 1,536 embeddings for this query.
400
400
401
-
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 are returned. Furthermore, only the fields specific by the `select` are returned.
401
+
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 are returned. Furthermore, only the fields specified by the `select` are returned.
402
402
403
403
`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.
404
404
405
-
When run, each resultisdisplayed:
405
+
After you run the cell, the status of each documentisprinted below it:
406
406
407
407
```output
408
408
Total results: 5
@@ -417,7 +417,7 @@ The first example demonstrates a basic scenario where you want to find document
417
417
418
418
You can add filters, but the filters are applied to the nonvector content in your index. In this example, the filter applies to the `Tags` field to filter out any hotels that don't provide free Wi-Fi.
419
419
420
-
1. Find the cell below section titled "Run a vector query with a filter"and execute the cell. This cell contains the request to query the search index.
420
+
1. Find the cell below section titled "Single vector search with filter"and execute the cell. This cell contains the request to query the search index.
421
421
422
422
```python
423
423
if vector:
@@ -448,7 +448,7 @@ You can add filters, but the filters are applied to the nonvector content in you
448
448
print("No vector loaded, skipping search.")
449
449
```
450
450
451
-
When run, each resultisdisplayed:
451
+
After you run the cell, the status of each documentisprinted below it:
452
452
453
453
```output
454
454
Total filtered results: 2
@@ -518,12 +518,12 @@ You can add filters, but the filters are applied to the nonvector content in you
518
518
519
519
### Hybrid search
520
520
521
-
Hybrid search consists of keyword queries and vector queries in a single search request. This example runs the vector query and fulltext search concurrently:
521
+
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:
522
522
523
523
-**Search string**: `historic hotel walk to restaurants and shopping`
524
524
-**Vector query string** (vectorized into a mathematical representation): `quintessential lodging near running trails, eateries, retail`
525
525
526
-
1. Find the cell below section titled "Hybrid Search" and execute the cell. This block contains the request to query the search index.
526
+
1. Find the cell below section titled "Hybrid search" and execute the cell. This block contains the request to query the search index.
0 commit comments