@dengxifeng/lancedb 0.26.2
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/AGENTS.md +13 -0
- package/CONTRIBUTING.md +76 -0
- package/README.md +37 -0
- package/dist/arrow.d.ts +279 -0
- package/dist/arrow.js +1316 -0
- package/dist/connection.d.ts +259 -0
- package/dist/connection.js +224 -0
- package/dist/embedding/embedding_function.d.ts +103 -0
- package/dist/embedding/embedding_function.js +192 -0
- package/dist/embedding/index.d.ts +27 -0
- package/dist/embedding/index.js +101 -0
- package/dist/embedding/openai.d.ts +16 -0
- package/dist/embedding/openai.js +93 -0
- package/dist/embedding/registry.d.ts +74 -0
- package/dist/embedding/registry.js +165 -0
- package/dist/embedding/transformers.d.ts +36 -0
- package/dist/embedding/transformers.js +122 -0
- package/dist/header.d.ts +162 -0
- package/dist/header.js +217 -0
- package/dist/index.d.ts +85 -0
- package/dist/index.js +106 -0
- package/dist/indices.d.ts +692 -0
- package/dist/indices.js +156 -0
- package/dist/merge.d.ts +80 -0
- package/dist/merge.js +92 -0
- package/dist/native.d.ts +585 -0
- package/dist/native.js +339 -0
- package/dist/permutation.d.ts +143 -0
- package/dist/permutation.js +184 -0
- package/dist/query.d.ts +581 -0
- package/dist/query.js +853 -0
- package/dist/rerankers/index.d.ts +5 -0
- package/dist/rerankers/index.js +19 -0
- package/dist/rerankers/rrf.d.ts +14 -0
- package/dist/rerankers/rrf.js +28 -0
- package/dist/sanitize.d.ts +32 -0
- package/dist/sanitize.js +473 -0
- package/dist/table.d.ts +581 -0
- package/dist/table.js +321 -0
- package/dist/util.d.ts +14 -0
- package/dist/util.js +77 -0
- package/license_header.txt +2 -0
- package/package.json +122 -0
package/dist/native.d.ts
ADDED
|
@@ -0,0 +1,585 @@
|
|
|
1
|
+
/* tslint:disable */
|
|
2
|
+
/* eslint-disable */
|
|
3
|
+
|
|
4
|
+
/* auto-generated by NAPI-RS */
|
|
5
|
+
|
|
6
|
+
export interface SplitRandomOptions {
|
|
7
|
+
ratios?: Array<number>
|
|
8
|
+
counts?: Array<number>
|
|
9
|
+
fixed?: number
|
|
10
|
+
seed?: number
|
|
11
|
+
splitNames?: Array<string>
|
|
12
|
+
}
|
|
13
|
+
export interface SplitHashOptions {
|
|
14
|
+
columns: Array<string>
|
|
15
|
+
splitWeights: Array<number>
|
|
16
|
+
discardWeight?: number
|
|
17
|
+
splitNames?: Array<string>
|
|
18
|
+
}
|
|
19
|
+
export interface SplitSequentialOptions {
|
|
20
|
+
ratios?: Array<number>
|
|
21
|
+
counts?: Array<number>
|
|
22
|
+
fixed?: number
|
|
23
|
+
splitNames?: Array<string>
|
|
24
|
+
}
|
|
25
|
+
export interface SplitCalculatedOptions {
|
|
26
|
+
calculation: string
|
|
27
|
+
splitNames?: Array<string>
|
|
28
|
+
}
|
|
29
|
+
export interface ShuffleOptions {
|
|
30
|
+
seed?: number
|
|
31
|
+
clumpSize?: number
|
|
32
|
+
}
|
|
33
|
+
/** Create a permutation builder for the given table */
|
|
34
|
+
export declare function permutationBuilder(table: Table): PermutationBuilder
|
|
35
|
+
/** Timeout configuration for remote HTTP client. */
|
|
36
|
+
export interface TimeoutConfig {
|
|
37
|
+
/**
|
|
38
|
+
* The overall timeout for the entire request in seconds. This includes
|
|
39
|
+
* connection, send, and read time. If the entire request doesn't complete
|
|
40
|
+
* within this time, it will fail. Default is None (no overall timeout).
|
|
41
|
+
* This can also be set via the environment variable `LANCE_CLIENT_TIMEOUT`,
|
|
42
|
+
* as an integer number of seconds.
|
|
43
|
+
*/
|
|
44
|
+
timeout?: number
|
|
45
|
+
/**
|
|
46
|
+
* The timeout for establishing a connection in seconds. Default is 120
|
|
47
|
+
* seconds (2 minutes). This can also be set via the environment variable
|
|
48
|
+
* `LANCE_CLIENT_CONNECT_TIMEOUT`, as an integer number of seconds.
|
|
49
|
+
*/
|
|
50
|
+
connectTimeout?: number
|
|
51
|
+
/**
|
|
52
|
+
* The timeout for reading data from the server in seconds. Default is 300
|
|
53
|
+
* seconds (5 minutes). This can also be set via the environment variable
|
|
54
|
+
* `LANCE_CLIENT_READ_TIMEOUT`, as an integer number of seconds.
|
|
55
|
+
*/
|
|
56
|
+
readTimeout?: number
|
|
57
|
+
/**
|
|
58
|
+
* The timeout for keeping idle connections in the connection pool in seconds.
|
|
59
|
+
* Default is 300 seconds (5 minutes). This can also be set via the
|
|
60
|
+
* environment variable `LANCE_CLIENT_CONNECTION_TIMEOUT`, as an integer
|
|
61
|
+
* number of seconds.
|
|
62
|
+
*/
|
|
63
|
+
poolIdleTimeout?: number
|
|
64
|
+
}
|
|
65
|
+
/** Retry configuration for the remote HTTP client. */
|
|
66
|
+
export interface RetryConfig {
|
|
67
|
+
/**
|
|
68
|
+
* The maximum number of retries for a request. Default is 3. You can also
|
|
69
|
+
* set this via the environment variable `LANCE_CLIENT_MAX_RETRIES`.
|
|
70
|
+
*/
|
|
71
|
+
retries?: number
|
|
72
|
+
/**
|
|
73
|
+
* The maximum number of retries for connection errors. Default is 3. You
|
|
74
|
+
* can also set this via the environment variable `LANCE_CLIENT_CONNECT_RETRIES`.
|
|
75
|
+
*/
|
|
76
|
+
connectRetries?: number
|
|
77
|
+
/**
|
|
78
|
+
* The maximum number of retries for read errors. Default is 3. You can also
|
|
79
|
+
* set this via the environment variable `LANCE_CLIENT_READ_RETRIES`.
|
|
80
|
+
*/
|
|
81
|
+
readRetries?: number
|
|
82
|
+
/**
|
|
83
|
+
* The backoff factor to apply between retries. Default is 0.25. Between each retry
|
|
84
|
+
* the client will wait for the amount of seconds:
|
|
85
|
+
* `{backoff factor} * (2 ** ({number of previous retries}))`. So for the default
|
|
86
|
+
* of 0.25, the first retry will wait 0.25 seconds, the second retry will wait 0.5
|
|
87
|
+
* seconds, the third retry will wait 1 second, etc.
|
|
88
|
+
*
|
|
89
|
+
* You can also set this via the environment variable
|
|
90
|
+
* `LANCE_CLIENT_RETRY_BACKOFF_FACTOR`.
|
|
91
|
+
*/
|
|
92
|
+
backoffFactor?: number
|
|
93
|
+
/**
|
|
94
|
+
* The jitter to apply to the backoff factor, in seconds. Default is 0.25.
|
|
95
|
+
*
|
|
96
|
+
* A random value between 0 and `backoff_jitter` will be added to the backoff
|
|
97
|
+
* factor in seconds. So for the default of 0.25 seconds, between 0 and 250
|
|
98
|
+
* milliseconds will be added to the sleep between each retry.
|
|
99
|
+
*
|
|
100
|
+
* You can also set this via the environment variable
|
|
101
|
+
* `LANCE_CLIENT_RETRY_BACKOFF_JITTER`.
|
|
102
|
+
*/
|
|
103
|
+
backoffJitter?: number
|
|
104
|
+
/**
|
|
105
|
+
* The HTTP status codes for which to retry the request. Default is
|
|
106
|
+
* [429, 500, 502, 503].
|
|
107
|
+
*
|
|
108
|
+
* You can also set this via the environment variable
|
|
109
|
+
* `LANCE_CLIENT_RETRY_STATUSES`. Use a comma-separated list of integers.
|
|
110
|
+
*/
|
|
111
|
+
statuses?: Array<number>
|
|
112
|
+
}
|
|
113
|
+
/** TLS/mTLS configuration for the remote HTTP client. */
|
|
114
|
+
export interface TlsConfig {
|
|
115
|
+
/** Path to the client certificate file (PEM format) for mTLS authentication. */
|
|
116
|
+
certFile?: string
|
|
117
|
+
/** Path to the client private key file (PEM format) for mTLS authentication. */
|
|
118
|
+
keyFile?: string
|
|
119
|
+
/** Path to the CA certificate file (PEM format) for server verification. */
|
|
120
|
+
sslCaCert?: string
|
|
121
|
+
/** Whether to verify the hostname in the server's certificate. */
|
|
122
|
+
assertHostname?: boolean
|
|
123
|
+
}
|
|
124
|
+
export interface ClientConfig {
|
|
125
|
+
userAgent?: string
|
|
126
|
+
retryConfig?: RetryConfig
|
|
127
|
+
timeoutConfig?: TimeoutConfig
|
|
128
|
+
extraHeaders?: Record<string, string>
|
|
129
|
+
idDelimiter?: string
|
|
130
|
+
tlsConfig?: TlsConfig
|
|
131
|
+
}
|
|
132
|
+
export interface RerankerCallbacks {
|
|
133
|
+
rerankHybrid: (...args: any[]) => any
|
|
134
|
+
}
|
|
135
|
+
export interface RerankHybridCallbackArgs {
|
|
136
|
+
query: string
|
|
137
|
+
vecResults: Array<number>
|
|
138
|
+
ftsResults: Array<number>
|
|
139
|
+
}
|
|
140
|
+
/** A description of an index currently configured on a column */
|
|
141
|
+
export interface IndexConfig {
|
|
142
|
+
/** The name of the index */
|
|
143
|
+
name: string
|
|
144
|
+
/** The type of the index */
|
|
145
|
+
indexType: string
|
|
146
|
+
/**
|
|
147
|
+
* The columns in the index
|
|
148
|
+
*
|
|
149
|
+
* Currently this is always an array of size 1. In the future there may
|
|
150
|
+
* be more columns to represent composite indices.
|
|
151
|
+
*/
|
|
152
|
+
columns: Array<string>
|
|
153
|
+
}
|
|
154
|
+
/** Statistics about a compaction operation. */
|
|
155
|
+
export interface CompactionStats {
|
|
156
|
+
/** The number of fragments removed */
|
|
157
|
+
fragmentsRemoved: number
|
|
158
|
+
/** The number of new, compacted fragments added */
|
|
159
|
+
fragmentsAdded: number
|
|
160
|
+
/** The number of data files removed */
|
|
161
|
+
filesRemoved: number
|
|
162
|
+
/** The number of new, compacted data files added */
|
|
163
|
+
filesAdded: number
|
|
164
|
+
}
|
|
165
|
+
/** Statistics about a cleanup operation */
|
|
166
|
+
export interface RemovalStats {
|
|
167
|
+
/** The number of bytes removed */
|
|
168
|
+
bytesRemoved: number
|
|
169
|
+
/** The number of old versions removed */
|
|
170
|
+
oldVersionsRemoved: number
|
|
171
|
+
}
|
|
172
|
+
/** Statistics about an optimize operation */
|
|
173
|
+
export interface OptimizeStats {
|
|
174
|
+
/** Statistics about the compaction operation */
|
|
175
|
+
compaction: CompactionStats
|
|
176
|
+
/** Statistics about the removal operation */
|
|
177
|
+
prune: RemovalStats
|
|
178
|
+
}
|
|
179
|
+
/**
|
|
180
|
+
* A definition of a column alteration. The alteration changes the column at
|
|
181
|
+
* `path` to have the new name `name`, to be nullable if `nullable` is true,
|
|
182
|
+
* and to have the data type `data_type`. At least one of `rename` or `nullable`
|
|
183
|
+
* must be provided.
|
|
184
|
+
*/
|
|
185
|
+
export interface ColumnAlteration {
|
|
186
|
+
/**
|
|
187
|
+
* The path to the column to alter. This is a dot-separated path to the column.
|
|
188
|
+
* If it is a top-level column then it is just the name of the column. If it is
|
|
189
|
+
* a nested column then it is the path to the column, e.g. "a.b.c" for a column
|
|
190
|
+
* `c` nested inside a column `b` nested inside a column `a`.
|
|
191
|
+
*/
|
|
192
|
+
path: string
|
|
193
|
+
/**
|
|
194
|
+
* The new name of the column. If not provided then the name will not be changed.
|
|
195
|
+
* This must be distinct from the names of all other columns in the table.
|
|
196
|
+
*/
|
|
197
|
+
rename?: string
|
|
198
|
+
/**
|
|
199
|
+
* A new data type for the column. If not provided then the data type will not be changed.
|
|
200
|
+
* Changing data types is limited to casting to the same general type. For example, these
|
|
201
|
+
* changes are valid:
|
|
202
|
+
* * `int32` -> `int64` (integers)
|
|
203
|
+
* * `double` -> `float` (floats)
|
|
204
|
+
* * `string` -> `large_string` (strings)
|
|
205
|
+
* But these changes are not:
|
|
206
|
+
* * `int32` -> `double` (mix integers and floats)
|
|
207
|
+
* * `string` -> `int32` (mix strings and integers)
|
|
208
|
+
*/
|
|
209
|
+
dataType?: string
|
|
210
|
+
/** Set the new nullability. Note that a nullable column cannot be made non-nullable. */
|
|
211
|
+
nullable?: boolean
|
|
212
|
+
}
|
|
213
|
+
/** A definition of a new column to add to a table. */
|
|
214
|
+
export interface AddColumnsSql {
|
|
215
|
+
/** The name of the new column. */
|
|
216
|
+
name: string
|
|
217
|
+
/**
|
|
218
|
+
* The values to populate the new column with, as a SQL expression.
|
|
219
|
+
* The expression can reference other columns in the table.
|
|
220
|
+
*/
|
|
221
|
+
valueSql: string
|
|
222
|
+
}
|
|
223
|
+
export interface IndexStatistics {
|
|
224
|
+
/** The number of rows indexed by the index */
|
|
225
|
+
numIndexedRows: number
|
|
226
|
+
/** The number of rows not indexed */
|
|
227
|
+
numUnindexedRows: number
|
|
228
|
+
/** The type of the index */
|
|
229
|
+
indexType: string
|
|
230
|
+
/**
|
|
231
|
+
* The type of the distance function used by the index. This is only
|
|
232
|
+
* present for vector indices. Scalar and full text search indices do
|
|
233
|
+
* not have a distance function.
|
|
234
|
+
*/
|
|
235
|
+
distanceType?: string
|
|
236
|
+
/** The number of parts this index is split into. */
|
|
237
|
+
numIndices?: number
|
|
238
|
+
/**
|
|
239
|
+
* The KMeans loss value of the index,
|
|
240
|
+
* it is only present for vector indices.
|
|
241
|
+
*/
|
|
242
|
+
loss?: number
|
|
243
|
+
}
|
|
244
|
+
export interface TableStatistics {
|
|
245
|
+
/** The total number of bytes in the table */
|
|
246
|
+
totalBytes: number
|
|
247
|
+
/** The number of rows in the table */
|
|
248
|
+
numRows: number
|
|
249
|
+
/** The number of indices in the table */
|
|
250
|
+
numIndices: number
|
|
251
|
+
/** Statistics on table fragments */
|
|
252
|
+
fragmentStats: FragmentStatistics
|
|
253
|
+
}
|
|
254
|
+
export interface FragmentStatistics {
|
|
255
|
+
/** The number of fragments in the table */
|
|
256
|
+
numFragments: number
|
|
257
|
+
/** The number of uncompacted fragments in the table */
|
|
258
|
+
numSmallFragments: number
|
|
259
|
+
/** Statistics on the number of rows in the table fragments */
|
|
260
|
+
lengths: FragmentSummaryStats
|
|
261
|
+
}
|
|
262
|
+
export interface FragmentSummaryStats {
|
|
263
|
+
/** The number of rows in the fragment with the fewest rows */
|
|
264
|
+
min: number
|
|
265
|
+
/** The number of rows in the fragment with the most rows */
|
|
266
|
+
max: number
|
|
267
|
+
/** The mean number of rows in the fragments */
|
|
268
|
+
mean: number
|
|
269
|
+
/** The 25th percentile of number of rows in the fragments */
|
|
270
|
+
p25: number
|
|
271
|
+
/** The 50th percentile of number of rows in the fragments */
|
|
272
|
+
p50: number
|
|
273
|
+
/** The 75th percentile of number of rows in the fragments */
|
|
274
|
+
p75: number
|
|
275
|
+
/** The 99th percentile of number of rows in the fragments */
|
|
276
|
+
p99: number
|
|
277
|
+
}
|
|
278
|
+
export interface Version {
|
|
279
|
+
version: number
|
|
280
|
+
timestamp: number
|
|
281
|
+
metadata: Record<string, string>
|
|
282
|
+
}
|
|
283
|
+
export interface UpdateResult {
|
|
284
|
+
rowsUpdated: number
|
|
285
|
+
version: number
|
|
286
|
+
}
|
|
287
|
+
export interface AddResult {
|
|
288
|
+
version: number
|
|
289
|
+
}
|
|
290
|
+
export interface DeleteResult {
|
|
291
|
+
version: number
|
|
292
|
+
}
|
|
293
|
+
export interface MergeResult {
|
|
294
|
+
version: number
|
|
295
|
+
numInsertedRows: number
|
|
296
|
+
numUpdatedRows: number
|
|
297
|
+
numDeletedRows: number
|
|
298
|
+
numAttempts: number
|
|
299
|
+
}
|
|
300
|
+
export interface AddColumnsResult {
|
|
301
|
+
version: number
|
|
302
|
+
}
|
|
303
|
+
export interface AlterColumnsResult {
|
|
304
|
+
version: number
|
|
305
|
+
}
|
|
306
|
+
export interface DropColumnsResult {
|
|
307
|
+
version: number
|
|
308
|
+
}
|
|
309
|
+
export interface ConnectionOptions {
|
|
310
|
+
/**
|
|
311
|
+
* (For LanceDB OSS only): The interval, in seconds, at which to check for
|
|
312
|
+
* updates to the table from other processes. If None, then consistency is not
|
|
313
|
+
* checked. For performance reasons, this is the default. For strong
|
|
314
|
+
* consistency, set this to zero seconds. Then every read will check for
|
|
315
|
+
* updates from other processes. As a compromise, you can set this to a
|
|
316
|
+
* non-zero value for eventual consistency. If more than that interval
|
|
317
|
+
* has passed since the last check, then the table will be checked for updates.
|
|
318
|
+
* Note: this consistency only applies to read operations. Write operations are
|
|
319
|
+
* always consistent.
|
|
320
|
+
*/
|
|
321
|
+
readConsistencyInterval?: number
|
|
322
|
+
/**
|
|
323
|
+
* (For LanceDB OSS only): configuration for object storage.
|
|
324
|
+
*
|
|
325
|
+
* The available options are described at https://lancedb.com/docs/storage/
|
|
326
|
+
*/
|
|
327
|
+
storageOptions?: Record<string, string>
|
|
328
|
+
/**
|
|
329
|
+
* (For LanceDB OSS only): the session to use for this connection. Holds
|
|
330
|
+
* shared caches and other session-specific state.
|
|
331
|
+
*/
|
|
332
|
+
session?: Session
|
|
333
|
+
/** (For LanceDB cloud only): configuration for the remote HTTP client. */
|
|
334
|
+
clientConfig?: ClientConfig
|
|
335
|
+
/**
|
|
336
|
+
* (For LanceDB cloud only): the API key to use with LanceDB Cloud.
|
|
337
|
+
*
|
|
338
|
+
* Can also be set via the environment variable `LANCEDB_API_KEY`.
|
|
339
|
+
*/
|
|
340
|
+
apiKey?: string
|
|
341
|
+
/**
|
|
342
|
+
* (For LanceDB cloud only): the region to use for LanceDB cloud.
|
|
343
|
+
* Defaults to 'us-east-1'.
|
|
344
|
+
*/
|
|
345
|
+
region?: string
|
|
346
|
+
/**
|
|
347
|
+
* (For LanceDB cloud only): the host to use for LanceDB cloud. Used
|
|
348
|
+
* for testing purposes.
|
|
349
|
+
*/
|
|
350
|
+
hostOverride?: string
|
|
351
|
+
}
|
|
352
|
+
export interface OpenTableOptions {
|
|
353
|
+
storageOptions?: Record<string, string>
|
|
354
|
+
}
|
|
355
|
+
export class Connection {
|
|
356
|
+
/** Create a new Connection instance from the given URI. */
|
|
357
|
+
static new(uri: string, options: ConnectionOptions, headerProvider?: JsHeaderProvider | undefined | null): Promise<Connection>
|
|
358
|
+
display(): string
|
|
359
|
+
isOpen(): boolean
|
|
360
|
+
close(): void
|
|
361
|
+
/** List all tables in the dataset. */
|
|
362
|
+
tableNames(namespace: Array<string>, startAfter?: string | undefined | null, limit?: number | undefined | null): Promise<Array<string>>
|
|
363
|
+
/**
|
|
364
|
+
* Create table from a Apache Arrow IPC (file) buffer.
|
|
365
|
+
*
|
|
366
|
+
* Parameters:
|
|
367
|
+
* - name: The name of the table.
|
|
368
|
+
* - buf: The buffer containing the IPC file.
|
|
369
|
+
*
|
|
370
|
+
*/
|
|
371
|
+
createTable(name: string, buf: Buffer, mode: string, namespace: Array<string>, storageOptions?: Record<string, string> | undefined | null): Promise<Table>
|
|
372
|
+
createEmptyTable(name: string, schemaBuf: Buffer, mode: string, namespace: Array<string>, storageOptions?: Record<string, string> | undefined | null): Promise<Table>
|
|
373
|
+
openTable(name: string, namespace: Array<string>, storageOptions?: Record<string, string> | undefined | null, indexCacheSize?: number | undefined | null): Promise<Table>
|
|
374
|
+
cloneTable(targetTableName: string, sourceUri: string, targetNamespace: Array<string>, sourceVersion: number | undefined | null, sourceTag: string | undefined | null, isShallow: boolean): Promise<Table>
|
|
375
|
+
/** Drop table with the name. Or raise an error if the table does not exist. */
|
|
376
|
+
dropTable(name: string, namespace: Array<string>): Promise<void>
|
|
377
|
+
dropAllTables(namespace: Array<string>): Promise<void>
|
|
378
|
+
}
|
|
379
|
+
/**
|
|
380
|
+
* JavaScript HeaderProvider implementation that wraps a JavaScript callback.
|
|
381
|
+
* This is the only native header provider - all header provider implementations
|
|
382
|
+
* should provide a JavaScript function that returns headers.
|
|
383
|
+
*/
|
|
384
|
+
export class JsHeaderProvider {
|
|
385
|
+
/** Create a new JsHeaderProvider from a JavaScript callback */
|
|
386
|
+
constructor(getHeadersCallback: (...args: any[]) => any)
|
|
387
|
+
}
|
|
388
|
+
export class Index {
|
|
389
|
+
static ivfPq(distanceType?: string | undefined | null, numPartitions?: number | undefined | null, numSubVectors?: number | undefined | null, numBits?: number | undefined | null, maxIterations?: number | undefined | null, sampleRate?: number | undefined | null): Index
|
|
390
|
+
static ivfRq(distanceType?: string | undefined | null, numPartitions?: number | undefined | null, numBits?: number | undefined | null, maxIterations?: number | undefined | null, sampleRate?: number | undefined | null): Index
|
|
391
|
+
static ivfFlat(distanceType?: string | undefined | null, numPartitions?: number | undefined | null, maxIterations?: number | undefined | null, sampleRate?: number | undefined | null): Index
|
|
392
|
+
static btree(): Index
|
|
393
|
+
static bitmap(): Index
|
|
394
|
+
static labelList(): Index
|
|
395
|
+
static fts(withPosition?: boolean | undefined | null, baseTokenizer?: string | undefined | null, language?: string | undefined | null, maxTokenLength?: number | undefined | null, lowerCase?: boolean | undefined | null, stem?: boolean | undefined | null, removeStopWords?: boolean | undefined | null, asciiFolding?: boolean | undefined | null, ngramMinLength?: number | undefined | null, ngramMaxLength?: number | undefined | null, prefixOnly?: boolean | undefined | null): Index
|
|
396
|
+
static hnswPq(distanceType?: string | undefined | null, numPartitions?: number | undefined | null, numSubVectors?: number | undefined | null, maxIterations?: number | undefined | null, sampleRate?: number | undefined | null, m?: number | undefined | null, efConstruction?: number | undefined | null): Index
|
|
397
|
+
static hnswSq(distanceType?: string | undefined | null, numPartitions?: number | undefined | null, maxIterations?: number | undefined | null, sampleRate?: number | undefined | null, m?: number | undefined | null, efConstruction?: number | undefined | null): Index
|
|
398
|
+
}
|
|
399
|
+
/** Typescript-style Async Iterator over RecordBatches */
|
|
400
|
+
export class RecordBatchIterator {
|
|
401
|
+
next(): Promise<Buffer | null>
|
|
402
|
+
}
|
|
403
|
+
/** A builder used to create and run a merge insert operation */
|
|
404
|
+
export class NativeMergeInsertBuilder {
|
|
405
|
+
whenMatchedUpdateAll(condition?: string | undefined | null): NativeMergeInsertBuilder
|
|
406
|
+
whenNotMatchedInsertAll(): NativeMergeInsertBuilder
|
|
407
|
+
whenNotMatchedBySourceDelete(filter?: string | undefined | null): NativeMergeInsertBuilder
|
|
408
|
+
setTimeout(timeout: number): void
|
|
409
|
+
useIndex(useIndex: boolean): NativeMergeInsertBuilder
|
|
410
|
+
execute(buf: Buffer): Promise<MergeResult>
|
|
411
|
+
}
|
|
412
|
+
export class PermutationBuilder {
|
|
413
|
+
persist(connection: Connection, tableName: string): PermutationBuilder
|
|
414
|
+
/** Configure random splits */
|
|
415
|
+
splitRandom(options: SplitRandomOptions): PermutationBuilder
|
|
416
|
+
/** Configure hash-based splits */
|
|
417
|
+
splitHash(options: SplitHashOptions): PermutationBuilder
|
|
418
|
+
/** Configure sequential splits */
|
|
419
|
+
splitSequential(options: SplitSequentialOptions): PermutationBuilder
|
|
420
|
+
/** Configure calculated splits */
|
|
421
|
+
splitCalculated(options: SplitCalculatedOptions): PermutationBuilder
|
|
422
|
+
/** Configure shuffling */
|
|
423
|
+
shuffle(options: ShuffleOptions): PermutationBuilder
|
|
424
|
+
/** Configure filtering */
|
|
425
|
+
filter(filter: string): PermutationBuilder
|
|
426
|
+
/** Execute the permutation builder and create the table */
|
|
427
|
+
execute(): Promise<Table>
|
|
428
|
+
}
|
|
429
|
+
export class Query {
|
|
430
|
+
onlyIf(predicate: string): void
|
|
431
|
+
fullTextSearch(query: object): void
|
|
432
|
+
select(columns: Array<[string, string]>): void
|
|
433
|
+
selectColumns(columns: Array<string>): void
|
|
434
|
+
limit(limit: number): void
|
|
435
|
+
offset(offset: number): void
|
|
436
|
+
nearestTo(vector: Float32Array): VectorQuery
|
|
437
|
+
fastSearch(): void
|
|
438
|
+
withRowId(): void
|
|
439
|
+
outputSchema(): Promise<Buffer>
|
|
440
|
+
execute(maxBatchLength?: number | undefined | null, timeoutMs?: number | undefined | null): Promise<RecordBatchIterator>
|
|
441
|
+
explainPlan(verbose: boolean): Promise<string>
|
|
442
|
+
analyzePlan(): Promise<string>
|
|
443
|
+
}
|
|
444
|
+
export class VectorQuery {
|
|
445
|
+
column(column: string): void
|
|
446
|
+
addQueryVector(vector: Float32Array): void
|
|
447
|
+
distanceType(distanceType: string): void
|
|
448
|
+
postfilter(): void
|
|
449
|
+
refineFactor(refineFactor: number): void
|
|
450
|
+
nprobes(nprobe: number): void
|
|
451
|
+
minimumNprobes(minimumNprobe: number): void
|
|
452
|
+
maximumNprobes(maximumNprobes: number): void
|
|
453
|
+
distanceRange(lowerBound?: number | undefined | null, upperBound?: number | undefined | null): void
|
|
454
|
+
ef(ef: number): void
|
|
455
|
+
bypassVectorIndex(): void
|
|
456
|
+
onlyIf(predicate: string): void
|
|
457
|
+
fullTextSearch(query: object): void
|
|
458
|
+
select(columns: Array<[string, string]>): void
|
|
459
|
+
selectColumns(columns: Array<string>): void
|
|
460
|
+
limit(limit: number): void
|
|
461
|
+
offset(offset: number): void
|
|
462
|
+
fastSearch(): void
|
|
463
|
+
withRowId(): void
|
|
464
|
+
rerank(callbacks: RerankerCallbacks): void
|
|
465
|
+
outputSchema(): Promise<Buffer>
|
|
466
|
+
execute(maxBatchLength?: number | undefined | null, timeoutMs?: number | undefined | null): Promise<RecordBatchIterator>
|
|
467
|
+
explainPlan(verbose: boolean): Promise<string>
|
|
468
|
+
analyzePlan(): Promise<string>
|
|
469
|
+
}
|
|
470
|
+
export class TakeQuery {
|
|
471
|
+
select(columns: Array<[string, string]>): void
|
|
472
|
+
selectColumns(columns: Array<string>): void
|
|
473
|
+
withRowId(): void
|
|
474
|
+
outputSchema(): Promise<Buffer>
|
|
475
|
+
execute(maxBatchLength?: number | undefined | null, timeoutMs?: number | undefined | null): Promise<RecordBatchIterator>
|
|
476
|
+
explainPlan(verbose: boolean): Promise<string>
|
|
477
|
+
analyzePlan(): Promise<string>
|
|
478
|
+
}
|
|
479
|
+
export class JsFullTextQuery {
|
|
480
|
+
static matchQuery(query: string, column: string, boost: number, fuzziness: number | undefined | null, maxExpansions: number, operator: string, prefixLength: number): JsFullTextQuery
|
|
481
|
+
static phraseQuery(query: string, column: string, slop: number): JsFullTextQuery
|
|
482
|
+
static boostQuery(positive: JsFullTextQuery, negative: JsFullTextQuery, negativeBoost?: number | undefined | null): JsFullTextQuery
|
|
483
|
+
static multiMatchQuery(query: string, columns: Array<string>, boosts: Array<number> | undefined | null, operator: string): JsFullTextQuery
|
|
484
|
+
static booleanQuery(queries: Array<[string, JsFullTextQuery]>): JsFullTextQuery
|
|
485
|
+
get queryType(): string
|
|
486
|
+
}
|
|
487
|
+
/**
|
|
488
|
+
* Reranker implementation that "wraps" a NodeJS Reranker implementation.
|
|
489
|
+
* This contains references to the callbacks that can be used to invoke the
|
|
490
|
+
* reranking methods on the NodeJS implementation and handles serializing the
|
|
491
|
+
* record batches to Arrow IPC buffers.
|
|
492
|
+
*/
|
|
493
|
+
export class Reranker {
|
|
494
|
+
static new(callbacks: RerankerCallbacks): Reranker
|
|
495
|
+
}
|
|
496
|
+
export type RRFReranker = RrfReranker
|
|
497
|
+
/** Wrapper around rust RRFReranker */
|
|
498
|
+
export class RrfReranker {
|
|
499
|
+
static tryNew(k: Float32Array): Promise<RrfReranker>
|
|
500
|
+
rerankHybrid(query: string, vecResults: Buffer, ftsResults: Buffer): Promise<Buffer>
|
|
501
|
+
}
|
|
502
|
+
/**
|
|
503
|
+
* A session for managing caches and object stores across LanceDB operations.
|
|
504
|
+
*
|
|
505
|
+
* Sessions allow you to configure cache sizes for index and metadata caches,
|
|
506
|
+
* which can significantly impact memory use and performance. They can
|
|
507
|
+
* also be re-used across multiple connections to share the same cache state.
|
|
508
|
+
*/
|
|
509
|
+
export class Session {
|
|
510
|
+
/**
|
|
511
|
+
* Create a new session with custom cache sizes.
|
|
512
|
+
*
|
|
513
|
+
* # Parameters
|
|
514
|
+
*
|
|
515
|
+
* - `index_cache_size_bytes`: The size of the index cache in bytes.
|
|
516
|
+
* Index data is stored in memory in this cache to speed up queries.
|
|
517
|
+
* Defaults to 6GB if not specified.
|
|
518
|
+
* - `metadata_cache_size_bytes`: The size of the metadata cache in bytes.
|
|
519
|
+
* The metadata cache stores file metadata and schema information in memory.
|
|
520
|
+
* This cache improves scan and write performance.
|
|
521
|
+
* Defaults to 1GB if not specified.
|
|
522
|
+
*/
|
|
523
|
+
constructor(indexCacheSizeBytes?: bigint | undefined | null, metadataCacheSizeBytes?: bigint | undefined | null)
|
|
524
|
+
/**
|
|
525
|
+
* Create a session with default cache sizes.
|
|
526
|
+
*
|
|
527
|
+
* This is equivalent to creating a session with 6GB index cache
|
|
528
|
+
* and 1GB metadata cache.
|
|
529
|
+
*/
|
|
530
|
+
static default(): Session
|
|
531
|
+
/** Get the current size of the session caches in bytes. */
|
|
532
|
+
sizeBytes(): bigint
|
|
533
|
+
/** Get the approximate number of items cached in the session. */
|
|
534
|
+
approxNumItems(): number
|
|
535
|
+
}
|
|
536
|
+
export class Table {
|
|
537
|
+
name: string
|
|
538
|
+
display(): string
|
|
539
|
+
isOpen(): boolean
|
|
540
|
+
close(): void
|
|
541
|
+
/** Return Schema as empty Arrow IPC file. */
|
|
542
|
+
schema(): Promise<Buffer>
|
|
543
|
+
add(buf: Buffer, mode: string): Promise<AddResult>
|
|
544
|
+
countRows(filter?: string | undefined | null): Promise<number>
|
|
545
|
+
delete(predicate: string): Promise<DeleteResult>
|
|
546
|
+
createIndex(index: Index | undefined | null, column: string, replace?: boolean | undefined | null, waitTimeoutS?: number | undefined | null, name?: string | undefined | null, train?: boolean | undefined | null): Promise<void>
|
|
547
|
+
dropIndex(indexName: string): Promise<void>
|
|
548
|
+
prewarmIndex(indexName: string): Promise<void>
|
|
549
|
+
waitForIndex(indexNames: Array<string>, timeoutS: number): Promise<void>
|
|
550
|
+
stats(): Promise<TableStatistics>
|
|
551
|
+
initialStorageOptions(): Promise<Record<string, string> | null>
|
|
552
|
+
latestStorageOptions(): Promise<Record<string, string> | null>
|
|
553
|
+
update(onlyIf: string | undefined | null, columns: Array<[string, string]>): Promise<UpdateResult>
|
|
554
|
+
query(): Query
|
|
555
|
+
takeOffsets(offsets: Array<number>): TakeQuery
|
|
556
|
+
takeRowIds(rowIds: Array<bigint>): TakeQuery
|
|
557
|
+
vectorSearch(vector: Float32Array): VectorQuery
|
|
558
|
+
addColumns(transforms: Array<AddColumnsSql>): Promise<AddColumnsResult>
|
|
559
|
+
alterColumns(alterations: Array<ColumnAlteration>): Promise<AlterColumnsResult>
|
|
560
|
+
dropColumns(columns: Array<string>): Promise<DropColumnsResult>
|
|
561
|
+
version(): Promise<number>
|
|
562
|
+
checkout(version: number): Promise<void>
|
|
563
|
+
checkoutTag(tag: string): Promise<void>
|
|
564
|
+
checkoutLatest(): Promise<void>
|
|
565
|
+
listVersions(): Promise<Array<Version>>
|
|
566
|
+
restore(): Promise<void>
|
|
567
|
+
tags(): Promise<Tags>
|
|
568
|
+
optimize(olderThanMs?: number | undefined | null, deleteUnverified?: boolean | undefined | null): Promise<OptimizeStats>
|
|
569
|
+
listIndices(): Promise<Array<IndexConfig>>
|
|
570
|
+
indexStats(indexName: string): Promise<IndexStatistics | null>
|
|
571
|
+
mergeInsert(on: Array<string>): NativeMergeInsertBuilder
|
|
572
|
+
usesV2ManifestPaths(): Promise<boolean>
|
|
573
|
+
migrateManifestPathsV2(): Promise<void>
|
|
574
|
+
}
|
|
575
|
+
export class TagContents {
|
|
576
|
+
version: number
|
|
577
|
+
manifestSize: number
|
|
578
|
+
}
|
|
579
|
+
export class Tags {
|
|
580
|
+
list(): Promise<Record<string, TagContents>>
|
|
581
|
+
getVersion(tag: string): Promise<number>
|
|
582
|
+
create(tag: string, version: number): Promise<void>
|
|
583
|
+
delete(tag: string): Promise<void>
|
|
584
|
+
update(tag: string, version: number): Promise<void>
|
|
585
|
+
}
|