@upstash/vector 1.2.0-canary → 1.2.0-canary-hybrid-1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -49,11 +49,11 @@ const index = new Index<Metadata>({
49
49
  token: "<UPSTASH_VECTOR_REST_TOKEN>",
50
50
  });
51
51
 
52
- //Upsert data
52
+ // Upsert to dense index
53
53
  await index.upsert([{
54
54
  id: 'upstash-rocks',
55
55
  vector: [
56
- .... // embedding values
56
+ 0.13, 0.87, ... // dense embedding
57
57
  ],
58
58
  metadata: {
59
59
  title: 'Lord of The Rings',
@@ -62,13 +62,44 @@ await index.upsert([{
62
62
  }
63
63
  }])
64
64
 
65
+ // Upsert to sparse index
66
+ await index.upsert([{
67
+ id: 'upstash-rocks',
68
+ sparseVector: { // sparse embedding
69
+ indices: [2, 3],
70
+ values: [0.13, 0.87],
71
+ },
72
+ metadata: {
73
+ title: 'Lord of The Rings',
74
+ genre: 'fantasy',
75
+ category: 'classic'
76
+ }
77
+ }])
78
+
79
+ // Upsert to hybrid index
80
+ await index.upsert([{
81
+ id: 'upstash-rocks',
82
+ vector: [
83
+ 0.13, 0.87, ... // dense embedding
84
+ ],
85
+ sparseVector: { // sparse embedding
86
+ indices: [2, 3],
87
+ values: [0.13, 0.87],
88
+ },
89
+ metadata: {
90
+ title: 'Lord of The Rings',
91
+ genre: 'fantasy',
92
+ category: 'classic'
93
+ }
94
+ }])
95
+
65
96
  // Upsert data as plain text.
66
97
  await index.upsert([{
67
98
  id: 'tokyo',
68
99
  data: "Tokyo is the capital of Japan.",
69
100
  }])
70
101
 
71
- //Upsert data alongside with your embedding
102
+ // Upsert data alongside with your embedding
72
103
  await index.upsert([{
73
104
  id: 'tokyo',
74
105
  data: "Tokyo is the capital of Japan.",
@@ -76,7 +107,7 @@ await index.upsert([{
76
107
  }])
77
108
 
78
109
 
79
- //Query data
110
+ // Query data
80
111
  const results = await index.query<Metadata>(
81
112
  {
82
113
  vector: [
@@ -92,7 +123,7 @@ const results = await index.query<Metadata>(
92
123
  }
93
124
  )
94
125
 
95
- //Query with your data
126
+ // Query with your data
96
127
  const results = await index.query(
97
128
  {
98
129
  data: "Where is the capital of Japan",
@@ -100,7 +131,7 @@ const results = await index.query(
100
131
  },
101
132
  )
102
133
 
103
- //Query with your data
134
+ // Query with your data
104
135
  const results = await index.query(
105
136
  {
106
137
  vector: [
@@ -113,7 +144,7 @@ const results = await index.query(
113
144
 
114
145
  // If you wanna learn more about filtering check: [Metadata Filtering](https://upstash.com/docs/vector/features/filtering)
115
146
 
116
- //Update data
147
+ // Update data
117
148
  await index.upsert(
118
149
  {
119
150
  id: "upstash-rocks",
@@ -128,19 +159,19 @@ await index.upsert(
128
159
  }
129
160
  );
130
161
 
131
- //Delete record
162
+ // Delete record
132
163
  await index.delete("upstash-rocks", {namespace: "example-namespace"});
133
164
 
134
- //Delete many by id
165
+ // Delete many by id
135
166
  await index.delete(["id-1", "id-2", "id-3"]);
136
167
 
137
- //Fetch records by their IDs
168
+ // Fetch records by their IDs
138
169
  await index.fetch(["id-1", "id-2"], {namespace: "example-namespace"});
139
170
 
140
- //Fetch records by their IDs
171
+ // Fetch records by their IDs
141
172
  await index.fetch(["id-1", "id-2"], {namespace: "example-namespace", includeData:true});
142
173
 
143
- //Fetch records with range
174
+ // Fetch records with range
144
175
  await index.range(
145
176
  {
146
177
  cursor: 0,
@@ -152,19 +183,19 @@ await index.range(
152
183
  }
153
184
  );
154
185
 
155
- //Reset index
186
+ // Reset index
156
187
  await index.reset();
157
188
 
158
- //Info about index
189
+ // Info about index
159
190
  await index.info();
160
191
 
161
- //Random vector based on stored vectors
192
+ // Random vector based on stored vectors
162
193
  await index.random({namespace: "example-namespace"});
163
194
 
164
- //List existing namesapces
195
+ // List existing namesapces
165
196
  await index.listNamespaces();
166
197
 
167
- //Delete a namespace
198
+ // Delete a namespace
168
199
  await index.deleteNamespace("namespace-to-be-deleted");
169
200
  ```
170
201
 
@@ -190,7 +221,7 @@ const index = new Index<Metadata>({
190
221
 
191
222
  const namespace = index.namespace("example-namespace");
192
223
 
193
- //Upsert Data
224
+ // Upsert Data
194
225
  await namespace.upsert([{
195
226
  id: 'upstash-rocks',
196
227
  vector: [
@@ -203,7 +234,7 @@ await namespace.upsert([{
203
234
  }
204
235
  }])
205
236
 
206
- //Query Vector
237
+ // Query Vector
207
238
  const results = await namespace.query<Metadata>(
208
239
  {
209
240
  vector: [
@@ -216,10 +247,10 @@ const results = await namespace.query<Metadata>(
216
247
  },
217
248
  )
218
249
 
219
- //Delete Record
250
+ // Delete Record
220
251
  await namespace.delete("upstash-rocks");
221
252
 
222
- //Fetch records by their IDs
253
+ // Fetch records by their IDs
223
254
  await namespace.fetch(["id-1", "id-2"]);
224
255
  ```
225
256
 
@@ -58,7 +58,9 @@ var HttpClient = class {
58
58
  break;
59
59
  }
60
60
  error = error_;
61
- await new Promise((r) => setTimeout(r, this.retry.backoff(i)));
61
+ if (i < this.retry.attempts) {
62
+ await new Promise((r) => setTimeout(r, this.retry.backoff(i)));
63
+ }
62
64
  }
63
65
  }
64
66
  if (!res) {
@@ -72,6 +74,23 @@ var HttpClient = class {
72
74
  }
73
75
  };
74
76
 
77
+ // src/commands/client/query/types.ts
78
+ var WeightingStrategy = /* @__PURE__ */ ((WeightingStrategy2) => {
79
+ WeightingStrategy2["IDF"] = "IDF";
80
+ return WeightingStrategy2;
81
+ })(WeightingStrategy || {});
82
+ var FusionAlgorithm = /* @__PURE__ */ ((FusionAlgorithm2) => {
83
+ FusionAlgorithm2["RRF"] = "RRF";
84
+ FusionAlgorithm2["DBSF"] = "DBSF";
85
+ return FusionAlgorithm2;
86
+ })(FusionAlgorithm || {});
87
+ var QueryMode = /* @__PURE__ */ ((QueryMode2) => {
88
+ QueryMode2["HYBRID"] = "HYBRID";
89
+ QueryMode2["DENSE"] = "DENSE";
90
+ QueryMode2["SPARSE"] = "SPARSE";
91
+ return QueryMode2;
92
+ })(QueryMode || {});
93
+
75
94
  // src/commands/command.ts
76
95
  var Command = class {
77
96
  payload;
@@ -98,23 +117,6 @@ var Command = class {
98
117
  }
99
118
  };
100
119
 
101
- // src/commands/client/delete/index.ts
102
- var DeleteCommand = class extends Command {
103
- constructor(id, options) {
104
- let endpoint = "delete";
105
- if (options?.namespace) {
106
- endpoint = `${endpoint}/${options.namespace}`;
107
- }
108
- const finalArr = [];
109
- if (Array.isArray(id)) {
110
- finalArr.push(...id);
111
- } else {
112
- finalArr.push(id);
113
- }
114
- super(finalArr, endpoint);
115
- }
116
- };
117
-
118
120
  // src/commands/client/query/query-many/index.ts
119
121
  var QueryManyCommand = class extends Command {
120
122
  constructor(payload, options) {
@@ -134,6 +136,8 @@ var QueryCommand = class extends Command {
134
136
  let endpoint = "query";
135
137
  if ("data" in payload) {
136
138
  endpoint = "query-data";
139
+ } else if (!payload.vector && !payload.sparseVector) {
140
+ throw new UpstashError("Either data, vector or sparseVector should be provided.");
137
141
  }
138
142
  if (options?.namespace) {
139
143
  endpoint = `${endpoint}/${options.namespace}`;
@@ -142,6 +146,23 @@ var QueryCommand = class extends Command {
142
146
  }
143
147
  };
144
148
 
149
+ // src/commands/client/delete/index.ts
150
+ var DeleteCommand = class extends Command {
151
+ constructor(id, options) {
152
+ let endpoint = "delete";
153
+ if (options?.namespace) {
154
+ endpoint = `${endpoint}/${options.namespace}`;
155
+ }
156
+ const finalArr = [];
157
+ if (Array.isArray(id)) {
158
+ finalArr.push(...id);
159
+ } else {
160
+ finalArr.push(id);
161
+ }
162
+ super(finalArr, endpoint);
163
+ }
164
+ };
165
+
145
166
  // src/commands/client/upsert/index.ts
146
167
  var UpsertCommand = class extends Command {
147
168
  constructor(payload, opts) {
@@ -159,7 +180,7 @@ var UpsertCommand = class extends Command {
159
180
  }
160
181
  };
161
182
  var isVectorPayload = (payload) => {
162
- return "vector" in payload;
183
+ return "vector" in payload || "sparseVector" in payload;
163
184
  };
164
185
 
165
186
  // src/commands/client/fetch/index.ts
@@ -757,5 +778,8 @@ var Index = class {
757
778
 
758
779
  export {
759
780
  HttpClient,
781
+ WeightingStrategy,
782
+ FusionAlgorithm,
783
+ QueryMode,
760
784
  Index
761
785
  };
@@ -1,5 +1,5 @@
1
- import { R as RequesterConfig, D as Dict, I as Index$1 } from './vector-gR6tGrYi.mjs';
2
- export { F as FetchResult, d as InfoResult, Q as QueryResult, c as RangeResult, a as Requester, U as UpstashRequest, b as UpstashResponse, V as Vector } from './vector-gR6tGrYi.mjs';
1
+ import { R as RequesterConfig, D as Dict, I as Index$1 } from './vector-Cj9w3M1X.mjs';
2
+ export { d as FetchResult, F as FusionAlgorithm, f as InfoResult, Q as QueryMode, e as QueryResult, c as RangeResult, a as Requester, U as UpstashRequest, b as UpstashResponse, V as Vector, W as WeightingStrategy } from './vector-Cj9w3M1X.mjs';
3
3
 
4
4
  /**
5
5
  * Connection credentials for upstash vector.
@@ -1,5 +1,5 @@
1
- import { R as RequesterConfig, D as Dict, I as Index$1 } from './vector-gR6tGrYi.js';
2
- export { F as FetchResult, d as InfoResult, Q as QueryResult, c as RangeResult, a as Requester, U as UpstashRequest, b as UpstashResponse, V as Vector } from './vector-gR6tGrYi.js';
1
+ import { R as RequesterConfig, D as Dict, I as Index$1 } from './vector-Cj9w3M1X.js';
2
+ export { d as FetchResult, F as FusionAlgorithm, f as InfoResult, Q as QueryMode, e as QueryResult, c as RangeResult, a as Requester, U as UpstashRequest, b as UpstashResponse, V as Vector, W as WeightingStrategy } from './vector-Cj9w3M1X.js';
3
3
 
4
4
  /**
5
5
  * Connection credentials for upstash vector.
@@ -20,7 +20,10 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
20
20
  // src/platforms/cloudflare.ts
21
21
  var cloudflare_exports = {};
22
22
  __export(cloudflare_exports, {
23
- Index: () => Index2
23
+ FusionAlgorithm: () => FusionAlgorithm,
24
+ Index: () => Index2,
25
+ QueryMode: () => QueryMode,
26
+ WeightingStrategy: () => WeightingStrategy
24
27
  });
25
28
  module.exports = __toCommonJS(cloudflare_exports);
26
29
 
@@ -84,7 +87,9 @@ var HttpClient = class {
84
87
  break;
85
88
  }
86
89
  error = error_;
87
- await new Promise((r) => setTimeout(r, this.retry.backoff(i)));
90
+ if (i < this.retry.attempts) {
91
+ await new Promise((r) => setTimeout(r, this.retry.backoff(i)));
92
+ }
88
93
  }
89
94
  }
90
95
  if (!res) {
@@ -160,6 +165,8 @@ var QueryCommand = class extends Command {
160
165
  let endpoint = "query";
161
166
  if ("data" in payload) {
162
167
  endpoint = "query-data";
168
+ } else if (!payload.vector && !payload.sparseVector) {
169
+ throw new UpstashError("Either data, vector or sparseVector should be provided.");
163
170
  }
164
171
  if (options?.namespace) {
165
172
  endpoint = `${endpoint}/${options.namespace}`;
@@ -168,6 +175,23 @@ var QueryCommand = class extends Command {
168
175
  }
169
176
  };
170
177
 
178
+ // src/commands/client/query/types.ts
179
+ var WeightingStrategy = /* @__PURE__ */ ((WeightingStrategy2) => {
180
+ WeightingStrategy2["IDF"] = "IDF";
181
+ return WeightingStrategy2;
182
+ })(WeightingStrategy || {});
183
+ var FusionAlgorithm = /* @__PURE__ */ ((FusionAlgorithm2) => {
184
+ FusionAlgorithm2["RRF"] = "RRF";
185
+ FusionAlgorithm2["DBSF"] = "DBSF";
186
+ return FusionAlgorithm2;
187
+ })(FusionAlgorithm || {});
188
+ var QueryMode = /* @__PURE__ */ ((QueryMode2) => {
189
+ QueryMode2["HYBRID"] = "HYBRID";
190
+ QueryMode2["DENSE"] = "DENSE";
191
+ QueryMode2["SPARSE"] = "SPARSE";
192
+ return QueryMode2;
193
+ })(QueryMode || {});
194
+
171
195
  // src/commands/client/upsert/index.ts
172
196
  var UpsertCommand = class extends Command {
173
197
  constructor(payload, opts) {
@@ -185,7 +209,7 @@ var UpsertCommand = class extends Command {
185
209
  }
186
210
  };
187
211
  var isVectorPayload = (payload) => {
188
- return "vector" in payload;
212
+ return "vector" in payload || "sparseVector" in payload;
189
213
  };
190
214
 
191
215
  // src/commands/client/fetch/index.ts
@@ -800,8 +824,9 @@ var Index2 = class _Index extends Index {
800
824
  * ```
801
825
  */
802
826
  constructor(config) {
803
- const token = config?.token ?? process.env.NEXT_PUBLIC_UPSTASH_VECTOR_REST_TOKEN ?? process.env.UPSTASH_VECTOR_REST_TOKEN;
804
- const url = config?.url ?? process.env.NEXT_PUBLIC_UPSTASH_VECTOR_REST_URL ?? process.env.UPSTASH_VECTOR_REST_URL;
827
+ const safeProcess = typeof process === "undefined" ? {} : process;
828
+ const token = config?.token ?? safeProcess.NEXT_PUBLIC_UPSTASH_VECTOR_REST_TOKEN ?? safeProcess.UPSTASH_VECTOR_REST_TOKEN;
829
+ const url = config?.url ?? safeProcess.NEXT_PUBLIC_UPSTASH_VECTOR_REST_URL ?? safeProcess.UPSTASH_VECTOR_REST_URL;
805
830
  if (!token) {
806
831
  throw new Error("UPSTASH_VECTOR_REST_TOKEN is missing!");
807
832
  }
@@ -855,5 +880,8 @@ var Index2 = class _Index extends Index {
855
880
  };
856
881
  // Annotate the CommonJS export names for ESM import in node:
857
882
  0 && (module.exports = {
858
- Index
883
+ FusionAlgorithm,
884
+ Index,
885
+ QueryMode,
886
+ WeightingStrategy
859
887
  });
@@ -1,7 +1,10 @@
1
1
  import {
2
+ FusionAlgorithm,
2
3
  HttpClient,
3
- Index
4
- } from "./chunk-XN6MKCVR.mjs";
4
+ Index,
5
+ QueryMode,
6
+ WeightingStrategy
7
+ } from "./chunk-4AKSNQD7.mjs";
5
8
 
6
9
  // src/platforms/cloudflare.ts
7
10
  var Index2 = class _Index extends Index {
@@ -22,8 +25,9 @@ var Index2 = class _Index extends Index {
22
25
  * ```
23
26
  */
24
27
  constructor(config) {
25
- const token = config?.token ?? process.env.NEXT_PUBLIC_UPSTASH_VECTOR_REST_TOKEN ?? process.env.UPSTASH_VECTOR_REST_TOKEN;
26
- const url = config?.url ?? process.env.NEXT_PUBLIC_UPSTASH_VECTOR_REST_URL ?? process.env.UPSTASH_VECTOR_REST_URL;
28
+ const safeProcess = typeof process === "undefined" ? {} : process;
29
+ const token = config?.token ?? safeProcess.NEXT_PUBLIC_UPSTASH_VECTOR_REST_TOKEN ?? safeProcess.UPSTASH_VECTOR_REST_TOKEN;
30
+ const url = config?.url ?? safeProcess.NEXT_PUBLIC_UPSTASH_VECTOR_REST_URL ?? safeProcess.UPSTASH_VECTOR_REST_URL;
27
31
  if (!token) {
28
32
  throw new Error("UPSTASH_VECTOR_REST_TOKEN is missing!");
29
33
  }
@@ -76,5 +80,8 @@ var Index2 = class _Index extends Index {
76
80
  }
77
81
  };
78
82
  export {
79
- Index2 as Index
83
+ FusionAlgorithm,
84
+ Index2 as Index,
85
+ QueryMode,
86
+ WeightingStrategy
80
87
  };
package/dist/nodejs.d.mts CHANGED
@@ -1,5 +1,5 @@
1
- import { R as RequesterConfig, D as Dict, I as Index$1, a as Requester } from './vector-gR6tGrYi.mjs';
2
- export { F as FetchResult, d as InfoResult, Q as QueryResult, c as RangeResult, U as UpstashRequest, b as UpstashResponse, V as Vector } from './vector-gR6tGrYi.mjs';
1
+ import { R as RequesterConfig, D as Dict, I as Index$1, a as Requester } from './vector-Cj9w3M1X.mjs';
2
+ export { d as FetchResult, F as FusionAlgorithm, f as InfoResult, Q as QueryMode, e as QueryResult, c as RangeResult, U as UpstashRequest, b as UpstashResponse, V as Vector, W as WeightingStrategy } from './vector-Cj9w3M1X.mjs';
3
3
 
4
4
  /**
5
5
  * Connection credentials for upstash vector.
package/dist/nodejs.d.ts CHANGED
@@ -1,5 +1,5 @@
1
- import { R as RequesterConfig, D as Dict, I as Index$1, a as Requester } from './vector-gR6tGrYi.js';
2
- export { F as FetchResult, d as InfoResult, Q as QueryResult, c as RangeResult, U as UpstashRequest, b as UpstashResponse, V as Vector } from './vector-gR6tGrYi.js';
1
+ import { R as RequesterConfig, D as Dict, I as Index$1, a as Requester } from './vector-Cj9w3M1X.js';
2
+ export { d as FetchResult, F as FusionAlgorithm, f as InfoResult, Q as QueryMode, e as QueryResult, c as RangeResult, U as UpstashRequest, b as UpstashResponse, V as Vector, W as WeightingStrategy } from './vector-Cj9w3M1X.js';
3
3
 
4
4
  /**
5
5
  * Connection credentials for upstash vector.
package/dist/nodejs.js CHANGED
@@ -20,7 +20,10 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
20
20
  // src/platforms/nodejs.ts
21
21
  var nodejs_exports = {};
22
22
  __export(nodejs_exports, {
23
- Index: () => Index2
23
+ FusionAlgorithm: () => FusionAlgorithm,
24
+ Index: () => Index2,
25
+ QueryMode: () => QueryMode,
26
+ WeightingStrategy: () => WeightingStrategy
24
27
  });
25
28
  module.exports = __toCommonJS(nodejs_exports);
26
29
 
@@ -84,7 +87,9 @@ var HttpClient = class {
84
87
  break;
85
88
  }
86
89
  error = error_;
87
- await new Promise((r) => setTimeout(r, this.retry.backoff(i)));
90
+ if (i < this.retry.attempts) {
91
+ await new Promise((r) => setTimeout(r, this.retry.backoff(i)));
92
+ }
88
93
  }
89
94
  }
90
95
  if (!res) {
@@ -160,6 +165,8 @@ var QueryCommand = class extends Command {
160
165
  let endpoint = "query";
161
166
  if ("data" in payload) {
162
167
  endpoint = "query-data";
168
+ } else if (!payload.vector && !payload.sparseVector) {
169
+ throw new UpstashError("Either data, vector or sparseVector should be provided.");
163
170
  }
164
171
  if (options?.namespace) {
165
172
  endpoint = `${endpoint}/${options.namespace}`;
@@ -168,6 +175,23 @@ var QueryCommand = class extends Command {
168
175
  }
169
176
  };
170
177
 
178
+ // src/commands/client/query/types.ts
179
+ var WeightingStrategy = /* @__PURE__ */ ((WeightingStrategy2) => {
180
+ WeightingStrategy2["IDF"] = "IDF";
181
+ return WeightingStrategy2;
182
+ })(WeightingStrategy || {});
183
+ var FusionAlgorithm = /* @__PURE__ */ ((FusionAlgorithm2) => {
184
+ FusionAlgorithm2["RRF"] = "RRF";
185
+ FusionAlgorithm2["DBSF"] = "DBSF";
186
+ return FusionAlgorithm2;
187
+ })(FusionAlgorithm || {});
188
+ var QueryMode = /* @__PURE__ */ ((QueryMode2) => {
189
+ QueryMode2["HYBRID"] = "HYBRID";
190
+ QueryMode2["DENSE"] = "DENSE";
191
+ QueryMode2["SPARSE"] = "SPARSE";
192
+ return QueryMode2;
193
+ })(QueryMode || {});
194
+
171
195
  // src/commands/client/upsert/index.ts
172
196
  var UpsertCommand = class extends Command {
173
197
  constructor(payload, opts) {
@@ -185,7 +209,7 @@ var UpsertCommand = class extends Command {
185
209
  }
186
210
  };
187
211
  var isVectorPayload = (payload) => {
188
- return "vector" in payload;
212
+ return "vector" in payload || "sparseVector" in payload;
189
213
  };
190
214
 
191
215
  // src/commands/client/fetch/index.ts
@@ -835,5 +859,8 @@ var Index2 = class _Index extends Index {
835
859
  };
836
860
  // Annotate the CommonJS export names for ESM import in node:
837
861
  0 && (module.exports = {
838
- Index
862
+ FusionAlgorithm,
863
+ Index,
864
+ QueryMode,
865
+ WeightingStrategy
839
866
  });
package/dist/nodejs.mjs CHANGED
@@ -1,7 +1,10 @@
1
1
  import {
2
+ FusionAlgorithm,
2
3
  HttpClient,
3
- Index
4
- } from "./chunk-XN6MKCVR.mjs";
4
+ Index,
5
+ QueryMode,
6
+ WeightingStrategy
7
+ } from "./chunk-4AKSNQD7.mjs";
5
8
 
6
9
  // src/platforms/nodejs.ts
7
10
  var Index2 = class _Index extends Index {
@@ -56,5 +59,8 @@ var Index2 = class _Index extends Index {
56
59
  }
57
60
  };
58
61
  export {
59
- Index2 as Index
62
+ FusionAlgorithm,
63
+ Index2 as Index,
64
+ QueryMode,
65
+ WeightingStrategy
60
66
  };
@@ -45,11 +45,16 @@ type RequesterConfig = {
45
45
  type Vector<TMetadata = Dict> = {
46
46
  id: string;
47
47
  vector?: number[];
48
+ sparseVector?: SparseVector;
48
49
  metadata?: TMetadata;
49
50
  data?: string;
50
51
  };
51
52
  type NAMESPACE = string;
52
53
  type Dict = Record<string, unknown>;
54
+ type SparseVector = {
55
+ indices: number[];
56
+ values: number[];
57
+ };
53
58
 
54
59
  declare const _ENDPOINTS: readonly ["upsert", "update", "query", "delete", "fetch", "reset", "range", "info", "resumable-query", "resumable-query-data", "resumable-query-next", "resumable-query-end", "upsert-data", "query-data", "list-namespaces", "delete-namespace"];
55
60
  type EndpointVariants = (typeof _ENDPOINTS)[number] | `${(typeof _ENDPOINTS)[number]}/${NAMESPACE}` | `reset?all`;
@@ -80,23 +85,142 @@ type QueryCommandPayload = {
80
85
  includeVectors?: boolean;
81
86
  includeMetadata?: boolean;
82
87
  includeData?: boolean;
88
+ weightingStrategy?: WeightingStrategy;
89
+ fusionAlgorithm?: FusionAlgorithm;
90
+ queryMode?: QueryMode;
83
91
  } & ({
84
92
  vector: number[];
93
+ sparseVector?: SparseVector;
94
+ data?: never;
95
+ } | {
96
+ vector?: number[];
97
+ sparseVector: SparseVector;
85
98
  data?: never;
86
99
  } | {
87
100
  data: string;
88
101
  vector?: never;
102
+ sparseVector?: never;
89
103
  });
90
104
  type QueryResult<TMetadata = Dict> = {
91
105
  id: number | string;
92
106
  score: number;
93
107
  vector?: number[];
108
+ sparseVector?: SparseVector;
94
109
  metadata?: TMetadata;
95
110
  data?: string;
96
111
  };
97
112
  type QueryCommandOptions = {
98
113
  namespace?: string;
99
114
  };
115
+ /**
116
+ * For sparse vectors, what kind of weighting strategy
117
+ * should be used while querying the matching non-zero
118
+ * dimension values of the query vector with the documents.
119
+ *
120
+ * If not provided, no weighting will be used.
121
+ */
122
+ declare enum WeightingStrategy {
123
+ /**
124
+ * Inverse document frequency.
125
+ *
126
+ * It is recommended to use this weighting strategy for
127
+ * BM25 sparse embedding models.
128
+ *
129
+ * It is calculated as
130
+ *
131
+ * ln(((N - n(q) + 0.5) / (n(q) + 0.5)) + 1) where
132
+ * N: Total number of sparse vectors.
133
+ * n(q): Total number of sparse vectors having non-zero value
134
+ * for that particular dimension.
135
+ * ln: Natural logarithm
136
+ *
137
+ * The values of N and n(q) are maintained by Upstash as the
138
+ * vectors are indexed.
139
+ */
140
+ IDF = "IDF"
141
+ }
142
+ /**
143
+ * Fusion algorithm to use while fusing scores
144
+ * from dense and sparse components of a hybrid index.
145
+ *
146
+ * If not provided, defaults to `RRF`.
147
+ */
148
+ declare enum FusionAlgorithm {
149
+ /**
150
+ * Reciprocal rank fusion.
151
+ *
152
+ * Each sorted score from the dense and sparse indexes are
153
+ * mapped to 1 / (rank + K), where rank is the order of the
154
+ * score in the dense or sparse scores and K is a constant
155
+ * with the value of 60.
156
+ *
157
+ * Then, scores from the dense and sparse components are
158
+ * deduplicated (i.e. if a score for the same vector is present
159
+ * in both dense and sparse scores, the mapped scores are
160
+ * added; otherwise individual mapped scores are used)
161
+ * and the final result is returned as the topK values
162
+ * of this final list.
163
+ *
164
+ * In short, this algorithm just takes the order of the scores
165
+ * into consideration.
166
+ */
167
+ RRF = "RRF",
168
+ /**
169
+ * Distribution based score fusion.
170
+ *
171
+ * Each sorted score from the dense and sparse indexes are
172
+ * normalized as
173
+ * (s - (mean - 3 * stddev)) / ((mean + 3 * stddev) - (mean - 3 * stddev))
174
+ * where s is the score, (mean - 3 * stddev) is the minimum,
175
+ * and (mean + 3 * stddev) is the maximum tail ends of the distribution.
176
+ *
177
+ * Then, scores from the dense and sparse components are
178
+ * deduplicated (i.e. if a score for the same vector is present
179
+ * in both dense and sparse scores, the normalized scores are
180
+ * added; otherwise individual normalized scores are used)
181
+ * and the final result is returned as the topK values
182
+ * of this final list.
183
+ *
184
+ * In short, this algorithm takes distribution of the scores
185
+ * into consideration as well, as opposed to the `RRF`.
186
+ */
187
+ DBSF = "DBSF"
188
+ }
189
+ /**
190
+ * Query mode for hybrid indexes with Upstash-hosted
191
+ * embedding models.
192
+ *
193
+ * Specifies whether to run the query in only the
194
+ * dense index, only the sparse index, or in both.
195
+ *
196
+ * If not provided, defaults to `HYBRID`.
197
+ */
198
+ declare enum QueryMode {
199
+ /**
200
+ * Runs the query in hybrid index mode, after embedding
201
+ * the raw text data into dense and sparse vectors.
202
+ *
203
+ * Query results from the dense and sparse index components
204
+ * of the hybrid index are fused before returning the result.
205
+ */
206
+ HYBRID = "HYBRID",
207
+ /**
208
+ * Runs the query in dense index mode, after embedding
209
+ * the raw text data into a dense vector.
210
+ *
211
+ * Only the query results from the dense index component
212
+ * of the hybrid index is returned.
213
+ */
214
+ DENSE = "DENSE",
215
+ /**
216
+ * Runs the query in sparse index mode, after embedding
217
+ * the raw text data into a sparse vector.
218
+ *
219
+ * Only the query results from the sparse index component
220
+ * of the hybrid index is returned.
221
+ */
222
+ SPARSE = "SPARSE"
223
+ }
100
224
 
101
225
  declare class QueryManyCommand<TMetadata> extends Command<QueryResult<TMetadata>[][]> {
102
226
  constructor(payload: QueryCommandPayload[], options?: QueryCommandOptions);
@@ -187,27 +311,51 @@ declare class Namespace<TIndexMetadata extends Dict = Dict> {
187
311
  *
188
312
  * @returns {string} A promise that resolves with the result of the upsert operation after the command is executed.
189
313
  */
190
- upsert: <TMetadata extends Dict = TIndexMetadata>(args: {
314
+ upsert: <TMetadata extends Dict = TIndexMetadata>(args: ({
191
315
  id: string | number;
192
- vector: number[];
193
316
  metadata?: (TMetadata extends infer U ? U : never) | undefined;
317
+ } & ({
318
+ vector: number[];
319
+ sparseVector?: undefined;
320
+ } | {
321
+ vector?: undefined;
322
+ sparseVector: SparseVector;
194
323
  } | {
324
+ vector: number[];
325
+ sparseVector: SparseVector;
326
+ })) | {
195
327
  id: string | number;
196
328
  data: string;
197
329
  metadata?: (TMetadata extends infer U ? U : never) | undefined;
198
- } | {
330
+ } | ({
199
331
  id: string | number;
200
- vector: number[];
201
332
  metadata?: (TMetadata extends infer U ? U : never) | undefined;
202
- }[] | {
333
+ } & ({
334
+ vector: number[];
335
+ sparseVector?: undefined;
336
+ } | {
337
+ vector?: undefined;
338
+ sparseVector: SparseVector;
339
+ } | {
340
+ vector: number[];
341
+ sparseVector: SparseVector;
342
+ }))[] | {
203
343
  id: string | number;
204
344
  data: string;
205
345
  metadata?: (TMetadata extends infer U ? U : never) | undefined;
206
346
  }[]) => Promise<string>;
207
- update: <TMetadata extends Dict = TIndexMetadata>(args: {
347
+ update: <TMetadata extends Dict = TIndexMetadata>(args: ({
208
348
  id: string | number;
349
+ } & ({
350
+ vector?: undefined;
351
+ sparseVector: SparseVector;
352
+ } | {
209
353
  vector: number[];
354
+ sparseVector?: undefined;
210
355
  } | {
356
+ vector: number[];
357
+ sparseVector: SparseVector;
358
+ })) | {
211
359
  id: string | number;
212
360
  data: string;
213
361
  } | {
@@ -480,29 +628,53 @@ declare class Index<TIndexMetadata extends Dict = Dict> {
480
628
  *
481
629
  * @returns {string} A promise that resolves with the result of the upsert operation after the command is executed.
482
630
  */
483
- upsert: <TMetadata extends Dict = TIndexMetadata>(args: {
631
+ upsert: <TMetadata extends Dict = TIndexMetadata>(args: ({
484
632
  id: string | number;
485
- vector: number[];
486
633
  metadata?: (TMetadata extends infer U ? U : never) | undefined;
634
+ } & ({
635
+ vector: number[];
636
+ sparseVector?: undefined;
487
637
  } | {
638
+ vector?: undefined;
639
+ sparseVector: SparseVector;
640
+ } | {
641
+ vector: number[];
642
+ sparseVector: SparseVector;
643
+ })) | {
488
644
  id: string | number;
489
645
  data: string;
490
646
  metadata?: (TMetadata extends infer U ? U : never) | undefined;
491
- } | {
647
+ } | ({
492
648
  id: string | number;
493
- vector: number[];
494
649
  metadata?: (TMetadata extends infer U ? U : never) | undefined;
495
- }[] | {
650
+ } & ({
651
+ vector: number[];
652
+ sparseVector?: undefined;
653
+ } | {
654
+ vector?: undefined;
655
+ sparseVector: SparseVector;
656
+ } | {
657
+ vector: number[];
658
+ sparseVector: SparseVector;
659
+ }))[] | {
496
660
  id: string | number;
497
661
  data: string;
498
662
  metadata?: (TMetadata extends infer U ? U : never) | undefined;
499
663
  }[], options?: {
500
664
  namespace?: string;
501
665
  }) => Promise<string>;
502
- update: <TMetadata extends Dict = TIndexMetadata>(args: {
666
+ update: <TMetadata extends Dict = TIndexMetadata>(args: ({
503
667
  id: string | number;
668
+ } & ({
669
+ vector?: undefined;
670
+ sparseVector: SparseVector;
671
+ } | {
504
672
  vector: number[];
673
+ sparseVector?: undefined;
505
674
  } | {
675
+ vector: number[];
676
+ sparseVector: SparseVector;
677
+ })) | {
506
678
  id: string | number;
507
679
  data: string;
508
680
  } | {
@@ -642,4 +814,4 @@ declare class Index<TIndexMetadata extends Dict = Dict> {
642
814
  deleteNamespace: (namespace: string) => Promise<string>;
643
815
  }
644
816
 
645
- export { type Dict as D, type FetchResult as F, Index as I, type QueryResult as Q, type RequesterConfig as R, type UpstashRequest as U, type Vector as V, type Requester as a, type UpstashResponse as b, type RangeResult as c, type InfoResult as d };
817
+ export { type Dict as D, FusionAlgorithm as F, Index as I, QueryMode as Q, type RequesterConfig as R, type UpstashRequest as U, type Vector as V, WeightingStrategy as W, type Requester as a, type UpstashResponse as b, type RangeResult as c, type FetchResult as d, type QueryResult as e, type InfoResult as f };
@@ -45,11 +45,16 @@ type RequesterConfig = {
45
45
  type Vector<TMetadata = Dict> = {
46
46
  id: string;
47
47
  vector?: number[];
48
+ sparseVector?: SparseVector;
48
49
  metadata?: TMetadata;
49
50
  data?: string;
50
51
  };
51
52
  type NAMESPACE = string;
52
53
  type Dict = Record<string, unknown>;
54
+ type SparseVector = {
55
+ indices: number[];
56
+ values: number[];
57
+ };
53
58
 
54
59
  declare const _ENDPOINTS: readonly ["upsert", "update", "query", "delete", "fetch", "reset", "range", "info", "resumable-query", "resumable-query-data", "resumable-query-next", "resumable-query-end", "upsert-data", "query-data", "list-namespaces", "delete-namespace"];
55
60
  type EndpointVariants = (typeof _ENDPOINTS)[number] | `${(typeof _ENDPOINTS)[number]}/${NAMESPACE}` | `reset?all`;
@@ -80,23 +85,142 @@ type QueryCommandPayload = {
80
85
  includeVectors?: boolean;
81
86
  includeMetadata?: boolean;
82
87
  includeData?: boolean;
88
+ weightingStrategy?: WeightingStrategy;
89
+ fusionAlgorithm?: FusionAlgorithm;
90
+ queryMode?: QueryMode;
83
91
  } & ({
84
92
  vector: number[];
93
+ sparseVector?: SparseVector;
94
+ data?: never;
95
+ } | {
96
+ vector?: number[];
97
+ sparseVector: SparseVector;
85
98
  data?: never;
86
99
  } | {
87
100
  data: string;
88
101
  vector?: never;
102
+ sparseVector?: never;
89
103
  });
90
104
  type QueryResult<TMetadata = Dict> = {
91
105
  id: number | string;
92
106
  score: number;
93
107
  vector?: number[];
108
+ sparseVector?: SparseVector;
94
109
  metadata?: TMetadata;
95
110
  data?: string;
96
111
  };
97
112
  type QueryCommandOptions = {
98
113
  namespace?: string;
99
114
  };
115
+ /**
116
+ * For sparse vectors, what kind of weighting strategy
117
+ * should be used while querying the matching non-zero
118
+ * dimension values of the query vector with the documents.
119
+ *
120
+ * If not provided, no weighting will be used.
121
+ */
122
+ declare enum WeightingStrategy {
123
+ /**
124
+ * Inverse document frequency.
125
+ *
126
+ * It is recommended to use this weighting strategy for
127
+ * BM25 sparse embedding models.
128
+ *
129
+ * It is calculated as
130
+ *
131
+ * ln(((N - n(q) + 0.5) / (n(q) + 0.5)) + 1) where
132
+ * N: Total number of sparse vectors.
133
+ * n(q): Total number of sparse vectors having non-zero value
134
+ * for that particular dimension.
135
+ * ln: Natural logarithm
136
+ *
137
+ * The values of N and n(q) are maintained by Upstash as the
138
+ * vectors are indexed.
139
+ */
140
+ IDF = "IDF"
141
+ }
142
+ /**
143
+ * Fusion algorithm to use while fusing scores
144
+ * from dense and sparse components of a hybrid index.
145
+ *
146
+ * If not provided, defaults to `RRF`.
147
+ */
148
+ declare enum FusionAlgorithm {
149
+ /**
150
+ * Reciprocal rank fusion.
151
+ *
152
+ * Each sorted score from the dense and sparse indexes are
153
+ * mapped to 1 / (rank + K), where rank is the order of the
154
+ * score in the dense or sparse scores and K is a constant
155
+ * with the value of 60.
156
+ *
157
+ * Then, scores from the dense and sparse components are
158
+ * deduplicated (i.e. if a score for the same vector is present
159
+ * in both dense and sparse scores, the mapped scores are
160
+ * added; otherwise individual mapped scores are used)
161
+ * and the final result is returned as the topK values
162
+ * of this final list.
163
+ *
164
+ * In short, this algorithm just takes the order of the scores
165
+ * into consideration.
166
+ */
167
+ RRF = "RRF",
168
+ /**
169
+ * Distribution based score fusion.
170
+ *
171
+ * Each sorted score from the dense and sparse indexes are
172
+ * normalized as
173
+ * (s - (mean - 3 * stddev)) / ((mean + 3 * stddev) - (mean - 3 * stddev))
174
+ * where s is the score, (mean - 3 * stddev) is the minimum,
175
+ * and (mean + 3 * stddev) is the maximum tail ends of the distribution.
176
+ *
177
+ * Then, scores from the dense and sparse components are
178
+ * deduplicated (i.e. if a score for the same vector is present
179
+ * in both dense and sparse scores, the normalized scores are
180
+ * added; otherwise individual normalized scores are used)
181
+ * and the final result is returned as the topK values
182
+ * of this final list.
183
+ *
184
+ * In short, this algorithm takes distribution of the scores
185
+ * into consideration as well, as opposed to the `RRF`.
186
+ */
187
+ DBSF = "DBSF"
188
+ }
189
+ /**
190
+ * Query mode for hybrid indexes with Upstash-hosted
191
+ * embedding models.
192
+ *
193
+ * Specifies whether to run the query in only the
194
+ * dense index, only the sparse index, or in both.
195
+ *
196
+ * If not provided, defaults to `HYBRID`.
197
+ */
198
+ declare enum QueryMode {
199
+ /**
200
+ * Runs the query in hybrid index mode, after embedding
201
+ * the raw text data into dense and sparse vectors.
202
+ *
203
+ * Query results from the dense and sparse index components
204
+ * of the hybrid index are fused before returning the result.
205
+ */
206
+ HYBRID = "HYBRID",
207
+ /**
208
+ * Runs the query in dense index mode, after embedding
209
+ * the raw text data into a dense vector.
210
+ *
211
+ * Only the query results from the dense index component
212
+ * of the hybrid index is returned.
213
+ */
214
+ DENSE = "DENSE",
215
+ /**
216
+ * Runs the query in sparse index mode, after embedding
217
+ * the raw text data into a sparse vector.
218
+ *
219
+ * Only the query results from the sparse index component
220
+ * of the hybrid index is returned.
221
+ */
222
+ SPARSE = "SPARSE"
223
+ }
100
224
 
101
225
  declare class QueryManyCommand<TMetadata> extends Command<QueryResult<TMetadata>[][]> {
102
226
  constructor(payload: QueryCommandPayload[], options?: QueryCommandOptions);
@@ -187,27 +311,51 @@ declare class Namespace<TIndexMetadata extends Dict = Dict> {
187
311
  *
188
312
  * @returns {string} A promise that resolves with the result of the upsert operation after the command is executed.
189
313
  */
190
- upsert: <TMetadata extends Dict = TIndexMetadata>(args: {
314
+ upsert: <TMetadata extends Dict = TIndexMetadata>(args: ({
191
315
  id: string | number;
192
- vector: number[];
193
316
  metadata?: (TMetadata extends infer U ? U : never) | undefined;
317
+ } & ({
318
+ vector: number[];
319
+ sparseVector?: undefined;
320
+ } | {
321
+ vector?: undefined;
322
+ sparseVector: SparseVector;
194
323
  } | {
324
+ vector: number[];
325
+ sparseVector: SparseVector;
326
+ })) | {
195
327
  id: string | number;
196
328
  data: string;
197
329
  metadata?: (TMetadata extends infer U ? U : never) | undefined;
198
- } | {
330
+ } | ({
199
331
  id: string | number;
200
- vector: number[];
201
332
  metadata?: (TMetadata extends infer U ? U : never) | undefined;
202
- }[] | {
333
+ } & ({
334
+ vector: number[];
335
+ sparseVector?: undefined;
336
+ } | {
337
+ vector?: undefined;
338
+ sparseVector: SparseVector;
339
+ } | {
340
+ vector: number[];
341
+ sparseVector: SparseVector;
342
+ }))[] | {
203
343
  id: string | number;
204
344
  data: string;
205
345
  metadata?: (TMetadata extends infer U ? U : never) | undefined;
206
346
  }[]) => Promise<string>;
207
- update: <TMetadata extends Dict = TIndexMetadata>(args: {
347
+ update: <TMetadata extends Dict = TIndexMetadata>(args: ({
208
348
  id: string | number;
349
+ } & ({
350
+ vector?: undefined;
351
+ sparseVector: SparseVector;
352
+ } | {
209
353
  vector: number[];
354
+ sparseVector?: undefined;
210
355
  } | {
356
+ vector: number[];
357
+ sparseVector: SparseVector;
358
+ })) | {
211
359
  id: string | number;
212
360
  data: string;
213
361
  } | {
@@ -480,29 +628,53 @@ declare class Index<TIndexMetadata extends Dict = Dict> {
480
628
  *
481
629
  * @returns {string} A promise that resolves with the result of the upsert operation after the command is executed.
482
630
  */
483
- upsert: <TMetadata extends Dict = TIndexMetadata>(args: {
631
+ upsert: <TMetadata extends Dict = TIndexMetadata>(args: ({
484
632
  id: string | number;
485
- vector: number[];
486
633
  metadata?: (TMetadata extends infer U ? U : never) | undefined;
634
+ } & ({
635
+ vector: number[];
636
+ sparseVector?: undefined;
487
637
  } | {
638
+ vector?: undefined;
639
+ sparseVector: SparseVector;
640
+ } | {
641
+ vector: number[];
642
+ sparseVector: SparseVector;
643
+ })) | {
488
644
  id: string | number;
489
645
  data: string;
490
646
  metadata?: (TMetadata extends infer U ? U : never) | undefined;
491
- } | {
647
+ } | ({
492
648
  id: string | number;
493
- vector: number[];
494
649
  metadata?: (TMetadata extends infer U ? U : never) | undefined;
495
- }[] | {
650
+ } & ({
651
+ vector: number[];
652
+ sparseVector?: undefined;
653
+ } | {
654
+ vector?: undefined;
655
+ sparseVector: SparseVector;
656
+ } | {
657
+ vector: number[];
658
+ sparseVector: SparseVector;
659
+ }))[] | {
496
660
  id: string | number;
497
661
  data: string;
498
662
  metadata?: (TMetadata extends infer U ? U : never) | undefined;
499
663
  }[], options?: {
500
664
  namespace?: string;
501
665
  }) => Promise<string>;
502
- update: <TMetadata extends Dict = TIndexMetadata>(args: {
666
+ update: <TMetadata extends Dict = TIndexMetadata>(args: ({
503
667
  id: string | number;
668
+ } & ({
669
+ vector?: undefined;
670
+ sparseVector: SparseVector;
671
+ } | {
504
672
  vector: number[];
673
+ sparseVector?: undefined;
505
674
  } | {
675
+ vector: number[];
676
+ sparseVector: SparseVector;
677
+ })) | {
506
678
  id: string | number;
507
679
  data: string;
508
680
  } | {
@@ -642,4 +814,4 @@ declare class Index<TIndexMetadata extends Dict = Dict> {
642
814
  deleteNamespace: (namespace: string) => Promise<string>;
643
815
  }
644
816
 
645
- export { type Dict as D, type FetchResult as F, Index as I, type QueryResult as Q, type RequesterConfig as R, type UpstashRequest as U, type Vector as V, type Requester as a, type UpstashResponse as b, type RangeResult as c, type InfoResult as d };
817
+ export { type Dict as D, FusionAlgorithm as F, Index as I, QueryMode as Q, type RequesterConfig as R, type UpstashRequest as U, type Vector as V, WeightingStrategy as W, type Requester as a, type UpstashResponse as b, type RangeResult as c, type FetchResult as d, type QueryResult as e, type InfoResult as f };
package/package.json CHANGED
@@ -1 +1 @@
1
- { "name": "@upstash/vector", "version": "v1.2.0-canary", "author": "Oguzhan Olguncu <oguzhan@upstash.com>", "repository": { "type": "git", "url": "https://github.com/upstash/vector-js" }, "exports": { ".": { "import": "./dist/nodejs.mjs", "require": "./dist/nodejs.js" }, "./cloudflare": { "import": "./dist/cloudflare.mjs", "require": "./dist/cloudflare.js" }, "./nodejs": { "import": "./dist/nodejs.mjs", "require": "./dist/nodejs.js" } }, "main": "./dist/nodejs.js", "module": "./dist/nodejs.mjs", "types": "./dist/nodejs.d.ts", "devDependencies": { "@commitlint/cli": "^18.6.0", "@commitlint/config-conventional": "^18.6.0", "@typescript-eslint/eslint-plugin": "^8.4.0", "bun-types": "latest", "eslint": "9.10.0", "eslint-plugin-unicorn": "^55.0.0", "husky": "^8.0.3", "prettier": "^3.3.3", "tsup": "latest", "typescript": "^5.0.0", "vitest": "^1.2.2" }, "bugs": { "url": "https://github.com/upstash/vector/issues" }, "description": "An HTTP/REST based Vector DB client built on top of Upstash REST API.", "files": [ "dist" ], "homepage": "https://upstash.com/vector", "keywords": [ "vector", "upstash", "db" ], "license": "MIT", "scripts": { "test": "bun test src --coverage --bail --coverageSkipTestFiles=[test-utils.ts] --timeout 20000 && vitest run --typecheck", "fmt": "prettier --write .", "lint": "tsc && eslint \"src/**/*.{js,ts,tsx}\" --quiet --fix", "build": "tsup", "prepare": "husky install" } }
1
+ { "name": "@upstash/vector", "version": "v1.2.0-canary-hybrid-1", "author": "Oguzhan Olguncu <oguzhan@upstash.com>", "repository": { "type": "git", "url": "https://github.com/upstash/vector-js" }, "exports": { ".": { "import": "./dist/nodejs.mjs", "require": "./dist/nodejs.js" }, "./cloudflare": { "import": "./dist/cloudflare.mjs", "require": "./dist/cloudflare.js" }, "./nodejs": { "import": "./dist/nodejs.mjs", "require": "./dist/nodejs.js" } }, "main": "./dist/nodejs.js", "module": "./dist/nodejs.mjs", "types": "./dist/nodejs.d.ts", "devDependencies": { "@commitlint/cli": "^18.6.0", "@commitlint/config-conventional": "^18.6.0", "@typescript-eslint/eslint-plugin": "^8.4.0", "bun-types": "latest", "eslint": "9.10.0", "eslint-plugin-unicorn": "^55.0.0", "husky": "^8.0.3", "prettier": "^3.3.3", "tsup": "latest", "typescript": "^5.0.0", "vitest": "^1.2.2" }, "bugs": { "url": "https://github.com/upstash/vector/issues" }, "description": "An HTTP/REST based Vector DB client built on top of Upstash REST API.", "files": [ "dist" ], "homepage": "https://upstash.com/vector", "keywords": [ "vector", "upstash", "db" ], "license": "MIT", "scripts": { "test": "bun test src --coverage --bail --coverageSkipTestFiles=[test-utils.ts] --timeout 20000", "fmt": "prettier --write .", "lint": "tsc && eslint \"src/**/*.{js,ts,tsx}\" --quiet --fix", "build": "tsup ", "prepare": "husky install" } }