@lancedb/lancedb 0.14.0-beta.2 → 0.14.1-beta.0

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/dist/native.js ADDED
@@ -0,0 +1,330 @@
1
+ "use strict";
2
+ /* tslint:disable */
3
+ /* eslint-disable */
4
+ /* prettier-ignore */
5
+ /* auto-generated by NAPI-RS */
6
+ const { existsSync, readFileSync } = require('fs');
7
+ const { join } = require('path');
8
+ const { platform, arch } = process;
9
+ let nativeBinding = null;
10
+ let localFileExisted = false;
11
+ let loadError = null;
12
+ function isMusl() {
13
+ // For Node 10
14
+ if (!process.report || typeof process.report.getReport !== 'function') {
15
+ try {
16
+ const lddPath = require('child_process').execSync('which ldd').toString().trim();
17
+ return readFileSync(lddPath, 'utf8').includes('musl');
18
+ }
19
+ catch (e) {
20
+ return true;
21
+ }
22
+ }
23
+ else {
24
+ const { glibcVersionRuntime } = process.report.getReport().header;
25
+ return !glibcVersionRuntime;
26
+ }
27
+ }
28
+ switch (platform) {
29
+ case 'android':
30
+ switch (arch) {
31
+ case 'arm64':
32
+ localFileExisted = existsSync(join(__dirname, 'lancedb.android-arm64.node'));
33
+ try {
34
+ if (localFileExisted) {
35
+ nativeBinding = require('./lancedb.android-arm64.node');
36
+ }
37
+ else {
38
+ nativeBinding = require('@lancedb/lancedb-android-arm64');
39
+ }
40
+ }
41
+ catch (e) {
42
+ loadError = e;
43
+ }
44
+ break;
45
+ case 'arm':
46
+ localFileExisted = existsSync(join(__dirname, 'lancedb.android-arm-eabi.node'));
47
+ try {
48
+ if (localFileExisted) {
49
+ nativeBinding = require('./lancedb.android-arm-eabi.node');
50
+ }
51
+ else {
52
+ nativeBinding = require('@lancedb/lancedb-android-arm-eabi');
53
+ }
54
+ }
55
+ catch (e) {
56
+ loadError = e;
57
+ }
58
+ break;
59
+ default:
60
+ throw new Error(`Unsupported architecture on Android ${arch}`);
61
+ }
62
+ break;
63
+ case 'win32':
64
+ switch (arch) {
65
+ case 'x64':
66
+ localFileExisted = existsSync(join(__dirname, 'lancedb.win32-x64-msvc.node'));
67
+ try {
68
+ if (localFileExisted) {
69
+ nativeBinding = require('./lancedb.win32-x64-msvc.node');
70
+ }
71
+ else {
72
+ nativeBinding = require('@lancedb/lancedb-win32-x64-msvc');
73
+ }
74
+ }
75
+ catch (e) {
76
+ loadError = e;
77
+ }
78
+ break;
79
+ case 'ia32':
80
+ localFileExisted = existsSync(join(__dirname, 'lancedb.win32-ia32-msvc.node'));
81
+ try {
82
+ if (localFileExisted) {
83
+ nativeBinding = require('./lancedb.win32-ia32-msvc.node');
84
+ }
85
+ else {
86
+ nativeBinding = require('@lancedb/lancedb-win32-ia32-msvc');
87
+ }
88
+ }
89
+ catch (e) {
90
+ loadError = e;
91
+ }
92
+ break;
93
+ case 'arm64':
94
+ localFileExisted = existsSync(join(__dirname, 'lancedb.win32-arm64-msvc.node'));
95
+ try {
96
+ if (localFileExisted) {
97
+ nativeBinding = require('./lancedb.win32-arm64-msvc.node');
98
+ }
99
+ else {
100
+ nativeBinding = require('@lancedb/lancedb-win32-arm64-msvc');
101
+ }
102
+ }
103
+ catch (e) {
104
+ loadError = e;
105
+ }
106
+ break;
107
+ default:
108
+ throw new Error(`Unsupported architecture on Windows: ${arch}`);
109
+ }
110
+ break;
111
+ case 'darwin':
112
+ localFileExisted = existsSync(join(__dirname, 'lancedb.darwin-universal.node'));
113
+ try {
114
+ if (localFileExisted) {
115
+ nativeBinding = require('./lancedb.darwin-universal.node');
116
+ }
117
+ else {
118
+ nativeBinding = require('@lancedb/lancedb-darwin-universal');
119
+ }
120
+ break;
121
+ }
122
+ catch { }
123
+ switch (arch) {
124
+ case 'x64':
125
+ localFileExisted = existsSync(join(__dirname, 'lancedb.darwin-x64.node'));
126
+ try {
127
+ if (localFileExisted) {
128
+ nativeBinding = require('./lancedb.darwin-x64.node');
129
+ }
130
+ else {
131
+ nativeBinding = require('@lancedb/lancedb-darwin-x64');
132
+ }
133
+ }
134
+ catch (e) {
135
+ loadError = e;
136
+ }
137
+ break;
138
+ case 'arm64':
139
+ localFileExisted = existsSync(join(__dirname, 'lancedb.darwin-arm64.node'));
140
+ try {
141
+ if (localFileExisted) {
142
+ nativeBinding = require('./lancedb.darwin-arm64.node');
143
+ }
144
+ else {
145
+ nativeBinding = require('@lancedb/lancedb-darwin-arm64');
146
+ }
147
+ }
148
+ catch (e) {
149
+ loadError = e;
150
+ }
151
+ break;
152
+ default:
153
+ throw new Error(`Unsupported architecture on macOS: ${arch}`);
154
+ }
155
+ break;
156
+ case 'freebsd':
157
+ if (arch !== 'x64') {
158
+ throw new Error(`Unsupported architecture on FreeBSD: ${arch}`);
159
+ }
160
+ localFileExisted = existsSync(join(__dirname, 'lancedb.freebsd-x64.node'));
161
+ try {
162
+ if (localFileExisted) {
163
+ nativeBinding = require('./lancedb.freebsd-x64.node');
164
+ }
165
+ else {
166
+ nativeBinding = require('@lancedb/lancedb-freebsd-x64');
167
+ }
168
+ }
169
+ catch (e) {
170
+ loadError = e;
171
+ }
172
+ break;
173
+ case 'linux':
174
+ switch (arch) {
175
+ case 'x64':
176
+ if (isMusl()) {
177
+ localFileExisted = existsSync(join(__dirname, 'lancedb.linux-x64-musl.node'));
178
+ try {
179
+ if (localFileExisted) {
180
+ nativeBinding = require('./lancedb.linux-x64-musl.node');
181
+ }
182
+ else {
183
+ nativeBinding = require('@lancedb/lancedb-linux-x64-musl');
184
+ }
185
+ }
186
+ catch (e) {
187
+ loadError = e;
188
+ }
189
+ }
190
+ else {
191
+ localFileExisted = existsSync(join(__dirname, 'lancedb.linux-x64-gnu.node'));
192
+ try {
193
+ if (localFileExisted) {
194
+ nativeBinding = require('./lancedb.linux-x64-gnu.node');
195
+ }
196
+ else {
197
+ nativeBinding = require('@lancedb/lancedb-linux-x64-gnu');
198
+ }
199
+ }
200
+ catch (e) {
201
+ loadError = e;
202
+ }
203
+ }
204
+ break;
205
+ case 'arm64':
206
+ if (isMusl()) {
207
+ localFileExisted = existsSync(join(__dirname, 'lancedb.linux-arm64-musl.node'));
208
+ try {
209
+ if (localFileExisted) {
210
+ nativeBinding = require('./lancedb.linux-arm64-musl.node');
211
+ }
212
+ else {
213
+ nativeBinding = require('@lancedb/lancedb-linux-arm64-musl');
214
+ }
215
+ }
216
+ catch (e) {
217
+ loadError = e;
218
+ }
219
+ }
220
+ else {
221
+ localFileExisted = existsSync(join(__dirname, 'lancedb.linux-arm64-gnu.node'));
222
+ try {
223
+ if (localFileExisted) {
224
+ nativeBinding = require('./lancedb.linux-arm64-gnu.node');
225
+ }
226
+ else {
227
+ nativeBinding = require('@lancedb/lancedb-linux-arm64-gnu');
228
+ }
229
+ }
230
+ catch (e) {
231
+ loadError = e;
232
+ }
233
+ }
234
+ break;
235
+ case 'arm':
236
+ if (isMusl()) {
237
+ localFileExisted = existsSync(join(__dirname, 'lancedb.linux-arm-musleabihf.node'));
238
+ try {
239
+ if (localFileExisted) {
240
+ nativeBinding = require('./lancedb.linux-arm-musleabihf.node');
241
+ }
242
+ else {
243
+ nativeBinding = require('@lancedb/lancedb-linux-arm-musleabihf');
244
+ }
245
+ }
246
+ catch (e) {
247
+ loadError = e;
248
+ }
249
+ }
250
+ else {
251
+ localFileExisted = existsSync(join(__dirname, 'lancedb.linux-arm-gnueabihf.node'));
252
+ try {
253
+ if (localFileExisted) {
254
+ nativeBinding = require('./lancedb.linux-arm-gnueabihf.node');
255
+ }
256
+ else {
257
+ nativeBinding = require('@lancedb/lancedb-linux-arm-gnueabihf');
258
+ }
259
+ }
260
+ catch (e) {
261
+ loadError = e;
262
+ }
263
+ }
264
+ break;
265
+ case 'riscv64':
266
+ if (isMusl()) {
267
+ localFileExisted = existsSync(join(__dirname, 'lancedb.linux-riscv64-musl.node'));
268
+ try {
269
+ if (localFileExisted) {
270
+ nativeBinding = require('./lancedb.linux-riscv64-musl.node');
271
+ }
272
+ else {
273
+ nativeBinding = require('@lancedb/lancedb-linux-riscv64-musl');
274
+ }
275
+ }
276
+ catch (e) {
277
+ loadError = e;
278
+ }
279
+ }
280
+ else {
281
+ localFileExisted = existsSync(join(__dirname, 'lancedb.linux-riscv64-gnu.node'));
282
+ try {
283
+ if (localFileExisted) {
284
+ nativeBinding = require('./lancedb.linux-riscv64-gnu.node');
285
+ }
286
+ else {
287
+ nativeBinding = require('@lancedb/lancedb-linux-riscv64-gnu');
288
+ }
289
+ }
290
+ catch (e) {
291
+ loadError = e;
292
+ }
293
+ }
294
+ break;
295
+ case 's390x':
296
+ localFileExisted = existsSync(join(__dirname, 'lancedb.linux-s390x-gnu.node'));
297
+ try {
298
+ if (localFileExisted) {
299
+ nativeBinding = require('./lancedb.linux-s390x-gnu.node');
300
+ }
301
+ else {
302
+ nativeBinding = require('@lancedb/lancedb-linux-s390x-gnu');
303
+ }
304
+ }
305
+ catch (e) {
306
+ loadError = e;
307
+ }
308
+ break;
309
+ default:
310
+ throw new Error(`Unsupported architecture on Linux: ${arch}`);
311
+ }
312
+ break;
313
+ default:
314
+ throw new Error(`Unsupported OS: ${platform}, architecture: ${arch}`);
315
+ }
316
+ if (!nativeBinding) {
317
+ if (loadError) {
318
+ throw loadError;
319
+ }
320
+ throw new Error(`Failed to load native binding`);
321
+ }
322
+ const { Connection, Index, RecordBatchIterator, NativeMergeInsertBuilder, Query, VectorQuery, Table, WriteMode } = nativeBinding;
323
+ module.exports.Connection = Connection;
324
+ module.exports.Index = Index;
325
+ module.exports.RecordBatchIterator = RecordBatchIterator;
326
+ module.exports.NativeMergeInsertBuilder = NativeMergeInsertBuilder;
327
+ module.exports.Query = Query;
328
+ module.exports.VectorQuery = VectorQuery;
329
+ module.exports.Table = Table;
330
+ module.exports.WriteMode = WriteMode;
@@ -0,0 +1,324 @@
1
+ import { Table as ArrowTable, type IntoVector, RecordBatch } from "./arrow";
2
+ import { type IvfPqOptions } from "./indices";
3
+ import { RecordBatchIterator as NativeBatchIterator, Query as NativeQuery, Table as NativeTable, VectorQuery as NativeVectorQuery } from "./native";
4
+ export declare class RecordBatchIterator implements AsyncIterator<RecordBatch> {
5
+ private promisedInner?;
6
+ private inner?;
7
+ constructor(promise?: Promise<NativeBatchIterator>);
8
+ next(): Promise<IteratorResult<RecordBatch<any>>>;
9
+ }
10
+ /**
11
+ * Options that control the behavior of a particular query execution
12
+ */
13
+ export interface QueryExecutionOptions {
14
+ /**
15
+ * The maximum number of rows to return in a single batch
16
+ *
17
+ * Batches may have fewer rows if the underlying data is stored
18
+ * in smaller chunks.
19
+ */
20
+ maxBatchLength?: number;
21
+ }
22
+ /**
23
+ * Options that control the behavior of a full text search
24
+ */
25
+ export interface FullTextSearchOptions {
26
+ /**
27
+ * The columns to search
28
+ *
29
+ * If not specified, all indexed columns will be searched.
30
+ * For now, only one column can be searched.
31
+ */
32
+ columns?: string | string[];
33
+ }
34
+ /** Common methods supported by all query types */
35
+ export declare class QueryBase<NativeQueryType extends NativeQuery | NativeVectorQuery> implements AsyncIterable<RecordBatch> {
36
+ protected inner: NativeQueryType | Promise<NativeQueryType>;
37
+ protected constructor(inner: NativeQueryType | Promise<NativeQueryType>);
38
+ protected doCall(fn: (inner: NativeQueryType) => void): void;
39
+ /**
40
+ * A filter statement to be applied to this query.
41
+ *
42
+ * The filter should be supplied as an SQL query string. For example:
43
+ * @example
44
+ * x > 10
45
+ * y > 0 AND y < 100
46
+ * x > 5 OR y = 'test'
47
+ *
48
+ * Filtering performance can often be improved by creating a scalar index
49
+ * on the filter column(s).
50
+ */
51
+ where(predicate: string): this;
52
+ /**
53
+ * A filter statement to be applied to this query.
54
+ * @alias where
55
+ * @deprecated Use `where` instead
56
+ */
57
+ filter(predicate: string): this;
58
+ fullTextSearch(query: string, options?: Partial<FullTextSearchOptions>): this;
59
+ /**
60
+ * Return only the specified columns.
61
+ *
62
+ * By default a query will return all columns from the table. However, this can have
63
+ * a very significant impact on latency. LanceDb stores data in a columnar fashion. This
64
+ * means we can finely tune our I/O to select exactly the columns we need.
65
+ *
66
+ * As a best practice you should always limit queries to the columns that you need. If you
67
+ * pass in an array of column names then only those columns will be returned.
68
+ *
69
+ * You can also use this method to create new "dynamic" columns based on your existing columns.
70
+ * For example, you may not care about "a" or "b" but instead simply want "a + b". This is often
71
+ * seen in the SELECT clause of an SQL query (e.g. `SELECT a+b FROM my_table`).
72
+ *
73
+ * To create dynamic columns you can pass in a Map<string, string>. A column will be returned
74
+ * for each entry in the map. The key provides the name of the column. The value is
75
+ * an SQL string used to specify how the column is calculated.
76
+ *
77
+ * For example, an SQL query might state `SELECT a + b AS combined, c`. The equivalent
78
+ * input to this method would be:
79
+ * @example
80
+ * new Map([["combined", "a + b"], ["c", "c"]])
81
+ *
82
+ * Columns will always be returned in the order given, even if that order is different than
83
+ * the order used when adding the data.
84
+ *
85
+ * Note that you can pass in a `Record<string, string>` (e.g. an object literal). This method
86
+ * uses `Object.entries` which should preserve the insertion order of the object. However,
87
+ * object insertion order is easy to get wrong and `Map` is more foolproof.
88
+ */
89
+ select(columns: string[] | Map<string, string> | Record<string, string> | string): this;
90
+ /**
91
+ * Set the maximum number of results to return.
92
+ *
93
+ * By default, a plain search has no limit. If this method is not
94
+ * called then every valid row from the table will be returned.
95
+ */
96
+ limit(limit: number): this;
97
+ offset(offset: number): this;
98
+ /**
99
+ * Skip searching un-indexed data. This can make search faster, but will miss
100
+ * any data that is not yet indexed.
101
+ *
102
+ * Use {@link lancedb.Table#optimize} to index all un-indexed data.
103
+ */
104
+ fastSearch(): this;
105
+ /**
106
+ * Whether to return the row id in the results.
107
+ *
108
+ * This column can be used to match results between different queries. For
109
+ * example, to match results from a full text search and a vector search in
110
+ * order to perform hybrid search.
111
+ */
112
+ withRowId(): this;
113
+ protected nativeExecute(options?: Partial<QueryExecutionOptions>): Promise<NativeBatchIterator>;
114
+ /**
115
+ * Execute the query and return the results as an @see {@link AsyncIterator}
116
+ * of @see {@link RecordBatch}.
117
+ *
118
+ * By default, LanceDb will use many threads to calculate results and, when
119
+ * the result set is large, multiple batches will be processed at one time.
120
+ * This readahead is limited however and backpressure will be applied if this
121
+ * stream is consumed slowly (this constrains the maximum memory used by a
122
+ * single query)
123
+ *
124
+ */
125
+ protected execute(options?: Partial<QueryExecutionOptions>): RecordBatchIterator;
126
+ [Symbol.asyncIterator](): AsyncIterator<RecordBatch<any>>;
127
+ /** Collect the results as an Arrow @see {@link ArrowTable}. */
128
+ toArrow(options?: Partial<QueryExecutionOptions>): Promise<ArrowTable>;
129
+ /** Collect the results as an array of objects. */
130
+ toArray(options?: Partial<QueryExecutionOptions>): Promise<any[]>;
131
+ /**
132
+ * Generates an explanation of the query execution plan.
133
+ *
134
+ * @example
135
+ * import * as lancedb from "@lancedb/lancedb"
136
+ * const db = await lancedb.connect("./.lancedb");
137
+ * const table = await db.createTable("my_table", [
138
+ * { vector: [1.1, 0.9], id: "1" },
139
+ * ]);
140
+ * const plan = await table.query().nearestTo([0.5, 0.2]).explainPlan();
141
+ *
142
+ * @param verbose - If true, provides a more detailed explanation. Defaults to false.
143
+ * @returns A Promise that resolves to a string containing the query execution plan explanation.
144
+ */
145
+ explainPlan(verbose?: boolean): Promise<string>;
146
+ }
147
+ /**
148
+ * An interface for a query that can be executed
149
+ *
150
+ * Supported by all query types
151
+ */
152
+ export interface ExecutableQuery {
153
+ }
154
+ /**
155
+ * A builder used to construct a vector search
156
+ *
157
+ * This builder can be reused to execute the query many times.
158
+ */
159
+ export declare class VectorQuery extends QueryBase<NativeVectorQuery> {
160
+ constructor(inner: NativeVectorQuery | Promise<NativeVectorQuery>);
161
+ /**
162
+ * Set the number of partitions to search (probe)
163
+ *
164
+ * This argument is only used when the vector column has an IVF PQ index.
165
+ * If there is no index then this value is ignored.
166
+ *
167
+ * The IVF stage of IVF PQ divides the input into partitions (clusters) of
168
+ * related values.
169
+ *
170
+ * The partition whose centroids are closest to the query vector will be
171
+ * exhaustiely searched to find matches. This parameter controls how many
172
+ * partitions should be searched.
173
+ *
174
+ * Increasing this value will increase the recall of your query but will
175
+ * also increase the latency of your query. The default value is 20. This
176
+ * default is good for many cases but the best value to use will depend on
177
+ * your data and the recall that you need to achieve.
178
+ *
179
+ * For best results we recommend tuning this parameter with a benchmark against
180
+ * your actual data to find the smallest possible value that will still give
181
+ * you the desired recall.
182
+ */
183
+ nprobes(nprobes: number): VectorQuery;
184
+ /**
185
+ * Set the number of candidates to consider during the search
186
+ *
187
+ * This argument is only used when the vector column has an HNSW index.
188
+ * If there is no index then this value is ignored.
189
+ *
190
+ * Increasing this value will increase the recall of your query but will
191
+ * also increase the latency of your query. The default value is 1.5*limit.
192
+ */
193
+ ef(ef: number): VectorQuery;
194
+ /**
195
+ * Set the vector column to query
196
+ *
197
+ * This controls which column is compared to the query vector supplied in
198
+ * the call to @see {@link Query#nearestTo}
199
+ *
200
+ * This parameter must be specified if the table has more than one column
201
+ * whose data type is a fixed-size-list of floats.
202
+ */
203
+ column(column: string): VectorQuery;
204
+ /**
205
+ * Set the distance metric to use
206
+ *
207
+ * When performing a vector search we try and find the "nearest" vectors according
208
+ * to some kind of distance metric. This parameter controls which distance metric to
209
+ * use. See @see {@link IvfPqOptions.distanceType} for more details on the different
210
+ * distance metrics available.
211
+ *
212
+ * Note: if there is a vector index then the distance type used MUST match the distance
213
+ * type used to train the vector index. If this is not done then the results will be
214
+ * invalid.
215
+ *
216
+ * By default "l2" is used.
217
+ */
218
+ distanceType(distanceType: Required<IvfPqOptions>["distanceType"]): VectorQuery;
219
+ /**
220
+ * A multiplier to control how many additional rows are taken during the refine step
221
+ *
222
+ * This argument is only used when the vector column has an IVF PQ index.
223
+ * If there is no index then this value is ignored.
224
+ *
225
+ * An IVF PQ index stores compressed (quantized) values. They query vector is compared
226
+ * against these values and, since they are compressed, the comparison is inaccurate.
227
+ *
228
+ * This parameter can be used to refine the results. It can improve both improve recall
229
+ * and correct the ordering of the nearest results.
230
+ *
231
+ * To refine results LanceDb will first perform an ANN search to find the nearest
232
+ * `limit` * `refine_factor` results. In other words, if `refine_factor` is 3 and
233
+ * `limit` is the default (10) then the first 30 results will be selected. LanceDb
234
+ * then fetches the full, uncompressed, values for these 30 results. The results are
235
+ * then reordered by the true distance and only the nearest 10 are kept.
236
+ *
237
+ * Note: there is a difference between calling this method with a value of 1 and never
238
+ * calling this method at all. Calling this method with any value will have an impact
239
+ * on your search latency. When you call this method with a `refine_factor` of 1 then
240
+ * LanceDb still needs to fetch the full, uncompressed, values so that it can potentially
241
+ * reorder the results.
242
+ *
243
+ * Note: if this method is NOT called then the distances returned in the _distance column
244
+ * will be approximate distances based on the comparison of the quantized query vector
245
+ * and the quantized result vectors. This can be considerably different than the true
246
+ * distance between the query vector and the actual uncompressed vector.
247
+ */
248
+ refineFactor(refineFactor: number): VectorQuery;
249
+ /**
250
+ * If this is called then filtering will happen after the vector search instead of
251
+ * before.
252
+ *
253
+ * By default filtering will be performed before the vector search. This is how
254
+ * filtering is typically understood to work. This prefilter step does add some
255
+ * additional latency. Creating a scalar index on the filter column(s) can
256
+ * often improve this latency. However, sometimes a filter is too complex or scalar
257
+ * indices cannot be applied to the column. In these cases postfiltering can be
258
+ * used instead of prefiltering to improve latency.
259
+ *
260
+ * Post filtering applies the filter to the results of the vector search. This means
261
+ * we only run the filter on a much smaller set of data. However, it can cause the
262
+ * query to return fewer than `limit` results (or even no results) if none of the nearest
263
+ * results match the filter.
264
+ *
265
+ * Post filtering happens during the "refine stage" (described in more detail in
266
+ * @see {@link VectorQuery#refineFactor}). This means that setting a higher refine
267
+ * factor can often help restore some of the results lost by post filtering.
268
+ */
269
+ postfilter(): VectorQuery;
270
+ /**
271
+ * If this is called then any vector index is skipped
272
+ *
273
+ * An exhaustive (flat) search will be performed. The query vector will
274
+ * be compared to every vector in the table. At high scales this can be
275
+ * expensive. However, this is often still useful. For example, skipping
276
+ * the vector index can give you ground truth results which you can use to
277
+ * calculate your recall to select an appropriate value for nprobes.
278
+ */
279
+ bypassVectorIndex(): VectorQuery;
280
+ addQueryVector(vector: IntoVector): VectorQuery;
281
+ }
282
+ /** A builder for LanceDB queries. */
283
+ export declare class Query extends QueryBase<NativeQuery> {
284
+ constructor(tbl: NativeTable);
285
+ /**
286
+ * Find the nearest vectors to the given query vector.
287
+ *
288
+ * This converts the query from a plain query to a vector query.
289
+ *
290
+ * This method will attempt to convert the input to the query vector
291
+ * expected by the embedding model. If the input cannot be converted
292
+ * then an error will be thrown.
293
+ *
294
+ * By default, there is no embedding model, and the input should be
295
+ * an array-like object of numbers (something that can be used as input
296
+ * to Float32Array.from)
297
+ *
298
+ * If there is only one vector column (a column whose data type is a
299
+ * fixed size list of floats) then the column does not need to be specified.
300
+ * If there is more than one vector column you must use
301
+ * @see {@link VectorQuery#column} to specify which column you would like
302
+ * to compare with.
303
+ *
304
+ * If no index has been created on the vector column then a vector query
305
+ * will perform a distance comparison between the query vector and every
306
+ * vector in the database and then sort the results. This is sometimes
307
+ * called a "flat search"
308
+ *
309
+ * For small databases, with a few hundred thousand vectors or less, this can
310
+ * be reasonably fast. In larger databases you should create a vector index
311
+ * on the column. If there is a vector index then an "approximate" nearest
312
+ * neighbor search (frequently called an ANN search) will be performed. This
313
+ * search is much faster, but the results will be approximate.
314
+ *
315
+ * The query can be further parameterized using the returned builder. There
316
+ * are various ANN search parameters that will let you fine tune your recall
317
+ * accuracy vs search latency.
318
+ *
319
+ * Vector searches always have a `limit`. If `limit` has not been called then
320
+ * a default `limit` of 10 will be used. @see {@link Query#limit}
321
+ */
322
+ nearestTo(vector: IntoVector): VectorQuery;
323
+ nearestToText(query: string, columns?: string[]): Query;
324
+ }