Skip to content

Commit 4d48216

Browse files
authored
Merge pull request #72 from diberry/diberry/0623-vector-search-ts
Vector Search TS
2 parents b613e96 + b676740 commit 4d48216

35 files changed

+2761
-0
lines changed

.devcontainer/devcontainer.json

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
// For format details, see https://aka.ms/devcontainer.json. For config options, see the
2+
// README at: https://github.com/devcontainers/templates/tree/main/src/typescript-node
3+
{
4+
"name": "Node.js & TypeScript",
5+
// Or use a Dockerfile or Docker Compose file. More info: https://containers.dev/guide/dockerfile
6+
"image": "mcr.microsoft.com/devcontainers/typescript-node:1-22-bookworm",
7+
"features": {
8+
"ghcr.io/devcontainers/features/azure-cli:1": {}
9+
},
10+
"customizations": {
11+
"vscode": {
12+
"extensions": [
13+
"humao.rest-client"
14+
]
15+
}
16+
}
17+
18+
// Features to add to the dev container. More info: https://containers.dev/features.
19+
// "features": {},
20+
21+
// Use 'forwardPorts' to make a list of ports inside the container available locally.
22+
// "forwardPorts": [],
23+
24+
// Use 'postCreateCommand' to run commands after the container is created.
25+
// "postCreateCommand": "yarn install",
26+
27+
// Configure tool-specific properties.
28+
// "customizations": {},
29+
30+
// Uncomment to connect as root instead. More info: https://aka.ms/dev-containers-non-root.
31+
// "remoteUser": "root"
32+
}

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ bower_components
2222
# node-waf configuration
2323
.lock-wscript
2424
# Compiled binary addons (https://nodejs.org/api/addons.html)
25+
dist/
2526
build
2627
build/Release
2728
# Dependency directories
Lines changed: 177 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,177 @@
1+
@baseUrl = {{$dotenv AZURE_SEARCH_ENDPOINT}}
2+
@apiKey = {{$dotenv AZURE_SEARCH_KEY}}
3+
@indexName = {{$dotenv AZURE_SEARCH_INDEX_NAME}}
4+
5+
### Create a new index
6+
POST {{baseUrl}}/indexes?api-version=2024-07-01 HTTP/1.1
7+
Content-Type: application/json
8+
api-key: {{apiKey}}
9+
10+
{
11+
"name": {{indexName}},
12+
"fields": [
13+
{
14+
"name": "HotelId",
15+
"type": "Edm.String",
16+
"searchable": false,
17+
"filterable": true,
18+
"retrievable": true,
19+
"sortable": false,
20+
"facetable": false,
21+
"key": true
22+
},
23+
{
24+
"name": "HotelName",
25+
"type": "Edm.String",
26+
"searchable": true,
27+
"filterable": false,
28+
"retrievable": true,
29+
"sortable": true,
30+
"facetable": false
31+
},
32+
{
33+
"name": "Description",
34+
"type": "Edm.String",
35+
"searchable": true,
36+
"filterable": false,
37+
"retrievable": true,
38+
"sortable": false,
39+
"facetable": false
40+
},
41+
{
42+
"name": "DescriptionVector",
43+
"type": "Collection(Edm.Single)",
44+
"searchable": true,
45+
"retrievable": true,
46+
"dimensions": 1536,
47+
"vectorSearchProfile": "my-vector-profile"
48+
},
49+
{
50+
"name": "Category",
51+
"type": "Edm.String",
52+
"searchable": true,
53+
"filterable": true,
54+
"retrievable": true,
55+
"sortable": true,
56+
"facetable": true
57+
},
58+
{
59+
"name": "Tags",
60+
"type": "Collection(Edm.String)",
61+
"searchable": true,
62+
"filterable": true,
63+
"retrievable": true,
64+
"sortable": false,
65+
"facetable": true
66+
},
67+
{
68+
"name": "ParkingIncluded",
69+
"type": "Edm.Boolean",
70+
"searchable": false,
71+
"filterable": true,
72+
"retrievable": true,
73+
"sortable": true,
74+
"facetable": true
75+
},
76+
{
77+
"name": "LastRenovationDate",
78+
"type": "Edm.DateTimeOffset",
79+
"searchable": false,
80+
"filterable": true,
81+
"retrievable": true,
82+
"sortable": true,
83+
"facetable": true
84+
},
85+
{
86+
"name": "Rating",
87+
"type": "Edm.Double",
88+
"searchable": false,
89+
"filterable": true,
90+
"retrievable": true,
91+
"sortable": true,
92+
"facetable": true
93+
},
94+
{
95+
"name": "Address",
96+
"type": "Edm.ComplexType",
97+
"fields": [
98+
{
99+
"name": "StreetAddress", "type": "Edm.String",
100+
"searchable": true, "filterable": false, "retrievable": true, "sortable": false, "facetable": false
101+
},
102+
{
103+
"name": "City", "type": "Edm.String",
104+
"searchable": true, "filterable": true, "retrievable": true, "sortable": true, "facetable": true
105+
},
106+
{
107+
"name": "StateProvince", "type": "Edm.String",
108+
"searchable": true, "filterable": true, "retrievable": true, "sortable": true, "facetable": true
109+
},
110+
{
111+
"name": "PostalCode", "type": "Edm.String",
112+
"searchable": true, "filterable": true, "retrievable": true, "sortable": true, "facetable": true
113+
},
114+
{
115+
"name": "Country", "type": "Edm.String",
116+
"searchable": true, "filterable": true, "retrievable": true, "sortable": true, "facetable": true
117+
}
118+
]
119+
},
120+
{
121+
"name": "Location",
122+
"type": "Edm.GeographyPoint",
123+
"searchable": false,
124+
"filterable": true,
125+
"retrievable": true,
126+
"sortable": true,
127+
"facetable": false
128+
}
129+
],
130+
"vectorSearch": {
131+
"algorithms": [
132+
{
133+
"name": "hnsw-vector-config",
134+
"kind": "hnsw",
135+
"hnswParameters":
136+
{
137+
"m": 4,
138+
"efConstruction": 400,
139+
"efSearch": 500,
140+
"metric": "cosine"
141+
}
142+
},
143+
{
144+
"name": "eknn-vector-config",
145+
"kind": "exhaustiveKnn",
146+
"exhaustiveKnnParameters":
147+
{
148+
"metric": "cosine"
149+
}
150+
}
151+
],
152+
"profiles": [
153+
{
154+
"name": "my-vector-profile",
155+
"algorithm": "hnsw-vector-config"
156+
}
157+
]
158+
},
159+
"semantic": {
160+
"configurations": [
161+
{
162+
"name": "semantic-config",
163+
"prioritizedFields": {
164+
"titleField": {
165+
"fieldName": "HotelName"
166+
},
167+
"prioritizedContentFields": [
168+
{ "fieldName": "Description" }
169+
],
170+
"prioritizedKeywordsFields": [
171+
{ "fieldName": "Category" }
172+
]
173+
}
174+
}
175+
]
176+
}
177+
}

quickstart-vector-js/http/index-upload.http

Lines changed: 242 additions & 0 deletions
Large diffs are not rendered by default.

quickstart-vector-js/http/sample.env

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
AZURE_SEARCH_ENDPOINT=https://your-search-service.search.windows.net
2+
AZURE_SEARCH_INDEX_NAME=hotels-vector-quickstart

quickstart-vector-js/http/search-geo-filter.http

Lines changed: 27 additions & 0 deletions
Large diffs are not rendered by default.

quickstart-vector-js/http/search-hybrid-search.http

Lines changed: 26 additions & 0 deletions
Large diffs are not rendered by default.

quickstart-vector-js/http/search-semantic-hybrid.http

Lines changed: 27 additions & 0 deletions
Large diffs are not rendered by default.

quickstart-vector-js/http/search-single-vector-search-filtered.http

Lines changed: 24 additions & 0 deletions
Large diffs are not rendered by default.

quickstart-vector-js/http/search-single-vector-search-sdk.http

Lines changed: 23 additions & 0 deletions
Large diffs are not rendered by default.

0 commit comments

Comments
 (0)