|
2 | 2 | -- ============================================================================ |
3 | 3 | -- DiskANN Vector Index Search Quickstart with Azure OpenAI Embeddings |
4 | 4 | -- Demonstrates New Improvements : Index creation, DML support, Iterative filtering, ANN vs KNN |
5 | | ---Notes: |
6 | | - -- This script is intended for demos, docs, and samples. |
7 | | - -- Do not hard‑code secrets in production. |
| 5 | +-- Notes: |
| 6 | +-- This script is intended for demos, docs, and samples. |
| 7 | +-- Do not hard‑code secrets in production. |
8 | 8 |
|
9 | | ---Run this quick check to see if your region has the new version: |
| 9 | +-- Run this quick check to see if your region has the new version: |
10 | 10 | -- Check if the new DMV exists |
11 | 11 | SELECT OBJECT_ID('sys.dm_db_vector_indexes') AS new_dmv_available; |
12 | 12 |
|
13 | | ---If this returns NULL, your region hasn't received the deployment yet |
14 | | ---If it returns a number, you're good to go! |
15 | | - |
| 13 | +-- If this returns NULL, your region hasn't received the deployment yet |
| 14 | +-- If it returns a number, you're good to go! |
16 | 15 |
|
17 | 16 | -- ============================================================================ |
18 | 17 | -- STEP 1: Setup Database Credential and External Model |
|
28 | 27 | -- Create database scoped credential with Azure OpenAI endpoint |
29 | 28 | -- Replace <yourendpoint> with your Azure OpenAI endpoint name |
30 | 29 | -- Replace <YourKey> with your Azure OpenAI API key |
31 | | - |
32 | 30 | CREATE DATABASE SCOPED CREDENTIAL [https://<yourendpoint>.openai.azure.com/] |
33 | 31 | WITH IDENTITY = 'HTTPEndpointHeaders', |
34 | 32 | SECRET = '{"api-key":"<YourKey>"}'; |
|
39 | 37 | DROP EXTERNAL MODEL IF EXISTS AIEmbeddings; |
40 | 38 | GO |
41 | 39 |
|
42 | | - |
43 | 40 | -- Replace MODEL with the choice of your embedding model and LOCATION with the URL from the Azure AI Foundry |
44 | 41 | CREATE EXTERNAL MODEL AIEmbeddings |
45 | 42 | WITH ( |
@@ -230,8 +227,6 @@ ORDER BY s.distance; |
230 | 227 | -- This proves INSERT is immediately reflected in search results |
231 | 228 | GO |
232 | 229 |
|
233 | | - |
234 | | - |
235 | 230 | -- NOW UPDATE: Change article 101 to be about something completely different |
236 | 231 | PRINT 'UPDATING: Changing article 101 to be about quantum computing...'; |
237 | 232 | DECLARE @new_embedding VECTOR(1536) = AI_GENERATE_EMBEDDINGS( |
|
0 commit comments