@lancedb/lancedb 0.5.2 → 0.7.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.
Files changed (89) hide show
  1. package/Cargo.toml +3 -3
  2. package/biome.json +19 -3
  3. package/dist/arrow.d.ts +41 -8
  4. package/dist/arrow.js +4 -4
  5. package/dist/connection.d.ts +49 -29
  6. package/dist/connection.js +21 -73
  7. package/dist/embedding/embedding_function.d.ts +9 -1
  8. package/dist/embedding/embedding_function.js +6 -0
  9. package/dist/embedding/openai.d.ts +6 -5
  10. package/dist/embedding/openai.js +4 -2
  11. package/dist/embedding/registry.d.ts +6 -11
  12. package/dist/index.d.ts +51 -3
  13. package/dist/index.js +28 -4
  14. package/dist/merge.d.ts +54 -0
  15. package/dist/merge.js +64 -0
  16. package/dist/native.d.ts +29 -3
  17. package/dist/native.js +26 -9
  18. package/dist/query.d.ts +33 -10
  19. package/dist/query.js +100 -13
  20. package/dist/remote/client.d.ts +28 -0
  21. package/dist/remote/client.js +172 -0
  22. package/dist/remote/connection.d.ts +25 -0
  23. package/dist/remote/connection.js +110 -0
  24. package/dist/remote/index.d.ts +3 -0
  25. package/dist/remote/index.js +9 -0
  26. package/dist/remote/table.d.ts +42 -0
  27. package/dist/remote/table.js +179 -0
  28. package/dist/sanitize.d.ts +3 -2
  29. package/dist/sanitize.js +55 -1
  30. package/dist/table.d.ts +105 -30
  31. package/dist/table.js +94 -237
  32. package/dist/util.d.ts +14 -0
  33. package/dist/util.js +65 -0
  34. package/examples/ann_indexes.ts +49 -0
  35. package/examples/basic.ts +149 -0
  36. package/examples/embedding.ts +83 -0
  37. package/examples/filtering.ts +34 -0
  38. package/examples/jsconfig.json +27 -0
  39. package/examples/package-lock.json +79 -0
  40. package/examples/package.json +18 -0
  41. package/examples/search.ts +37 -0
  42. package/lancedb/arrow.ts +80 -23
  43. package/lancedb/connection.ts +107 -92
  44. package/lancedb/embedding/embedding_function.ts +12 -1
  45. package/lancedb/embedding/openai.ts +11 -6
  46. package/lancedb/embedding/registry.ts +34 -22
  47. package/lancedb/index.ts +101 -2
  48. package/lancedb/merge.ts +70 -0
  49. package/lancedb/query.ts +114 -28
  50. package/lancedb/remote/client.ts +221 -0
  51. package/lancedb/remote/connection.ts +201 -0
  52. package/lancedb/remote/index.ts +3 -0
  53. package/lancedb/remote/table.ts +226 -0
  54. package/lancedb/sanitize.ts +73 -1
  55. package/lancedb/table.ts +320 -132
  56. package/lancedb/util.ts +69 -0
  57. package/native.d.ts +208 -0
  58. package/nodejs-artifacts/arrow.d.ts +41 -8
  59. package/nodejs-artifacts/arrow.js +4 -4
  60. package/nodejs-artifacts/connection.d.ts +49 -29
  61. package/nodejs-artifacts/connection.js +21 -73
  62. package/nodejs-artifacts/embedding/embedding_function.d.ts +9 -1
  63. package/nodejs-artifacts/embedding/embedding_function.js +6 -0
  64. package/nodejs-artifacts/embedding/openai.d.ts +6 -5
  65. package/nodejs-artifacts/embedding/openai.js +4 -2
  66. package/nodejs-artifacts/embedding/registry.d.ts +6 -11
  67. package/nodejs-artifacts/index.d.ts +51 -3
  68. package/nodejs-artifacts/index.js +28 -4
  69. package/nodejs-artifacts/merge.d.ts +54 -0
  70. package/nodejs-artifacts/merge.js +64 -0
  71. package/nodejs-artifacts/native.d.ts +29 -3
  72. package/nodejs-artifacts/native.js +26 -9
  73. package/nodejs-artifacts/query.d.ts +33 -10
  74. package/nodejs-artifacts/query.js +100 -13
  75. package/nodejs-artifacts/remote/client.d.ts +28 -0
  76. package/nodejs-artifacts/remote/client.js +172 -0
  77. package/nodejs-artifacts/remote/connection.d.ts +25 -0
  78. package/nodejs-artifacts/remote/connection.js +110 -0
  79. package/nodejs-artifacts/remote/index.d.ts +3 -0
  80. package/nodejs-artifacts/remote/index.js +9 -0
  81. package/nodejs-artifacts/remote/table.d.ts +42 -0
  82. package/nodejs-artifacts/remote/table.js +179 -0
  83. package/nodejs-artifacts/sanitize.d.ts +3 -2
  84. package/nodejs-artifacts/sanitize.js +55 -1
  85. package/nodejs-artifacts/table.d.ts +105 -30
  86. package/nodejs-artifacts/table.js +94 -237
  87. package/nodejs-artifacts/util.d.ts +14 -0
  88. package/nodejs-artifacts/util.js +65 -0
  89. package/package.json +25 -11
@@ -0,0 +1,179 @@
1
+ "use strict";
2
+ // Copyright 2023 LanceDB Developers.
3
+ //
4
+ // Licensed under the Apache License, Version 2.0 (the "License");
5
+ // you may not use this file except in compliance with the License.
6
+ // You may obtain a copy of the License at
7
+ //
8
+ // http://www.apache.org/licenses/LICENSE-2.0
9
+ //
10
+ // Unless required by applicable law or agreed to in writing, software
11
+ // distributed under the License is distributed on an "AS IS" BASIS,
12
+ // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ // See the License for the specific language governing permissions and
14
+ // limitations under the License.
15
+ Object.defineProperty(exports, "__esModule", { value: true });
16
+ exports.RemoteTable = void 0;
17
+ const table_1 = require("../table");
18
+ const util_1 = require("../util");
19
+ class RemoteTable extends table_1.Table {
20
+ #client;
21
+ #name;
22
+ // Used in the display() method
23
+ #dbName;
24
+ get #tablePrefix() {
25
+ return `/v1/table/${encodeURIComponent(this.#name)}/`;
26
+ }
27
+ get name() {
28
+ return this.#name;
29
+ }
30
+ constructor(client, tableName, dbName) {
31
+ super();
32
+ this.#client = client;
33
+ this.#name = tableName;
34
+ this.#dbName = dbName;
35
+ }
36
+ isOpen() {
37
+ return !this.#client.isOpen();
38
+ }
39
+ close() {
40
+ this.#client.close();
41
+ }
42
+ display() {
43
+ return `RemoteTable(${this.#dbName}; ${this.#name})`;
44
+ }
45
+ async schema() {
46
+ const resp = await this.#client.post(`${this.#tablePrefix}/describe/`);
47
+ // TODO: parse this into a valid arrow schema
48
+ return resp.schema;
49
+ }
50
+ async add(data, options) {
51
+ const { buf, mode } = await table_1.Table.parseTableData(data, options, true);
52
+ await this.#client.post(`${this.#tablePrefix}/insert/`, buf, {
53
+ params: {
54
+ mode,
55
+ },
56
+ headers: {
57
+ "Content-Type": "application/vnd.apache.arrow.stream",
58
+ },
59
+ });
60
+ }
61
+ async update(optsOrUpdates, options) {
62
+ const isValues = "values" in optsOrUpdates && typeof optsOrUpdates.values !== "string";
63
+ const isValuesSql = "valuesSql" in optsOrUpdates &&
64
+ typeof optsOrUpdates.valuesSql !== "string";
65
+ const isMap = (obj) => {
66
+ return obj instanceof Map;
67
+ };
68
+ let predicate;
69
+ let columns;
70
+ switch (true) {
71
+ case isMap(optsOrUpdates):
72
+ columns = Array.from(optsOrUpdates.entries());
73
+ predicate = options?.where;
74
+ break;
75
+ case isValues && isMap(optsOrUpdates.values):
76
+ columns = Array.from(optsOrUpdates.values.entries()).map(([k, v]) => [
77
+ k,
78
+ (0, util_1.toSQL)(v),
79
+ ]);
80
+ predicate = optsOrUpdates.where;
81
+ break;
82
+ case isValues && !isMap(optsOrUpdates.values):
83
+ columns = Object.entries(optsOrUpdates.values).map(([k, v]) => [
84
+ k,
85
+ (0, util_1.toSQL)(v),
86
+ ]);
87
+ predicate = optsOrUpdates.where;
88
+ break;
89
+ case isValuesSql && isMap(optsOrUpdates.valuesSql):
90
+ columns = Array.from(optsOrUpdates.valuesSql.entries());
91
+ predicate = optsOrUpdates.where;
92
+ break;
93
+ case isValuesSql && !isMap(optsOrUpdates.valuesSql):
94
+ columns = Object.entries(optsOrUpdates.valuesSql).map(([k, v]) => [
95
+ k,
96
+ v,
97
+ ]);
98
+ predicate = optsOrUpdates.where;
99
+ break;
100
+ default:
101
+ columns = Object.entries(optsOrUpdates);
102
+ predicate = options?.where;
103
+ }
104
+ await this.#client.post(`${this.#tablePrefix}/update/`, {
105
+ predicate: predicate ?? null,
106
+ updates: columns,
107
+ });
108
+ }
109
+ async countRows(filter) {
110
+ const payload = { predicate: filter };
111
+ return await this.#client.post(`${this.#tablePrefix}/count_rows/`, payload);
112
+ }
113
+ async delete(predicate) {
114
+ const payload = { predicate };
115
+ await this.#client.post(`${this.#tablePrefix}/delete/`, payload);
116
+ }
117
+ async createIndex(column, options) {
118
+ if (options !== undefined) {
119
+ console.warn("options are not yet supported on the LanceDB cloud");
120
+ }
121
+ const indexType = "vector";
122
+ const metric = "L2";
123
+ const data = {
124
+ column,
125
+ // biome-ignore lint/style/useNamingConvention: external API
126
+ index_type: indexType,
127
+ // biome-ignore lint/style/useNamingConvention: external API
128
+ metric_type: metric,
129
+ };
130
+ await this.#client.post(`${this.#tablePrefix}/create_index`, data);
131
+ }
132
+ query() {
133
+ throw new Error("query() is not yet supported on the LanceDB cloud");
134
+ }
135
+ search(_query) {
136
+ throw new Error("search() is not yet supported on the LanceDB cloud");
137
+ }
138
+ vectorSearch(_vector) {
139
+ throw new Error("vectorSearch() is not yet supported on the LanceDB cloud");
140
+ }
141
+ addColumns(_newColumnTransforms) {
142
+ throw new Error("addColumns() is not yet supported on the LanceDB cloud");
143
+ }
144
+ alterColumns(_columnAlterations) {
145
+ throw new Error("alterColumns() is not yet supported on the LanceDB cloud");
146
+ }
147
+ dropColumns(_columnNames) {
148
+ throw new Error("dropColumns() is not yet supported on the LanceDB cloud");
149
+ }
150
+ async version() {
151
+ const resp = await this.#client.post(`${this.#tablePrefix}/describe/`);
152
+ return resp.version;
153
+ }
154
+ checkout(_version) {
155
+ throw new Error("checkout() is not yet supported on the LanceDB cloud");
156
+ }
157
+ checkoutLatest() {
158
+ throw new Error("checkoutLatest() is not yet supported on the LanceDB cloud");
159
+ }
160
+ restore() {
161
+ throw new Error("restore() is not yet supported on the LanceDB cloud");
162
+ }
163
+ optimize(_options) {
164
+ throw new Error("optimize() is not yet supported on the LanceDB cloud");
165
+ }
166
+ async listIndices() {
167
+ return await this.#client.post(`${this.#tablePrefix}/index/list/`);
168
+ }
169
+ toArrow() {
170
+ throw new Error("toArrow() is not yet supported on the LanceDB cloud");
171
+ }
172
+ mergeInsert(_on) {
173
+ throw new Error("mergeInsert() is not yet supported on the LanceDB cloud");
174
+ }
175
+ async indexStats(_name) {
176
+ throw new Error("indexStats() is not yet supported on the LanceDB cloud");
177
+ }
178
+ }
179
+ exports.RemoteTable = RemoteTable;
@@ -1,5 +1,5 @@
1
1
  import type { TKeys } from "apache-arrow/type";
2
- import { DataType, Date_, Decimal, DenseUnion, Dictionary, Duration, Field, FixedSizeBinary, FixedSizeList, Float, Int, Interval, List, Map_, Schema, SparseUnion, Struct, Time, Timestamp, TimestampMicrosecond, TimestampMillisecond, TimestampNanosecond, TimestampSecond, Type, Union } from "./arrow";
2
+ import { DataType, Date_, Decimal, DenseUnion, Dictionary, Duration, Field, FixedSizeBinary, FixedSizeList, Float, Int, Interval, List, Map_, Schema, SchemaLike, SparseUnion, Struct, Table, TableLike, Time, Timestamp, TimestampMicrosecond, TimestampMillisecond, TimestampNanosecond, TimestampSecond, Type, Union } from "./arrow";
3
3
  export declare function sanitizeMetadata(metadataLike?: unknown): Map<string, string> | undefined;
4
4
  export declare function sanitizeInt(typeLike: object): Int<Type.Int | Type.Int8 | Type.Int16 | Type.Int32 | Type.Int64 | Type.Uint8 | Type.Uint16 | Type.Uint32 | Type.Uint64>;
5
5
  export declare function sanitizeFloat(typeLike: object): Float<Type.Float | Type.Float16 | Type.Float32 | Type.Float64>;
@@ -27,4 +27,5 @@ export declare function sanitizeField(fieldLike: unknown): Field;
27
27
  * instance because they might be using a different instance of apache-arrow
28
28
  * than lancedb is using.
29
29
  */
30
- export declare function sanitizeSchema(schemaLike: unknown): Schema;
30
+ export declare function sanitizeSchema(schemaLike: SchemaLike): Schema;
31
+ export declare function sanitizeTable(tableLike: TableLike): Table;
@@ -13,7 +13,15 @@
13
13
  // See the License for the specific language governing permissions and
14
14
  // limitations under the License.
15
15
  Object.defineProperty(exports, "__esModule", { value: true });
16
- exports.sanitizeSchema = exports.sanitizeField = exports.sanitizeType = exports.sanitizeDictionary = exports.sanitizeDuration = exports.sanitizeMap = exports.sanitizeFixedSizeList = exports.sanitizeFixedSizeBinary = exports.sanitizeTypedUnion = exports.sanitizeUnion = exports.sanitizeStruct = exports.sanitizeList = exports.sanitizeInterval = exports.sanitizeTypedTimestamp = exports.sanitizeTimestamp = exports.sanitizeTime = exports.sanitizeDate = exports.sanitizeDecimal = exports.sanitizeFloat = exports.sanitizeInt = exports.sanitizeMetadata = void 0;
16
+ exports.sanitizeTable = exports.sanitizeSchema = exports.sanitizeField = exports.sanitizeType = exports.sanitizeDictionary = exports.sanitizeDuration = exports.sanitizeMap = exports.sanitizeFixedSizeList = exports.sanitizeFixedSizeBinary = exports.sanitizeTypedUnion = exports.sanitizeUnion = exports.sanitizeStruct = exports.sanitizeList = exports.sanitizeInterval = exports.sanitizeTypedTimestamp = exports.sanitizeTimestamp = exports.sanitizeTime = exports.sanitizeDate = exports.sanitizeDecimal = exports.sanitizeFloat = exports.sanitizeInt = exports.sanitizeMetadata = void 0;
17
+ // The utilities in this file help sanitize data from the user's arrow
18
+ // library into the types expected by vectordb's arrow library. Node
19
+ // generally allows for mulitple versions of the same library (and sometimes
20
+ // even multiple copies of the same version) to be installed at the same
21
+ // time. However, arrow-js uses instanceof which expected that the input
22
+ // comes from the exact same library instance. This is not always the case
23
+ // and so we must sanitize the input to ensure that it is compatible.
24
+ const apache_arrow_1 = require("apache-arrow");
17
25
  const arrow_1 = require("./arrow");
18
26
  function sanitizeMetadata(metadataLike) {
19
27
  if (metadataLike === undefined || metadataLike === null) {
@@ -380,3 +388,49 @@ function sanitizeSchema(schemaLike) {
380
388
  return new arrow_1.Schema(sanitizedFields, metadata);
381
389
  }
382
390
  exports.sanitizeSchema = sanitizeSchema;
391
+ function sanitizeTable(tableLike) {
392
+ if (tableLike instanceof arrow_1.Table) {
393
+ return tableLike;
394
+ }
395
+ if (typeof tableLike !== "object" || tableLike === null) {
396
+ throw Error("Expected a Table but object was null/undefined");
397
+ }
398
+ if (!("schema" in tableLike)) {
399
+ throw Error("The table passed in does not appear to be a table (no 'schema' property)");
400
+ }
401
+ if (!("batches" in tableLike)) {
402
+ throw Error("The table passed in does not appear to be a table (no 'columns' property)");
403
+ }
404
+ const schema = sanitizeSchema(tableLike.schema);
405
+ const batches = tableLike.batches.map(sanitizeRecordBatch);
406
+ return new arrow_1.Table(schema, batches);
407
+ }
408
+ exports.sanitizeTable = sanitizeTable;
409
+ function sanitizeRecordBatch(batchLike) {
410
+ if (batchLike instanceof arrow_1.RecordBatch) {
411
+ return batchLike;
412
+ }
413
+ if (typeof batchLike !== "object" || batchLike === null) {
414
+ throw Error("Expected a RecordBatch but object was null/undefined");
415
+ }
416
+ if (!("schema" in batchLike)) {
417
+ throw Error("The record batch passed in does not appear to be a record batch (no 'schema' property)");
418
+ }
419
+ if (!("data" in batchLike)) {
420
+ throw Error("The record batch passed in does not appear to be a record batch (no 'data' property)");
421
+ }
422
+ const schema = sanitizeSchema(batchLike.schema);
423
+ const data = sanitizeData(batchLike.data);
424
+ return new arrow_1.RecordBatch(schema, data);
425
+ }
426
+ function sanitizeData(dataLike) {
427
+ if (dataLike instanceof apache_arrow_1.Data) {
428
+ return dataLike;
429
+ }
430
+ return new apache_arrow_1.Data(dataLike.type, dataLike.offset, dataLike.length, dataLike.nullCount, {
431
+ [apache_arrow_1.BufferType.OFFSET]: dataLike.valueOffsets,
432
+ [apache_arrow_1.BufferType.DATA]: dataLike.values,
433
+ [apache_arrow_1.BufferType.VALIDITY]: dataLike.nullBitmap,
434
+ [apache_arrow_1.BufferType.TYPE]: dataLike.typeIds,
435
+ });
436
+ }
@@ -1,7 +1,11 @@
1
- import { Table as ArrowTable, Data, IntoVector, Schema } from "./arrow";
1
+ /// <reference types="node" />
2
+ import { Table as ArrowTable, Data, IntoVector, Schema, TableLike } from "./arrow";
3
+ import { CreateTableOptions } from "./connection";
2
4
  import { IndexOptions } from "./indices";
3
- import { AddColumnsSql, ColumnAlteration, IndexConfig, OptimizeStats, Table as _NativeTable } from "./native";
5
+ import { MergeInsertBuilder } from "./merge";
6
+ import { AddColumnsSql, ColumnAlteration, IndexConfig, IndexStatistics, OptimizeStats, Table as _NativeTable } from "./native";
4
7
  import { Query, VectorQuery } from "./query";
8
+ import { IntoSql } from "./util";
5
9
  export { IndexConfig } from "./native";
6
10
  /**
7
11
  * Options for adding data to a table.
@@ -55,13 +59,11 @@ export interface OptimizeOptions {
55
59
  * Closing a table is optional. It not closed, it will be closed when it is garbage
56
60
  * collected.
57
61
  */
58
- export declare class Table {
59
- #private;
60
- private readonly inner;
61
- /** Construct a Table. Internal use only. */
62
- constructor(inner: _NativeTable);
62
+ export declare abstract class Table {
63
+ /** Returns the name of the table */
64
+ abstract get name(): string;
63
65
  /** Return true if the table has not been closed */
64
- isOpen(): boolean;
66
+ abstract isOpen(): boolean;
65
67
  /**
66
68
  * Close the table, releasing any underlying resources.
67
69
  *
@@ -69,16 +71,40 @@ export declare class Table {
69
71
  *
70
72
  * Any attempt to use the table after it is closed will result in an error.
71
73
  */
72
- close(): void;
74
+ abstract close(): void;
73
75
  /** Return a brief description of the table */
74
- display(): string;
76
+ abstract display(): string;
75
77
  /** Get the schema of the table. */
76
- schema(): Promise<Schema>;
78
+ abstract schema(): Promise<Schema>;
77
79
  /**
78
80
  * Insert records into this Table.
79
81
  * @param {Data} data Records to be inserted into the Table
80
82
  */
81
- add(data: Data, options?: Partial<AddDataOptions>): Promise<void>;
83
+ abstract add(data: Data, options?: Partial<AddDataOptions>): Promise<void>;
84
+ /**
85
+ * Update existing records in the Table
86
+ * @param opts.values The values to update. The keys are the column names and the values
87
+ * are the values to set.
88
+ * @example
89
+ * ```ts
90
+ * table.update({where:"x = 2", values:{"vector": [10, 10]}})
91
+ * ```
92
+ */
93
+ abstract update(opts: {
94
+ values: Map<string, IntoSql> | Record<string, IntoSql>;
95
+ } & Partial<UpdateOptions>): Promise<void>;
96
+ /**
97
+ * Update existing records in the Table
98
+ * @param opts.valuesSql The values to update. The keys are the column names and the values
99
+ * are the values to set. The values are SQL expressions.
100
+ * @example
101
+ * ```ts
102
+ * table.update({where:"x = 2", valuesSql:{"x": "x + 1"}})
103
+ * ```
104
+ */
105
+ abstract update(opts: {
106
+ valuesSql: Map<string, string> | Record<string, string>;
107
+ } & Partial<UpdateOptions>): Promise<void>;
82
108
  /**
83
109
  * Update existing records in the Table
84
110
  *
@@ -104,11 +130,11 @@ export declare class Table {
104
130
  * @param {Partial<UpdateOptions>} options - additional options to control
105
131
  * the update behavior
106
132
  */
107
- update(updates: Map<string, string> | Record<string, string>, options?: Partial<UpdateOptions>): Promise<void>;
133
+ abstract update(updates: Map<string, string> | Record<string, string>, options?: Partial<UpdateOptions>): Promise<void>;
108
134
  /** Count the total number of rows in the dataset. */
109
- countRows(filter?: string): Promise<number>;
135
+ abstract countRows(filter?: string): Promise<number>;
110
136
  /** Delete the rows that satisfy the predicate. */
111
- delete(predicate: string): Promise<void>;
137
+ abstract delete(predicate: string): Promise<void>;
112
138
  /**
113
139
  * Create an index to speed up queries.
114
140
  *
@@ -116,6 +142,9 @@ export declare class Table {
116
142
  * Indices on vector columns will speed up vector searches.
117
143
  * Indices on scalar columns will speed up filtering (in both
118
144
  * vector and non-vector searches)
145
+ *
146
+ * @note We currently don't support custom named indexes,
147
+ * The index name will always be `${column}_idx`
119
148
  * @example
120
149
  * // If the column has a vector (fixed size list) data type then
121
150
  * // an IvfPq vector index will be created.
@@ -135,7 +164,7 @@ export declare class Table {
135
164
  * // Or create a Scalar index
136
165
  * await table.createIndex("my_float_col");
137
166
  */
138
- createIndex(column: string, options?: Partial<IndexOptions>): Promise<void>;
167
+ abstract createIndex(column: string, options?: Partial<IndexOptions>): Promise<void>;
139
168
  /**
140
169
  * Create a {@link Query} Builder.
141
170
  *
@@ -186,20 +215,20 @@ export declare class Table {
186
215
  * }
187
216
  * @returns {Query} A builder that can be used to parameterize the query
188
217
  */
189
- query(): Query;
218
+ abstract query(): Query;
190
219
  /**
191
220
  * Create a search query to find the nearest neighbors
192
221
  * of the given query vector
193
222
  * @param {string} query - the query. This will be converted to a vector using the table's provided embedding function
194
- * @rejects {Error} If no embedding functions are defined in the table
223
+ * @note If no embedding functions are defined in the table, this will error when collecting the results.
195
224
  */
196
- search(query: string): Promise<VectorQuery>;
225
+ abstract search(query: string): VectorQuery;
197
226
  /**
198
227
  * Create a search query to find the nearest neighbors
199
228
  * of the given query vector
200
229
  * @param {IntoVector} query - the query vector
201
230
  */
202
- search(query: IntoVector): VectorQuery;
231
+ abstract search(query: IntoVector): VectorQuery;
203
232
  /**
204
233
  * Search the table with a given query vector.
205
234
  *
@@ -207,7 +236,7 @@ export declare class Table {
207
236
  * is the same thing as calling `nearestTo` on the builder returned
208
237
  * by `query`. @see {@link Query#nearestTo} for more details.
209
238
  */
210
- vectorSearch(vector: IntoVector): VectorQuery;
239
+ abstract vectorSearch(vector: IntoVector): VectorQuery;
211
240
  /**
212
241
  * Add new columns with defined values.
213
242
  * @param {AddColumnsSql[]} newColumnTransforms pairs of column names and
@@ -215,13 +244,13 @@ export declare class Table {
215
244
  * expressions will be evaluated for each row in the table, and can
216
245
  * reference existing columns in the table.
217
246
  */
218
- addColumns(newColumnTransforms: AddColumnsSql[]): Promise<void>;
247
+ abstract addColumns(newColumnTransforms: AddColumnsSql[]): Promise<void>;
219
248
  /**
220
249
  * Alter the name or nullability of columns.
221
250
  * @param {ColumnAlteration[]} columnAlterations One or more alterations to
222
251
  * apply to columns.
223
252
  */
224
- alterColumns(columnAlterations: ColumnAlteration[]): Promise<void>;
253
+ abstract alterColumns(columnAlterations: ColumnAlteration[]): Promise<void>;
225
254
  /**
226
255
  * Drop one or more columns from the dataset
227
256
  *
@@ -233,9 +262,9 @@ export declare class Table {
233
262
  * be nested column references (e.g. "a.b.c") or top-level column names
234
263
  * (e.g. "a").
235
264
  */
236
- dropColumns(columnNames: string[]): Promise<void>;
265
+ abstract dropColumns(columnNames: string[]): Promise<void>;
237
266
  /** Retrieve the version of the table */
238
- version(): Promise<number>;
267
+ abstract version(): Promise<number>;
239
268
  /**
240
269
  * Checks out a specific version of the table _This is an in-place operation._
241
270
  *
@@ -261,14 +290,14 @@ export declare class Table {
261
290
  * console.log(await table.version()); // 2
262
291
  * ```
263
292
  */
264
- checkout(version: number): Promise<void>;
293
+ abstract checkout(version: number): Promise<void>;
265
294
  /**
266
295
  * Checkout the latest version of the table. _This is an in-place operation._
267
296
  *
268
297
  * The table will be set back into standard mode, and will track the latest
269
298
  * version of the table.
270
299
  */
271
- checkoutLatest(): Promise<void>;
300
+ abstract checkoutLatest(): Promise<void>;
272
301
  /**
273
302
  * Restore the table to the currently checked out version
274
303
  *
@@ -281,7 +310,7 @@ export declare class Table {
281
310
  * Once the operation concludes the table will no longer be in a checked
282
311
  * out state and the read_consistency_interval, if any, will apply.
283
312
  */
284
- restore(): Promise<void>;
313
+ abstract restore(): Promise<void>;
285
314
  /**
286
315
  * Optimize the on-disk data and indices for better performance.
287
316
  *
@@ -312,9 +341,55 @@ export declare class Table {
312
341
  * you have added or modified 100,000 or more records or run more than 20 data
313
342
  * modification operations.
314
343
  */
315
- optimize(options?: Partial<OptimizeOptions>): Promise<OptimizeStats>;
344
+ abstract optimize(options?: Partial<OptimizeOptions>): Promise<OptimizeStats>;
316
345
  /** List all indices that have been created with {@link Table.createIndex} */
317
- listIndices(): Promise<IndexConfig[]>;
346
+ abstract listIndices(): Promise<IndexConfig[]>;
318
347
  /** Return the table as an arrow table */
348
+ abstract toArrow(): Promise<ArrowTable>;
349
+ abstract mergeInsert(on: string | string[]): MergeInsertBuilder;
350
+ /** List all the stats of a specified index
351
+ *
352
+ * @param {string} name The name of the index.
353
+ * @returns {IndexStatistics | undefined} The stats of the index. If the index does not exist, it will return undefined
354
+ */
355
+ abstract indexStats(name: string): Promise<IndexStatistics | undefined>;
356
+ static parseTableData(data: Record<string, unknown>[] | TableLike, options?: Partial<CreateTableOptions>, streaming?: boolean): Promise<{
357
+ buf: Buffer;
358
+ mode: string;
359
+ }>;
360
+ }
361
+ export declare class LocalTable extends Table {
362
+ private readonly inner;
363
+ constructor(inner: _NativeTable);
364
+ get name(): string;
365
+ isOpen(): boolean;
366
+ close(): void;
367
+ display(): string;
368
+ private getEmbeddingFunctions;
369
+ /** Get the schema of the table. */
370
+ schema(): Promise<Schema>;
371
+ add(data: Data, options?: Partial<AddDataOptions>): Promise<void>;
372
+ update(optsOrUpdates: (Map<string, string> | Record<string, string>) | ({
373
+ values: Map<string, IntoSql> | Record<string, IntoSql>;
374
+ } & Partial<UpdateOptions>) | ({
375
+ valuesSql: Map<string, string> | Record<string, string>;
376
+ } & Partial<UpdateOptions>), options?: Partial<UpdateOptions>): Promise<void>;
377
+ countRows(filter?: string): Promise<number>;
378
+ delete(predicate: string): Promise<void>;
379
+ createIndex(column: string, options?: Partial<IndexOptions>): Promise<void>;
380
+ query(): Query;
381
+ search(query: string | IntoVector): VectorQuery;
382
+ vectorSearch(vector: IntoVector): VectorQuery;
383
+ addColumns(newColumnTransforms: AddColumnsSql[]): Promise<void>;
384
+ alterColumns(columnAlterations: ColumnAlteration[]): Promise<void>;
385
+ dropColumns(columnNames: string[]): Promise<void>;
386
+ version(): Promise<number>;
387
+ checkout(version: number): Promise<void>;
388
+ checkoutLatest(): Promise<void>;
389
+ restore(): Promise<void>;
390
+ optimize(options?: Partial<OptimizeOptions>): Promise<OptimizeStats>;
391
+ listIndices(): Promise<IndexConfig[]>;
319
392
  toArrow(): Promise<ArrowTable>;
393
+ indexStats(name: string): Promise<IndexStatistics | undefined>;
394
+ mergeInsert(on: string | string[]): MergeInsertBuilder;
320
395
  }