1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
import { Index } from "npm:@upstash/vector"
const index = new Index({
url: Deno.env.get("upstashValtownVectorUrl"),
token: Deno.env.get("upstashValtownVectorToken"),
})
// index.reset(); // resets the index!! deletes everything
// await index.upsert({
// id: "id1",
// data: "my kitty is mivi!",
// metadata: { petName: "mivi" },
// });
// await index.upsert({
// id: "id2",
// data: "I love my kitty!",
// metadata: { whodoilove: "mivi" },
// });
// await index.upsert({
// id: "id3",
// data: "my giraffe's name is joe",
// metadata: { name: "joe" },
// });
console.log('results:', await index.query({
data: "kitty",
topK: 5,
includeVectors: false,
includeMetadata: true,
includeData: true,
}));
Val Town is a social website to write and deploy JavaScript.
Build APIs and schedule functions from your browser.
Comments
Nobody has commented on this val yet: be the first!
September 2, 2024