@lancedb/lancedb 0.4.16 → 0.4.19

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.
@@ -104,17 +104,20 @@ export declare class Table {
104
104
  * // If the column has a vector (fixed size list) data type then
105
105
  * // an IvfPq vector index will be created.
106
106
  * const table = await conn.openTable("my_table");
107
- * await table.createIndex(["vector"]);
107
+ * await table.createIndex("vector");
108
108
  * @example
109
109
  * // For advanced control over vector index creation you can specify
110
110
  * // the index type and options.
111
111
  * const table = await conn.openTable("my_table");
112
- * await table.createIndex(["vector"], I)
113
- * .ivf_pq({ num_partitions: 128, num_sub_vectors: 16 })
114
- * .build();
112
+ * await table.createIndex("vector", {
113
+ * config: lancedb.Index.ivfPq({
114
+ * numPartitions: 128,
115
+ * numSubVectors: 16,
116
+ * }),
117
+ * });
115
118
  * @example
116
119
  * // Or create a Scalar index
117
- * await table.createIndex("my_float_col").build();
120
+ * await table.createIndex("my_float_col");
118
121
  */
119
122
  createIndex(column: string, options?: Partial<IndexOptions>): Promise<void>;
120
123
  /**
@@ -126,8 +129,7 @@ export declare class Table {
126
129
  * vector similarity, sorting, and more.
127
130
  *
128
131
  * Note: By default, all columns are returned. For best performance, you should
129
- * only fetch the columns you need. See [`Query::select_with_projection`] for
130
- * more details.
132
+ * only fetch the columns you need.
131
133
  *
132
134
  * When appropriate, various indices and statistics based pruning will be used to
133
135
  * accelerate the query.
@@ -135,10 +137,13 @@ export declare class Table {
135
137
  * // SQL-style filtering
136
138
  * //
137
139
  * // This query will return up to 1000 rows whose value in the `id` column
138
- * // is greater than 5. LanceDb supports a broad set of filtering functions.
139
- * for await (const batch of table.query()
140
- * .filter("id > 1").select(["id"]).limit(20)) {
141
- * console.log(batch);
140
+ * // is greater than 5. LanceDb supports a broad set of filtering functions.
141
+ * for await (const batch of table
142
+ * .query()
143
+ * .where("id > 1")
144
+ * .select(["id"])
145
+ * .limit(20)) {
146
+ * console.log(batch);
142
147
  * }
143
148
  * @example
144
149
  * // Vector Similarity Search
@@ -147,13 +152,14 @@ export declare class Table {
147
152
  * // closest to the query vector [1.0, 2.0, 3.0]. If an index has been created
148
153
  * // on the "vector" column then this will perform an ANN search.
149
154
  * //
150
- * // The `refine_factor` and `nprobes` methods are used to control the recall /
155
+ * // The `refineFactor` and `nprobes` methods are used to control the recall /
151
156
  * // latency tradeoff of the search.
152
- * for await (const batch of table.query()
153
- * .nearestTo([1, 2, 3])
154
- * .refineFactor(5).nprobe(10)
155
- * .limit(10)) {
156
- * console.log(batch);
157
+ * for await (const batch of table
158
+ * .query()
159
+ * .where("id > 1")
160
+ * .select(["id"])
161
+ * .limit(20)) {
162
+ * console.log(batch);
157
163
  * }
158
164
  * @example
159
165
  * // Scan the full dataset
@@ -199,37 +205,39 @@ export declare class Table {
199
205
  * (e.g. "a").
200
206
  */
201
207
  dropColumns(columnNames: string[]): Promise<void>;
202
- /**
203
- * Retrieve the version of the table
204
- *
205
- * LanceDb supports versioning. Every operation that modifies the table increases
206
- * version. As long as a version hasn't been deleted you can `[Self::checkout]` that
207
- * version to view the data at that point. In addition, you can `[Self::restore]` the
208
- * version to replace the current table with a previous version.
209
- */
208
+ /** Retrieve the version of the table */
210
209
  version(): Promise<number>;
211
210
  /**
212
- * Checks out a specific version of the Table
211
+ * Checks out a specific version of the table _This is an in-place operation._
213
212
  *
214
- * Any read operation on the table will now access the data at the checked out version.
215
- * As a consequence, calling this method will disable any read consistency interval
216
- * that was previously set.
213
+ * This allows viewing previous versions of the table. If you wish to
214
+ * keep writing to the dataset starting from an old version, then use
215
+ * the `restore` function.
217
216
  *
218
- * This is a read-only operation that turns the table into a sort of "view"
219
- * or "detached head". Other table instances will not be affected. To make the change
220
- * permanent you can use the `[Self::restore]` method.
221
- *
222
- * Any operation that modifies the table will fail while the table is in a checked
223
- * out state.
217
+ * Calling this method will set the table into time-travel mode. If you
218
+ * wish to return to standard mode, call `checkoutLatest`.
219
+ * @param {number} version The version to checkout
220
+ * @example
221
+ * ```typescript
222
+ * import * as lancedb from "@lancedb/lancedb"
223
+ * const db = await lancedb.connect("./.lancedb");
224
+ * const table = await db.createTable("my_table", [
225
+ * { vector: [1.1, 0.9], type: "vector" },
226
+ * ]);
224
227
  *
225
- * To return the table to a normal state use `[Self::checkout_latest]`
228
+ * console.log(await table.version()); // 1
229
+ * console.log(table.display());
230
+ * await table.add([{ vector: [0.5, 0.2], type: "vector" }]);
231
+ * await table.checkout(1);
232
+ * console.log(await table.version()); // 2
233
+ * ```
226
234
  */
227
235
  checkout(version: number): Promise<void>;
228
236
  /**
229
- * Ensures the table is pointing at the latest version
237
+ * Checkout the latest version of the table. _This is an in-place operation._
230
238
  *
231
- * This can be used to manually update a table when the read_consistency_interval is None
232
- * It can also be used to undo a `[Self::checkout]` operation
239
+ * The table will be set back into standard mode, and will track the latest
240
+ * version of the table.
233
241
  */
234
242
  checkoutLatest(): Promise<void>;
235
243
  /**
@@ -245,8 +253,6 @@ export declare class Table {
245
253
  * out state and the read_consistency_interval, if any, will apply.
246
254
  */
247
255
  restore(): Promise<void>;
248
- /**
249
- * List all indices that have been created with Self::create_index
250
- */
256
+ /** List all indices that have been created with {@link Table.createIndex} */
251
257
  listIndices(): Promise<IndexConfig[]>;
252
258
  }
@@ -123,17 +123,20 @@ class Table {
123
123
  * // If the column has a vector (fixed size list) data type then
124
124
  * // an IvfPq vector index will be created.
125
125
  * const table = await conn.openTable("my_table");
126
- * await table.createIndex(["vector"]);
126
+ * await table.createIndex("vector");
127
127
  * @example
128
128
  * // For advanced control over vector index creation you can specify
129
129
  * // the index type and options.
130
130
  * const table = await conn.openTable("my_table");
131
- * await table.createIndex(["vector"], I)
132
- * .ivf_pq({ num_partitions: 128, num_sub_vectors: 16 })
133
- * .build();
131
+ * await table.createIndex("vector", {
132
+ * config: lancedb.Index.ivfPq({
133
+ * numPartitions: 128,
134
+ * numSubVectors: 16,
135
+ * }),
136
+ * });
134
137
  * @example
135
138
  * // Or create a Scalar index
136
- * await table.createIndex("my_float_col").build();
139
+ * await table.createIndex("my_float_col");
137
140
  */
138
141
  async createIndex(column, options) {
139
142
  // Bit of a hack to get around the fact that TS has no package-scope.
@@ -150,8 +153,7 @@ class Table {
150
153
  * vector similarity, sorting, and more.
151
154
  *
152
155
  * Note: By default, all columns are returned. For best performance, you should
153
- * only fetch the columns you need. See [`Query::select_with_projection`] for
154
- * more details.
156
+ * only fetch the columns you need.
155
157
  *
156
158
  * When appropriate, various indices and statistics based pruning will be used to
157
159
  * accelerate the query.
@@ -159,10 +161,13 @@ class Table {
159
161
  * // SQL-style filtering
160
162
  * //
161
163
  * // This query will return up to 1000 rows whose value in the `id` column
162
- * // is greater than 5. LanceDb supports a broad set of filtering functions.
163
- * for await (const batch of table.query()
164
- * .filter("id > 1").select(["id"]).limit(20)) {
165
- * console.log(batch);
164
+ * // is greater than 5. LanceDb supports a broad set of filtering functions.
165
+ * for await (const batch of table
166
+ * .query()
167
+ * .where("id > 1")
168
+ * .select(["id"])
169
+ * .limit(20)) {
170
+ * console.log(batch);
166
171
  * }
167
172
  * @example
168
173
  * // Vector Similarity Search
@@ -171,13 +176,14 @@ class Table {
171
176
  * // closest to the query vector [1.0, 2.0, 3.0]. If an index has been created
172
177
  * // on the "vector" column then this will perform an ANN search.
173
178
  * //
174
- * // The `refine_factor` and `nprobes` methods are used to control the recall /
179
+ * // The `refineFactor` and `nprobes` methods are used to control the recall /
175
180
  * // latency tradeoff of the search.
176
- * for await (const batch of table.query()
177
- * .nearestTo([1, 2, 3])
178
- * .refineFactor(5).nprobe(10)
179
- * .limit(10)) {
180
- * console.log(batch);
181
+ * for await (const batch of table
182
+ * .query()
183
+ * .where("id > 1")
184
+ * .select(["id"])
185
+ * .limit(20)) {
186
+ * console.log(batch);
181
187
  * }
182
188
  * @example
183
189
  * // Scan the full dataset
@@ -234,41 +240,43 @@ class Table {
234
240
  async dropColumns(columnNames) {
235
241
  await this.inner.dropColumns(columnNames);
236
242
  }
237
- /**
238
- * Retrieve the version of the table
239
- *
240
- * LanceDb supports versioning. Every operation that modifies the table increases
241
- * version. As long as a version hasn't been deleted you can `[Self::checkout]` that
242
- * version to view the data at that point. In addition, you can `[Self::restore]` the
243
- * version to replace the current table with a previous version.
244
- */
243
+ /** Retrieve the version of the table */
245
244
  async version() {
246
245
  return await this.inner.version();
247
246
  }
248
247
  /**
249
- * Checks out a specific version of the Table
248
+ * Checks out a specific version of the table _This is an in-place operation._
250
249
  *
251
- * Any read operation on the table will now access the data at the checked out version.
252
- * As a consequence, calling this method will disable any read consistency interval
253
- * that was previously set.
250
+ * This allows viewing previous versions of the table. If you wish to
251
+ * keep writing to the dataset starting from an old version, then use
252
+ * the `restore` function.
254
253
  *
255
- * This is a read-only operation that turns the table into a sort of "view"
256
- * or "detached head". Other table instances will not be affected. To make the change
257
- * permanent you can use the `[Self::restore]` method.
258
- *
259
- * Any operation that modifies the table will fail while the table is in a checked
260
- * out state.
254
+ * Calling this method will set the table into time-travel mode. If you
255
+ * wish to return to standard mode, call `checkoutLatest`.
256
+ * @param {number} version The version to checkout
257
+ * @example
258
+ * ```typescript
259
+ * import * as lancedb from "@lancedb/lancedb"
260
+ * const db = await lancedb.connect("./.lancedb");
261
+ * const table = await db.createTable("my_table", [
262
+ * { vector: [1.1, 0.9], type: "vector" },
263
+ * ]);
261
264
  *
262
- * To return the table to a normal state use `[Self::checkout_latest]`
265
+ * console.log(await table.version()); // 1
266
+ * console.log(table.display());
267
+ * await table.add([{ vector: [0.5, 0.2], type: "vector" }]);
268
+ * await table.checkout(1);
269
+ * console.log(await table.version()); // 2
270
+ * ```
263
271
  */
264
272
  async checkout(version) {
265
273
  await this.inner.checkout(version);
266
274
  }
267
275
  /**
268
- * Ensures the table is pointing at the latest version
276
+ * Checkout the latest version of the table. _This is an in-place operation._
269
277
  *
270
- * This can be used to manually update a table when the read_consistency_interval is None
271
- * It can also be used to undo a `[Self::checkout]` operation
278
+ * The table will be set back into standard mode, and will track the latest
279
+ * version of the table.
272
280
  */
273
281
  async checkoutLatest() {
274
282
  await this.inner.checkoutLatest();
@@ -288,9 +296,7 @@ class Table {
288
296
  async restore() {
289
297
  await this.inner.restore();
290
298
  }
291
- /**
292
- * List all indices that have been created with Self::create_index
293
- */
299
+ /** List all indices that have been created with {@link Table.createIndex} */
294
300
  async listIndices() {
295
301
  return await this.inner.listIndices();
296
302
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lancedb/lancedb",
3
- "version": "0.4.16",
3
+ "version": "0.4.19",
4
4
  "main": "./dist/index.js",
5
5
  "types": "./dist/index.d.ts",
6
6
  "napi": {
@@ -18,6 +18,8 @@
18
18
  },
19
19
  "license": "Apache 2.0",
20
20
  "devDependencies": {
21
+ "@aws-sdk/client-s3": "^3.33.0",
22
+ "@aws-sdk/client-kms": "^3.33.0",
21
23
  "@napi-rs/cli": "^2.18.0",
22
24
  "@types/jest": "^29.1.2",
23
25
  "@types/tmp": "^0.2.6",
@@ -60,21 +62,23 @@
60
62
  "build-release": "npm run build:release && tsc -b && shx cp lancedb/native.d.ts dist/native.d.ts",
61
63
  "chkformat": "prettier . --check",
62
64
  "docs": "typedoc --plugin typedoc-plugin-markdown --out ../docs/src/js lancedb/index.ts",
63
- "lint": "eslint lancedb && eslint __test__",
65
+ "lint": "eslint lancedb __test__",
66
+ "lint-fix": "eslint lancedb __test__ --fix",
64
67
  "prepublishOnly": "napi prepublish -t npm",
65
68
  "test": "npm run build && jest --verbose",
69
+ "integration": "S3_TEST=1 npm run test",
66
70
  "universal": "napi universal",
67
71
  "version": "napi version"
68
72
  },
69
- "optionalDependencies": {
70
- "@lancedb/lancedb-darwin-arm64": "0.4.16",
71
- "@lancedb/lancedb-linux-arm64-gnu": "0.4.16",
72
- "@lancedb/lancedb-darwin-x64": "0.4.16",
73
- "@lancedb/lancedb-linux-x64-gnu": "0.4.16",
74
- "@lancedb/lancedb-win32-x64-msvc": "0.4.16"
75
- },
76
73
  "dependencies": {
77
74
  "openai": "^4.29.2",
78
75
  "apache-arrow": "^15.0.0"
76
+ },
77
+ "optionalDependencies": {
78
+ "@lancedb/lancedb-darwin-arm64": "0.4.19",
79
+ "@lancedb/lancedb-linux-arm64-gnu": "0.4.19",
80
+ "@lancedb/lancedb-darwin-x64": "0.4.19",
81
+ "@lancedb/lancedb-linux-x64-gnu": "0.4.19",
82
+ "@lancedb/lancedb-win32-x64-msvc": "0.4.19"
79
83
  }
80
84
  }