@lancedb/lancedb 0.37.1 → 0.38.0-beta.12
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/arrow.d.ts +4 -1
- package/dist/arrow.js +35 -282
- package/dist/arrow_type.d.ts +9 -0
- package/dist/arrow_type.js +29 -0
- package/dist/connection.d.ts +104 -2
- package/dist/connection.js +26 -0
- package/dist/embedding/index.d.ts +11 -1
- package/dist/embedding/index.js +24 -17
- package/dist/embedding/openai.js +3 -15
- package/dist/embedding/registry.d.ts +21 -1
- package/dist/embedding/registry.js +76 -20
- package/dist/embedding/transformers.js +3 -15
- package/dist/index.d.ts +5 -4
- package/dist/index.js +4 -1
- package/dist/materialized_view.d.ts +69 -0
- package/dist/materialized_view.js +112 -0
- package/dist/native.d.ts +121 -2
- package/dist/native.js +52 -52
- package/dist/query.d.ts +38 -2
- package/dist/query.js +154 -101
- package/dist/sanitize.js +10 -4
- package/dist/schema.d.ts +16 -0
- package/dist/schema.js +387 -0
- package/dist/table.d.ts +170 -27
- package/dist/table.js +55 -15
- package/package.json +8 -8
package/dist/table.d.ts
CHANGED
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import { Table as ArrowTable, Data, DataType, Field, IntoVector, MultiVector, Schema } from "./arrow";
|
|
2
2
|
import { IndexOptions } from "./indices";
|
|
3
3
|
import { MergeInsertBuilder } from "./merge";
|
|
4
|
-
import { AddColumnsResult, AddColumnsSql, AddResult, AlterColumnsResult, BranchContents, DeleteResult, DropColumnsResult, IndexConfig, IndexStatistics, Job, Branches as NativeBranches, OptimizeStats, TableStatistics, Tags, UpdateFieldMetadataResult, UpdateResult, Table as _NativeTable } from "./native";
|
|
5
|
-
import { FullTextQuery, Query, TakeQuery, VectorQuery } from "./query";
|
|
4
|
+
import { AddColumnsResult, AddColumnsSql, AddResult, AlterColumnsResult, BranchContents, DeleteResult, DropColumnsResult, IndexConfig, IndexStatistics, Job, LsmStats, Branches as NativeBranches, OptimizeStats, RefreshColumnResult, RefreshMaterializedViewResult, TableStatistics, Tags, UpdateFieldMetadataResult, UpdateResult, Table as _NativeTable } from "./native";
|
|
5
|
+
import { AutoQuery, FullTextQuery, Query, TakeQuery, VectorQuery } from "./query";
|
|
6
6
|
import { IntoSql } from "./util";
|
|
7
7
|
export { IndexConfig } from "./native";
|
|
8
|
+
export { BucketStats, GenerationStats, LsmStats, MemtableStats, } from "./native";
|
|
8
9
|
/**
|
|
9
10
|
* Progress snapshot for a write operation, delivered to the `progress`
|
|
10
11
|
* callback passed to {@link Table.add}.
|
|
@@ -142,7 +143,11 @@ export interface LsmWriteSpec {
|
|
|
142
143
|
column?: string;
|
|
143
144
|
/** Bucket variant: the number of buckets, in `[1, 1024]`. */
|
|
144
145
|
numBuckets?: number;
|
|
145
|
-
/**
|
|
146
|
+
/**
|
|
147
|
+
* Indexes the MemWAL keeps up to date. Omit to maintain every supported
|
|
148
|
+
* index, resolved on install — a snapshot, so indexes created later are not
|
|
149
|
+
* maintained. Pass `[]` for none.
|
|
150
|
+
*/
|
|
146
151
|
maintainedIndexes?: string[];
|
|
147
152
|
/** Default `ShardWriter` configuration recorded in the MemWAL index. */
|
|
148
153
|
writerConfigDefaults?: Record<string, string>;
|
|
@@ -417,7 +422,7 @@ export declare abstract class Table {
|
|
|
417
422
|
* when "auto" is used, if the query is a string and an embedding function is defined, it will be treated as a vector query
|
|
418
423
|
* if the query is a string and no embedding function is defined, it will be treated as a full text search query
|
|
419
424
|
*/
|
|
420
|
-
abstract search(query: string | IntoVector | MultiVector | FullTextQuery, queryType?: string, ftsColumns?: string | string[]): VectorQuery | Query;
|
|
425
|
+
abstract search(query: string | IntoVector | MultiVector | FullTextQuery, queryType?: string, ftsColumns?: string | string[]): VectorQuery | Query | AutoQuery;
|
|
421
426
|
/**
|
|
422
427
|
* Search the table with a given query vector.
|
|
423
428
|
*
|
|
@@ -428,15 +433,75 @@ export declare abstract class Table {
|
|
|
428
433
|
abstract vectorSearch(vector: IntoVector | MultiVector): VectorQuery;
|
|
429
434
|
/**
|
|
430
435
|
* Add new columns with defined values.
|
|
436
|
+
*
|
|
437
|
+
* The `{ computed }` form stores the expression rather than evaluating it
|
|
438
|
+
* now: the column is committed with no values, and rows get them from
|
|
439
|
+
* {@link Table#refreshColumn}. Declaring one therefore costs the same on a
|
|
440
|
+
* large table as on an empty one.
|
|
441
|
+
*
|
|
442
|
+
* A refresh does not revisit rows it has already filled, so mutating an
|
|
443
|
+
* input leaves the value computed at fill time; recomputing means dropping
|
|
444
|
+
* the column and declaring it again. While a declaration reads a column,
|
|
445
|
+
* that column cannot be renamed, retyped or dropped.
|
|
446
|
+
*
|
|
447
|
+
* On LanceDB Cloud and Enterprise the expression is planned by the
|
|
448
|
+
* server, and the refresh runs as a server job -- see
|
|
449
|
+
* {@link Table#refreshColumnAsync}.
|
|
431
450
|
* @param {AddColumnsSql[] | Field | Field[] | Schema} newColumnTransforms Either:
|
|
432
451
|
* - An array of objects with column names and SQL expressions to calculate values
|
|
433
452
|
* - A single Arrow Field defining one column with its data type (column will be initialized with null values)
|
|
434
453
|
* - An array of Arrow Fields defining columns with their data types (columns will be initialized with null values)
|
|
435
454
|
* - An Arrow Schema defining columns with their data types (columns will be initialized with null values)
|
|
455
|
+
* - `{ computed }`, declaring columns defined by a SQL expression whose type and inputs are derived from it
|
|
436
456
|
* @returns {Promise<AddColumnsResult>} A promise that resolves to an object
|
|
437
457
|
* containing the new version number of the table after adding the columns.
|
|
458
|
+
* @example
|
|
459
|
+
* ```ts
|
|
460
|
+
* await table.addColumns({ computed: [{ name: "doubled", valueSql: "x * 2" }] });
|
|
461
|
+
* const { rowsFilled } = await table.refreshColumn("doubled");
|
|
462
|
+
* ```
|
|
463
|
+
*/
|
|
464
|
+
abstract addColumns(newColumnTransforms: AddColumnsSql[] | Field | Field[] | Schema | {
|
|
465
|
+
computed: AddColumnsSql[];
|
|
466
|
+
}): Promise<AddColumnsResult>;
|
|
467
|
+
/**
|
|
468
|
+
* Fill the rows of a computed column that hold no value yet.
|
|
469
|
+
*
|
|
470
|
+
* Rows appended since the last refresh are filled by the next one; rows
|
|
471
|
+
* already filled are left as they are, so the call is idempotent and does
|
|
472
|
+
* not observe a mutated input. Local tables only: a remote refresh runs
|
|
473
|
+
* as a server job, through {@link Table#refreshColumnAsync}.
|
|
474
|
+
* @param {string} column The name of the computed column to fill.
|
|
475
|
+
* @returns {Promise<RefreshColumnResult>} A promise that resolves to the
|
|
476
|
+
* number of rows filled and the new version number of the table.
|
|
477
|
+
*/
|
|
478
|
+
abstract refreshColumn(column: string): Promise<RefreshColumnResult>;
|
|
479
|
+
/**
|
|
480
|
+
* Like {@link Table#refreshColumn}, but returns a handle to the refresh
|
|
481
|
+
* job instead of blocking until it completes.
|
|
482
|
+
*
|
|
483
|
+
* The job may already be complete when returned; callers must not assume
|
|
484
|
+
* the column is filled until {@link Job.wait} resolves. Invalid input --
|
|
485
|
+
* an unknown column, or one that is not computed -- rejects here rather
|
|
486
|
+
* than failing the job. On local tables the job runs in-process; on
|
|
487
|
+
* LanceDB Cloud and Enterprise it is the server's backfill job.
|
|
488
|
+
* @param {string} column The name of the computed column to fill.
|
|
489
|
+
* @example
|
|
490
|
+
* ```ts
|
|
491
|
+
* const job = await table.refreshColumnAsync("doubled");
|
|
492
|
+
* await job.wait();
|
|
493
|
+
* console.log(await job.status()); // "finished"
|
|
494
|
+
* ```
|
|
495
|
+
*/
|
|
496
|
+
abstract refreshColumnAsync(column: string): Promise<Job>;
|
|
497
|
+
/**
|
|
498
|
+
* Recompute this table's contents from its materialized-view definition.
|
|
499
|
+
*
|
|
500
|
+
* Plumbing for {@link MaterializedView.refresh}, which is the way to call
|
|
501
|
+
* it: rejects tables that carry no view definition. Local tables only.
|
|
502
|
+
* @ignore
|
|
438
503
|
*/
|
|
439
|
-
abstract
|
|
504
|
+
abstract refreshMaterializedView(full?: boolean, sourceVersion?: number): Promise<RefreshMaterializedViewResult>;
|
|
440
505
|
/**
|
|
441
506
|
* Alter the name or nullability of columns.
|
|
442
507
|
* @param {ColumnAlteration[]} columnAlterations One or more alterations to
|
|
@@ -447,6 +512,18 @@ export declare abstract class Table {
|
|
|
447
512
|
abstract alterColumns(columnAlterations: ColumnAlteration[]): Promise<AlterColumnsResult>;
|
|
448
513
|
/**
|
|
449
514
|
* Update per-field (column) metadata.
|
|
515
|
+
*
|
|
516
|
+
* The following keys are treated specially, by convention, and should be
|
|
517
|
+
* used when appropriate:
|
|
518
|
+
*
|
|
519
|
+
* - `lancedb:description`: for a human-readable description of a field.
|
|
520
|
+
* - `lancedb:tag:<name>`: for a user-defined key-value tag, where the suffix
|
|
521
|
+
* names the tag category; e.g. `lancedb:tag:model: "clip"`.
|
|
522
|
+
* - `lancedb:logical-column`: for a column grouping; e.g. `feature_v1` and
|
|
523
|
+
* `feature_v2` might be in the same logical column.
|
|
524
|
+
* - `lancedb:status`: for status options (`production`, `candidate`,
|
|
525
|
+
* `deprecated`, `archived`) to designate the current life cycle state of
|
|
526
|
+
* this column.
|
|
450
527
|
* @param {FieldMetadataUpdate[]} updates One or more per-field updates. Each
|
|
451
528
|
* update's metadata is merged into the field's existing metadata by default;
|
|
452
529
|
* a value of `null` deletes that key, and `replace: true` swaps the whole map.
|
|
@@ -493,6 +570,11 @@ export declare abstract class Table {
|
|
|
493
570
|
* All variants require the table to have an unenforced primary key
|
|
494
571
|
* ({@link Table#setUnenforcedPrimaryKey}); bucket sharding additionally
|
|
495
572
|
* requires it to be the single column being bucketed.
|
|
573
|
+
*
|
|
574
|
+
* Omitting `maintainedIndexes` maintains every index on the table, resolved
|
|
575
|
+
* here, failing if one cannot be maintained — name them to install anyway.
|
|
576
|
+
* Naming them pins an exact set, and a still-building index is rejected
|
|
577
|
+
* rather than quietly omitted.
|
|
496
578
|
* @param {LsmWriteSpec} spec The sharding spec to install.
|
|
497
579
|
* @returns {Promise<void>}
|
|
498
580
|
* @example
|
|
@@ -520,9 +602,10 @@ export declare abstract class Table {
|
|
|
520
602
|
*
|
|
521
603
|
* Resolves to `undefined` when the MemWAL LSM write path is not enabled (no
|
|
522
604
|
* spec has been set, or it was removed with {@link Table#unsetLsmWriteSpec}).
|
|
523
|
-
* The returned spec
|
|
524
|
-
*
|
|
525
|
-
*
|
|
605
|
+
* The returned spec mirrors what was passed to
|
|
606
|
+
* {@link Table#setLsmWriteSpec}, except that `maintainedIndexes` always
|
|
607
|
+
* reports the concrete list resolved when the spec was set — `undefined`
|
|
608
|
+
* never round-trips.
|
|
526
609
|
* @returns {Promise<LsmWriteSpec | undefined>}
|
|
527
610
|
*/
|
|
528
611
|
abstract getLsmWriteSpec(): Promise<LsmWriteSpec | undefined>;
|
|
@@ -536,6 +619,57 @@ export declare abstract class Table {
|
|
|
536
619
|
* @returns {Promise<void>}
|
|
537
620
|
*/
|
|
538
621
|
abstract closeLsmWriters(): Promise<void>;
|
|
622
|
+
/**
|
|
623
|
+
* Seal every bucket's active memtable into a new L0 generation.
|
|
624
|
+
*
|
|
625
|
+
* Returns once the seal is committed. Sealing an empty memtable is a no-op,
|
|
626
|
+
* so this is safe to call repeatedly.
|
|
627
|
+
* @returns {Promise<void>}
|
|
628
|
+
*/
|
|
629
|
+
abstract flushLsm(): Promise<void>;
|
|
630
|
+
/**
|
|
631
|
+
* Trigger a background L0 → base compaction pass per bucket.
|
|
632
|
+
*
|
|
633
|
+
* Returns once the passes are *dispatched*, not once they finish — watch
|
|
634
|
+
* {@link Table#getLsmStats} for progress, or use
|
|
635
|
+
* {@link Table#checkpointLsm} to wait for convergence.
|
|
636
|
+
* @returns {Promise<void>}
|
|
637
|
+
*/
|
|
638
|
+
abstract compactLsm(): Promise<void>;
|
|
639
|
+
/**
|
|
640
|
+
* Converge this table's LSM write path into its base table.
|
|
641
|
+
*
|
|
642
|
+
* Seals once, then triggers compaction and polls until the L0 that existed
|
|
643
|
+
* at the start is gone. The target set is fixed at the start, so
|
|
644
|
+
* generations created *during* the checkpoint are ignored — that is what
|
|
645
|
+
* lets it terminate under write load, and what makes it best-effort: it
|
|
646
|
+
* converges the fresh tier as of some instant. Idempotent, abandonable at
|
|
647
|
+
* any point, and safe to run on a cadence.
|
|
648
|
+
*
|
|
649
|
+
* There is no liveness bound — the compactor pool is shared across tables,
|
|
650
|
+
* so a checkpoint queued behind unrelated work looks exactly like one that
|
|
651
|
+
* is merging. The caller owns the deadline.
|
|
652
|
+
* @returns {Promise<void>}
|
|
653
|
+
* @example
|
|
654
|
+
* ```ts
|
|
655
|
+
* const before = await table.getLsmStats();
|
|
656
|
+
* await table.checkpointLsm();
|
|
657
|
+
* const after = await table.getLsmStats();
|
|
658
|
+
* ```
|
|
659
|
+
*/
|
|
660
|
+
abstract checkpointLsm(): Promise<void>;
|
|
661
|
+
/**
|
|
662
|
+
* Read live per-bucket LSM state.
|
|
663
|
+
*
|
|
664
|
+
* Answers "how far behind is my fresh tier", "which bucket is hot", and
|
|
665
|
+
* "why is my fresh-tier vector search brute-force". Mutates no table state.
|
|
666
|
+
*
|
|
667
|
+
* Resolves to `undefined` only when the LSM write path is not enabled.
|
|
668
|
+
* @param {boolean} includeGenerationRows Also count rows per L0 generation.
|
|
669
|
+
* Off by default because each count opens an uncached Lance dataset.
|
|
670
|
+
* @returns {Promise<LsmStats | undefined>}
|
|
671
|
+
*/
|
|
672
|
+
abstract getLsmStats(includeGenerationRows?: boolean): Promise<LsmStats | undefined>;
|
|
539
673
|
/** Retrieve the version of the table */
|
|
540
674
|
abstract version(): Promise<number>;
|
|
541
675
|
/**
|
|
@@ -717,9 +851,14 @@ export declare class LocalTable extends Table {
|
|
|
717
851
|
takeOffsets(offsets: number[]): TakeQuery;
|
|
718
852
|
takeRowIds(rowIds: readonly (bigint | number)[]): TakeQuery;
|
|
719
853
|
query(): Query;
|
|
720
|
-
search(query: string | IntoVector | MultiVector | FullTextQuery, queryType?: string, ftsColumns?: string | string[]): VectorQuery | Query;
|
|
854
|
+
search(query: string | IntoVector | MultiVector | FullTextQuery, queryType?: string, ftsColumns?: string | string[]): VectorQuery | Query | AutoQuery;
|
|
721
855
|
vectorSearch(vector: IntoVector | MultiVector): VectorQuery;
|
|
722
|
-
addColumns(newColumnTransforms: AddColumnsSql[] | Field | Field[] | Schema
|
|
856
|
+
addColumns(newColumnTransforms: AddColumnsSql[] | Field | Field[] | Schema | {
|
|
857
|
+
computed: AddColumnsSql[];
|
|
858
|
+
}): Promise<AddColumnsResult>;
|
|
859
|
+
refreshColumn(column: string): Promise<RefreshColumnResult>;
|
|
860
|
+
refreshColumnAsync(column: string): Promise<Job>;
|
|
861
|
+
refreshMaterializedView(full?: boolean, sourceVersion?: number): Promise<RefreshMaterializedViewResult>;
|
|
723
862
|
alterColumns(columnAlterations: ColumnAlteration[]): Promise<AlterColumnsResult>;
|
|
724
863
|
updateFieldMetadata(updates: FieldMetadataUpdate[]): Promise<UpdateFieldMetadataResult>;
|
|
725
864
|
dropColumns(columnNames: string[]): Promise<DropColumnsResult>;
|
|
@@ -728,6 +867,10 @@ export declare class LocalTable extends Table {
|
|
|
728
867
|
unsetLsmWriteSpec(): Promise<void>;
|
|
729
868
|
getLsmWriteSpec(): Promise<LsmWriteSpec | undefined>;
|
|
730
869
|
closeLsmWriters(): Promise<void>;
|
|
870
|
+
flushLsm(): Promise<void>;
|
|
871
|
+
compactLsm(): Promise<void>;
|
|
872
|
+
checkpointLsm(): Promise<void>;
|
|
873
|
+
getLsmStats(includeGenerationRows?: boolean): Promise<LsmStats | undefined>;
|
|
731
874
|
version(): Promise<number>;
|
|
732
875
|
checkout(version: number | string): Promise<void>;
|
|
733
876
|
checkoutLatest(): Promise<void>;
|
|
@@ -810,7 +953,8 @@ export interface FieldMetadataUpdate {
|
|
|
810
953
|
path: string;
|
|
811
954
|
/**
|
|
812
955
|
* Metadata key/value pairs. Merged into the field's existing metadata by
|
|
813
|
-
* default; a value of `null` deletes that key.
|
|
956
|
+
* default; a value of `null` deletes that key. See
|
|
957
|
+
* {@link Table.updateFieldMetadata} for the conventional `lancedb:*` keys.
|
|
814
958
|
*/
|
|
815
959
|
metadata: Record<string, string | null>;
|
|
816
960
|
/** If true, replace the field's entire metadata map instead of merging. */
|
|
@@ -844,8 +988,8 @@ export interface BranchRowCountSummary {
|
|
|
844
988
|
inputsChanged: number;
|
|
845
989
|
deltaAvailable: boolean;
|
|
846
990
|
}
|
|
847
|
-
/** A reason why a
|
|
848
|
-
export interface
|
|
991
|
+
/** A reason why a cherry-pick cannot currently land. */
|
|
992
|
+
export interface CherryPickError {
|
|
849
993
|
code: string;
|
|
850
994
|
message: string;
|
|
851
995
|
}
|
|
@@ -864,18 +1008,17 @@ export interface BranchDiff {
|
|
|
864
1008
|
changedColumns: BranchColumnChange[];
|
|
865
1009
|
addedIndexes: BranchIndexSummary[];
|
|
866
1010
|
removedIndexes: BranchIndexSummary[];
|
|
867
|
-
|
|
868
|
-
mergeBlockers: MergeBlocker[];
|
|
1011
|
+
errors: CherryPickError[];
|
|
869
1012
|
}
|
|
870
|
-
/** Changes that would be, or were, promoted by a
|
|
871
|
-
export interface
|
|
1013
|
+
/** Changes that would be, or were, promoted by a cherry-pick. */
|
|
1014
|
+
export interface CherryPickPreview {
|
|
872
1015
|
promotedColumns: string[];
|
|
873
1016
|
}
|
|
874
|
-
/** Result of previewing or attempting a
|
|
875
|
-
export interface
|
|
876
|
-
status: "ready" | "
|
|
1017
|
+
/** Result of previewing or attempting a cherry-pick. */
|
|
1018
|
+
export interface CherryPickResult {
|
|
1019
|
+
status: "ready" | "failed" | "notImplemented" | "cherryPicked" | "unknown";
|
|
877
1020
|
diff: BranchDiff;
|
|
878
|
-
preview:
|
|
1021
|
+
preview: CherryPickPreview;
|
|
879
1022
|
mainVersionAfter?: number;
|
|
880
1023
|
}
|
|
881
1024
|
/**
|
|
@@ -914,13 +1057,13 @@ export declare class Branches {
|
|
|
914
1057
|
/** Compare a branch against main without modifying either branch. */
|
|
915
1058
|
diff(fromBranch: string): Promise<BranchDiff>;
|
|
916
1059
|
/**
|
|
917
|
-
*
|
|
1060
|
+
* Cherry-pick a branch onto main.
|
|
918
1061
|
*
|
|
919
|
-
* Set `dryRun` to `true` to preview
|
|
920
|
-
* with `status: "
|
|
1062
|
+
* Set `dryRun` to `true` to preview. A failed cherry-pick resolves
|
|
1063
|
+
* with `status: "failed"` instead of throwing.
|
|
921
1064
|
*
|
|
922
|
-
* @param fromBranch Branch to
|
|
923
|
-
* @param dryRun When true, only preview
|
|
1065
|
+
* @param fromBranch Branch to cherry-pick from.
|
|
1066
|
+
* @param dryRun When true, only preview. Defaults to false.
|
|
924
1067
|
*/
|
|
925
|
-
|
|
1068
|
+
cherryPick(fromBranch: string, dryRun?: boolean): Promise<CherryPickResult>;
|
|
926
1069
|
}
|
package/dist/table.js
CHANGED
|
@@ -51,8 +51,9 @@ class LocalTable extends Table {
|
|
|
51
51
|
display() {
|
|
52
52
|
return this.inner.display();
|
|
53
53
|
}
|
|
54
|
-
async getEmbeddingFunctions() {
|
|
55
|
-
const
|
|
54
|
+
async getEmbeddingFunctions(inner = this.inner) {
|
|
55
|
+
const schemaBuf = await inner.schema();
|
|
56
|
+
const schema = (0, arrow_1.tableFromIPC)(schemaBuf).schema;
|
|
56
57
|
const registry = (0, registry_1.getRegistry)();
|
|
57
58
|
return registry.parseFunctions(schema.metadata);
|
|
58
59
|
}
|
|
@@ -193,12 +194,24 @@ class LocalTable extends Table {
|
|
|
193
194
|
columns: ftsColumns,
|
|
194
195
|
});
|
|
195
196
|
}
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
197
|
+
if (queryType === "auto") {
|
|
198
|
+
if ((0, query_1.instanceOfFullTextQuery)(query)) {
|
|
199
|
+
return this.query().fullTextSearch(query, {
|
|
200
|
+
columns: ftsColumns,
|
|
201
|
+
});
|
|
202
|
+
}
|
|
203
|
+
const columns = typeof ftsColumns === "string" ? [ftsColumns] : (ftsColumns ?? null);
|
|
204
|
+
return (0, query_1.createAutoQuery)(this.inner, query, columns, async (metadata) => {
|
|
205
|
+
const functions = await (0, registry_1.getRegistry)().parseFunctions(new Map([["embedding_functions", metadata]]));
|
|
206
|
+
// TODO: Support multiple embedding functions
|
|
207
|
+
const embeddingFunc = functions
|
|
208
|
+
.values()
|
|
209
|
+
.next().value;
|
|
210
|
+
// The route only calls this callback when embedding metadata exists.
|
|
211
|
+
// parseFunctions either yields a provider or reports malformed metadata.
|
|
212
|
+
if (!embeddingFunc)
|
|
213
|
+
throw new Error("Invalid embedding function metadata");
|
|
214
|
+
return await embeddingFunc.function.computeQueryEmbeddings(query);
|
|
202
215
|
});
|
|
203
216
|
}
|
|
204
217
|
const queryPromise = this.getEmbeddingFunctions().then(async (functions) => {
|
|
@@ -225,6 +238,12 @@ class LocalTable extends Table {
|
|
|
225
238
|
}
|
|
226
239
|
// TODO: Support BatchUDF
|
|
227
240
|
async addColumns(newColumnTransforms) {
|
|
241
|
+
// Columns defined by an expression are declared, not materialized here.
|
|
242
|
+
if (typeof newColumnTransforms === "object" &&
|
|
243
|
+
!Array.isArray(newColumnTransforms) &&
|
|
244
|
+
"computed" in newColumnTransforms) {
|
|
245
|
+
return await this.inner.addComputedColumns(newColumnTransforms.computed);
|
|
246
|
+
}
|
|
228
247
|
// Handle single Field -> convert to array of Fields
|
|
229
248
|
if (newColumnTransforms instanceof arrow_1.Field) {
|
|
230
249
|
newColumnTransforms = [newColumnTransforms];
|
|
@@ -250,6 +269,15 @@ class LocalTable extends Table {
|
|
|
250
269
|
}
|
|
251
270
|
throw new Error("Invalid input type for addColumns");
|
|
252
271
|
}
|
|
272
|
+
async refreshColumn(column) {
|
|
273
|
+
return await this.inner.refreshColumn(column);
|
|
274
|
+
}
|
|
275
|
+
async refreshColumnAsync(column) {
|
|
276
|
+
return await this.inner.refreshColumnAsync(column);
|
|
277
|
+
}
|
|
278
|
+
async refreshMaterializedView(full, sourceVersion) {
|
|
279
|
+
return await this.inner.refreshMaterializedView(full, sourceVersion);
|
|
280
|
+
}
|
|
253
281
|
async alterColumns(columnAlterations) {
|
|
254
282
|
const processedAlterations = columnAlterations.map((alteration) => {
|
|
255
283
|
if (typeof alteration.dataType === "string") {
|
|
@@ -299,6 +327,18 @@ class LocalTable extends Table {
|
|
|
299
327
|
async closeLsmWriters() {
|
|
300
328
|
return await this.inner.closeLsmWriters();
|
|
301
329
|
}
|
|
330
|
+
async flushLsm() {
|
|
331
|
+
return await this.inner.flushLsm();
|
|
332
|
+
}
|
|
333
|
+
async compactLsm() {
|
|
334
|
+
return await this.inner.compactLsm();
|
|
335
|
+
}
|
|
336
|
+
async checkpointLsm() {
|
|
337
|
+
return await this.inner.checkpointLsm();
|
|
338
|
+
}
|
|
339
|
+
async getLsmStats(includeGenerationRows = false) {
|
|
340
|
+
return (await this.inner.getLsmStats(includeGenerationRows)) ?? undefined;
|
|
341
|
+
}
|
|
302
342
|
async version() {
|
|
303
343
|
return await this.inner.version();
|
|
304
344
|
}
|
|
@@ -443,16 +483,16 @@ class Branches {
|
|
|
443
483
|
return (await this.#inner.diff(fromBranch));
|
|
444
484
|
}
|
|
445
485
|
/**
|
|
446
|
-
*
|
|
486
|
+
* Cherry-pick a branch onto main.
|
|
447
487
|
*
|
|
448
|
-
* Set `dryRun` to `true` to preview
|
|
449
|
-
* with `status: "
|
|
488
|
+
* Set `dryRun` to `true` to preview. A failed cherry-pick resolves
|
|
489
|
+
* with `status: "failed"` instead of throwing.
|
|
450
490
|
*
|
|
451
|
-
* @param fromBranch Branch to
|
|
452
|
-
* @param dryRun When true, only preview
|
|
491
|
+
* @param fromBranch Branch to cherry-pick from.
|
|
492
|
+
* @param dryRun When true, only preview. Defaults to false.
|
|
453
493
|
*/
|
|
454
|
-
async
|
|
455
|
-
return (await this.#inner.
|
|
494
|
+
async cherryPick(fromBranch, dryRun = false) {
|
|
495
|
+
return (await this.#inner.cherryPick(fromBranch, dryRun));
|
|
456
496
|
}
|
|
457
497
|
}
|
|
458
498
|
exports.Branches = Branches;
|
package/package.json
CHANGED
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
"ann"
|
|
12
12
|
],
|
|
13
13
|
"private": false,
|
|
14
|
-
"version": "0.
|
|
14
|
+
"version": "0.38.0-beta.12",
|
|
15
15
|
"main": "dist/index.js",
|
|
16
16
|
"exports": {
|
|
17
17
|
".": "./dist/index.js",
|
|
@@ -106,13 +106,13 @@
|
|
|
106
106
|
"optionalDependencies": {
|
|
107
107
|
"@huggingface/transformers": "3.0.2",
|
|
108
108
|
"openai": "4.29.2",
|
|
109
|
-
"@lancedb/lancedb-darwin-arm64": "0.
|
|
110
|
-
"@lancedb/lancedb-linux-x64-gnu": "0.
|
|
111
|
-
"@lancedb/lancedb-linux-arm64-gnu": "0.
|
|
112
|
-
"@lancedb/lancedb-linux-x64-musl": "0.
|
|
113
|
-
"@lancedb/lancedb-linux-arm64-musl": "0.
|
|
114
|
-
"@lancedb/lancedb-win32-x64-msvc": "0.
|
|
115
|
-
"@lancedb/lancedb-win32-arm64-msvc": "0.
|
|
109
|
+
"@lancedb/lancedb-darwin-arm64": "0.38.0-beta.12",
|
|
110
|
+
"@lancedb/lancedb-linux-x64-gnu": "0.38.0-beta.12",
|
|
111
|
+
"@lancedb/lancedb-linux-arm64-gnu": "0.38.0-beta.12",
|
|
112
|
+
"@lancedb/lancedb-linux-x64-musl": "0.38.0-beta.12",
|
|
113
|
+
"@lancedb/lancedb-linux-arm64-musl": "0.38.0-beta.12",
|
|
114
|
+
"@lancedb/lancedb-win32-x64-msvc": "0.38.0-beta.12",
|
|
115
|
+
"@lancedb/lancedb-win32-arm64-msvc": "0.38.0-beta.12"
|
|
116
116
|
},
|
|
117
117
|
"peerDependencies": {
|
|
118
118
|
"@types/node": ">=18",
|