@lancedb/lancedb 0.27.2-beta.0 → 0.27.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/dist/arrow.d.ts +9 -1
- package/dist/arrow.js +27 -0
- package/dist/native.d.ts +2 -0
- package/dist/native.js +52 -52
- package/dist/query.js +21 -15
- package/package.json +8 -8
package/dist/arrow.d.ts
CHANGED
|
@@ -35,10 +35,18 @@ export type TableLike = ArrowTable | {
|
|
|
35
35
|
schema: SchemaLike;
|
|
36
36
|
batches: RecordBatchLike[];
|
|
37
37
|
};
|
|
38
|
-
export type IntoVector = Float32Array | Float64Array | number[] | Promise<Float32Array | Float64Array | number[]>;
|
|
38
|
+
export type IntoVector = Float32Array | Float64Array | Uint8Array | number[] | Promise<Float32Array | Float64Array | Uint8Array | number[]>;
|
|
39
39
|
export type MultiVector = IntoVector[];
|
|
40
40
|
export declare function isMultiVector(value: unknown): value is MultiVector;
|
|
41
41
|
export declare function isIntoVector(value: unknown): value is IntoVector;
|
|
42
|
+
/**
|
|
43
|
+
* Extract the underlying byte buffer and data type from a typed array
|
|
44
|
+
* for passing to the Rust NAPI layer without precision loss.
|
|
45
|
+
*/
|
|
46
|
+
export declare function extractVectorBuffer(vector: Float32Array | Float64Array | Uint8Array): {
|
|
47
|
+
data: Uint8Array;
|
|
48
|
+
dtype: string;
|
|
49
|
+
} | null;
|
|
42
50
|
export declare function isArrowTable(value: object): value is TableLike;
|
|
43
51
|
export declare function isNull(value: unknown): value is Null;
|
|
44
52
|
export declare function isInt(value: unknown): value is Int;
|
package/dist/arrow.js
CHANGED
|
@@ -19,6 +19,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
19
19
|
exports.MakeArrowTableOptions = exports.VectorColumnOptions = void 0;
|
|
20
20
|
exports.isMultiVector = isMultiVector;
|
|
21
21
|
exports.isIntoVector = isIntoVector;
|
|
22
|
+
exports.extractVectorBuffer = extractVectorBuffer;
|
|
22
23
|
exports.isArrowTable = isArrowTable;
|
|
23
24
|
exports.isNull = isNull;
|
|
24
25
|
exports.isInt = isInt;
|
|
@@ -67,11 +68,37 @@ __exportStar(require("apache-arrow"), exports);
|
|
|
67
68
|
function isMultiVector(value) {
|
|
68
69
|
return Array.isArray(value) && isIntoVector(value[0]);
|
|
69
70
|
}
|
|
71
|
+
const float16ArrayCtor = globalThis
|
|
72
|
+
.Float16Array;
|
|
70
73
|
function isIntoVector(value) {
|
|
71
74
|
return (value instanceof Float32Array ||
|
|
72
75
|
value instanceof Float64Array ||
|
|
76
|
+
value instanceof Uint8Array ||
|
|
77
|
+
(float16ArrayCtor !== undefined && value instanceof float16ArrayCtor) ||
|
|
73
78
|
(Array.isArray(value) && !Array.isArray(value[0])));
|
|
74
79
|
}
|
|
80
|
+
/**
|
|
81
|
+
* Extract the underlying byte buffer and data type from a typed array
|
|
82
|
+
* for passing to the Rust NAPI layer without precision loss.
|
|
83
|
+
*/
|
|
84
|
+
function extractVectorBuffer(vector) {
|
|
85
|
+
if (float16ArrayCtor !== undefined && vector instanceof float16ArrayCtor) {
|
|
86
|
+
return {
|
|
87
|
+
data: new Uint8Array(vector.buffer, vector.byteOffset, vector.byteLength),
|
|
88
|
+
dtype: "float16",
|
|
89
|
+
};
|
|
90
|
+
}
|
|
91
|
+
if (vector instanceof Float64Array) {
|
|
92
|
+
return {
|
|
93
|
+
data: new Uint8Array(vector.buffer, vector.byteOffset, vector.byteLength),
|
|
94
|
+
dtype: "float64",
|
|
95
|
+
};
|
|
96
|
+
}
|
|
97
|
+
if (vector instanceof Uint8Array && !(vector instanceof Float32Array)) {
|
|
98
|
+
return { data: vector, dtype: "uint8" };
|
|
99
|
+
}
|
|
100
|
+
return null;
|
|
101
|
+
}
|
|
75
102
|
function isArrowTable(value) {
|
|
76
103
|
if (value instanceof apache_arrow_1.Table)
|
|
77
104
|
return true;
|
package/dist/native.d.ts
CHANGED
|
@@ -91,6 +91,7 @@ export declare class Query {
|
|
|
91
91
|
limit(limit: number): void
|
|
92
92
|
offset(offset: number): void
|
|
93
93
|
nearestTo(vector: Float32Array): VectorQuery
|
|
94
|
+
nearestToRaw(data: Uint8Array, dtype: string): VectorQuery
|
|
94
95
|
fastSearch(): void
|
|
95
96
|
withRowId(): void
|
|
96
97
|
outputSchema(): Promise<Buffer>
|
|
@@ -213,6 +214,7 @@ export declare class TakeQuery {
|
|
|
213
214
|
export declare class VectorQuery {
|
|
214
215
|
column(column: string): void
|
|
215
216
|
addQueryVector(vector: Float32Array): void
|
|
217
|
+
addQueryVectorRaw(data: Uint8Array, dtype: string): void
|
|
216
218
|
distanceType(distanceType: string): void
|
|
217
219
|
postfilter(): void
|
|
218
220
|
refineFactor(refineFactor: number): void
|
package/dist/native.js
CHANGED
|
@@ -76,8 +76,8 @@ function requireNative() {
|
|
|
76
76
|
try {
|
|
77
77
|
const binding = require('@lancedb/lancedb-android-arm64');
|
|
78
78
|
const bindingPackageVersion = require('@lancedb/lancedb-android-arm64/package.json').version;
|
|
79
|
-
if (bindingPackageVersion !== '0.27.2
|
|
80
|
-
throw new Error(`Native binding package version mismatch, expected 0.27.2
|
|
79
|
+
if (bindingPackageVersion !== '0.27.2' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
80
|
+
throw new Error(`Native binding package version mismatch, expected 0.27.2 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
|
|
81
81
|
}
|
|
82
82
|
return binding;
|
|
83
83
|
}
|
|
@@ -95,8 +95,8 @@ function requireNative() {
|
|
|
95
95
|
try {
|
|
96
96
|
const binding = require('@lancedb/lancedb-android-arm-eabi');
|
|
97
97
|
const bindingPackageVersion = require('@lancedb/lancedb-android-arm-eabi/package.json').version;
|
|
98
|
-
if (bindingPackageVersion !== '0.27.2
|
|
99
|
-
throw new Error(`Native binding package version mismatch, expected 0.27.2
|
|
98
|
+
if (bindingPackageVersion !== '0.27.2' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
99
|
+
throw new Error(`Native binding package version mismatch, expected 0.27.2 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
|
|
100
100
|
}
|
|
101
101
|
return binding;
|
|
102
102
|
}
|
|
@@ -120,8 +120,8 @@ function requireNative() {
|
|
|
120
120
|
try {
|
|
121
121
|
const binding = require('@lancedb/lancedb-win32-x64-gnu');
|
|
122
122
|
const bindingPackageVersion = require('@lancedb/lancedb-win32-x64-gnu/package.json').version;
|
|
123
|
-
if (bindingPackageVersion !== '0.27.2
|
|
124
|
-
throw new Error(`Native binding package version mismatch, expected 0.27.2
|
|
123
|
+
if (bindingPackageVersion !== '0.27.2' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
124
|
+
throw new Error(`Native binding package version mismatch, expected 0.27.2 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
|
|
125
125
|
}
|
|
126
126
|
return binding;
|
|
127
127
|
}
|
|
@@ -139,8 +139,8 @@ function requireNative() {
|
|
|
139
139
|
try {
|
|
140
140
|
const binding = require('@lancedb/lancedb-win32-x64-msvc');
|
|
141
141
|
const bindingPackageVersion = require('@lancedb/lancedb-win32-x64-msvc/package.json').version;
|
|
142
|
-
if (bindingPackageVersion !== '0.27.2
|
|
143
|
-
throw new Error(`Native binding package version mismatch, expected 0.27.2
|
|
142
|
+
if (bindingPackageVersion !== '0.27.2' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
143
|
+
throw new Error(`Native binding package version mismatch, expected 0.27.2 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
|
|
144
144
|
}
|
|
145
145
|
return binding;
|
|
146
146
|
}
|
|
@@ -159,8 +159,8 @@ function requireNative() {
|
|
|
159
159
|
try {
|
|
160
160
|
const binding = require('@lancedb/lancedb-win32-ia32-msvc');
|
|
161
161
|
const bindingPackageVersion = require('@lancedb/lancedb-win32-ia32-msvc/package.json').version;
|
|
162
|
-
if (bindingPackageVersion !== '0.27.2
|
|
163
|
-
throw new Error(`Native binding package version mismatch, expected 0.27.2
|
|
162
|
+
if (bindingPackageVersion !== '0.27.2' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
163
|
+
throw new Error(`Native binding package version mismatch, expected 0.27.2 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
|
|
164
164
|
}
|
|
165
165
|
return binding;
|
|
166
166
|
}
|
|
@@ -178,8 +178,8 @@ function requireNative() {
|
|
|
178
178
|
try {
|
|
179
179
|
const binding = require('@lancedb/lancedb-win32-arm64-msvc');
|
|
180
180
|
const bindingPackageVersion = require('@lancedb/lancedb-win32-arm64-msvc/package.json').version;
|
|
181
|
-
if (bindingPackageVersion !== '0.27.2
|
|
182
|
-
throw new Error(`Native binding package version mismatch, expected 0.27.2
|
|
181
|
+
if (bindingPackageVersion !== '0.27.2' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
182
|
+
throw new Error(`Native binding package version mismatch, expected 0.27.2 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
|
|
183
183
|
}
|
|
184
184
|
return binding;
|
|
185
185
|
}
|
|
@@ -201,8 +201,8 @@ function requireNative() {
|
|
|
201
201
|
try {
|
|
202
202
|
const binding = require('@lancedb/lancedb-darwin-universal');
|
|
203
203
|
const bindingPackageVersion = require('@lancedb/lancedb-darwin-universal/package.json').version;
|
|
204
|
-
if (bindingPackageVersion !== '0.27.2
|
|
205
|
-
throw new Error(`Native binding package version mismatch, expected 0.27.2
|
|
204
|
+
if (bindingPackageVersion !== '0.27.2' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
205
|
+
throw new Error(`Native binding package version mismatch, expected 0.27.2 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
|
|
206
206
|
}
|
|
207
207
|
return binding;
|
|
208
208
|
}
|
|
@@ -219,8 +219,8 @@ function requireNative() {
|
|
|
219
219
|
try {
|
|
220
220
|
const binding = require('@lancedb/lancedb-darwin-x64');
|
|
221
221
|
const bindingPackageVersion = require('@lancedb/lancedb-darwin-x64/package.json').version;
|
|
222
|
-
if (bindingPackageVersion !== '0.27.2
|
|
223
|
-
throw new Error(`Native binding package version mismatch, expected 0.27.2
|
|
222
|
+
if (bindingPackageVersion !== '0.27.2' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
223
|
+
throw new Error(`Native binding package version mismatch, expected 0.27.2 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
|
|
224
224
|
}
|
|
225
225
|
return binding;
|
|
226
226
|
}
|
|
@@ -238,8 +238,8 @@ function requireNative() {
|
|
|
238
238
|
try {
|
|
239
239
|
const binding = require('@lancedb/lancedb-darwin-arm64');
|
|
240
240
|
const bindingPackageVersion = require('@lancedb/lancedb-darwin-arm64/package.json').version;
|
|
241
|
-
if (bindingPackageVersion !== '0.27.2
|
|
242
|
-
throw new Error(`Native binding package version mismatch, expected 0.27.2
|
|
241
|
+
if (bindingPackageVersion !== '0.27.2' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
242
|
+
throw new Error(`Native binding package version mismatch, expected 0.27.2 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
|
|
243
243
|
}
|
|
244
244
|
return binding;
|
|
245
245
|
}
|
|
@@ -262,8 +262,8 @@ function requireNative() {
|
|
|
262
262
|
try {
|
|
263
263
|
const binding = require('@lancedb/lancedb-freebsd-x64');
|
|
264
264
|
const bindingPackageVersion = require('@lancedb/lancedb-freebsd-x64/package.json').version;
|
|
265
|
-
if (bindingPackageVersion !== '0.27.2
|
|
266
|
-
throw new Error(`Native binding package version mismatch, expected 0.27.2
|
|
265
|
+
if (bindingPackageVersion !== '0.27.2' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
266
|
+
throw new Error(`Native binding package version mismatch, expected 0.27.2 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
|
|
267
267
|
}
|
|
268
268
|
return binding;
|
|
269
269
|
}
|
|
@@ -281,8 +281,8 @@ function requireNative() {
|
|
|
281
281
|
try {
|
|
282
282
|
const binding = require('@lancedb/lancedb-freebsd-arm64');
|
|
283
283
|
const bindingPackageVersion = require('@lancedb/lancedb-freebsd-arm64/package.json').version;
|
|
284
|
-
if (bindingPackageVersion !== '0.27.2
|
|
285
|
-
throw new Error(`Native binding package version mismatch, expected 0.27.2
|
|
284
|
+
if (bindingPackageVersion !== '0.27.2' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
285
|
+
throw new Error(`Native binding package version mismatch, expected 0.27.2 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
|
|
286
286
|
}
|
|
287
287
|
return binding;
|
|
288
288
|
}
|
|
@@ -306,8 +306,8 @@ function requireNative() {
|
|
|
306
306
|
try {
|
|
307
307
|
const binding = require('@lancedb/lancedb-linux-x64-musl');
|
|
308
308
|
const bindingPackageVersion = require('@lancedb/lancedb-linux-x64-musl/package.json').version;
|
|
309
|
-
if (bindingPackageVersion !== '0.27.2
|
|
310
|
-
throw new Error(`Native binding package version mismatch, expected 0.27.2
|
|
309
|
+
if (bindingPackageVersion !== '0.27.2' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
310
|
+
throw new Error(`Native binding package version mismatch, expected 0.27.2 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
|
|
311
311
|
}
|
|
312
312
|
return binding;
|
|
313
313
|
}
|
|
@@ -325,8 +325,8 @@ function requireNative() {
|
|
|
325
325
|
try {
|
|
326
326
|
const binding = require('@lancedb/lancedb-linux-x64-gnu');
|
|
327
327
|
const bindingPackageVersion = require('@lancedb/lancedb-linux-x64-gnu/package.json').version;
|
|
328
|
-
if (bindingPackageVersion !== '0.27.2
|
|
329
|
-
throw new Error(`Native binding package version mismatch, expected 0.27.2
|
|
328
|
+
if (bindingPackageVersion !== '0.27.2' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
329
|
+
throw new Error(`Native binding package version mismatch, expected 0.27.2 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
|
|
330
330
|
}
|
|
331
331
|
return binding;
|
|
332
332
|
}
|
|
@@ -346,8 +346,8 @@ function requireNative() {
|
|
|
346
346
|
try {
|
|
347
347
|
const binding = require('@lancedb/lancedb-linux-arm64-musl');
|
|
348
348
|
const bindingPackageVersion = require('@lancedb/lancedb-linux-arm64-musl/package.json').version;
|
|
349
|
-
if (bindingPackageVersion !== '0.27.2
|
|
350
|
-
throw new Error(`Native binding package version mismatch, expected 0.27.2
|
|
349
|
+
if (bindingPackageVersion !== '0.27.2' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
350
|
+
throw new Error(`Native binding package version mismatch, expected 0.27.2 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
|
|
351
351
|
}
|
|
352
352
|
return binding;
|
|
353
353
|
}
|
|
@@ -365,8 +365,8 @@ function requireNative() {
|
|
|
365
365
|
try {
|
|
366
366
|
const binding = require('@lancedb/lancedb-linux-arm64-gnu');
|
|
367
367
|
const bindingPackageVersion = require('@lancedb/lancedb-linux-arm64-gnu/package.json').version;
|
|
368
|
-
if (bindingPackageVersion !== '0.27.2
|
|
369
|
-
throw new Error(`Native binding package version mismatch, expected 0.27.2
|
|
368
|
+
if (bindingPackageVersion !== '0.27.2' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
369
|
+
throw new Error(`Native binding package version mismatch, expected 0.27.2 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
|
|
370
370
|
}
|
|
371
371
|
return binding;
|
|
372
372
|
}
|
|
@@ -386,8 +386,8 @@ function requireNative() {
|
|
|
386
386
|
try {
|
|
387
387
|
const binding = require('@lancedb/lancedb-linux-arm-musleabihf');
|
|
388
388
|
const bindingPackageVersion = require('@lancedb/lancedb-linux-arm-musleabihf/package.json').version;
|
|
389
|
-
if (bindingPackageVersion !== '0.27.2
|
|
390
|
-
throw new Error(`Native binding package version mismatch, expected 0.27.2
|
|
389
|
+
if (bindingPackageVersion !== '0.27.2' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
390
|
+
throw new Error(`Native binding package version mismatch, expected 0.27.2 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
|
|
391
391
|
}
|
|
392
392
|
return binding;
|
|
393
393
|
}
|
|
@@ -405,8 +405,8 @@ function requireNative() {
|
|
|
405
405
|
try {
|
|
406
406
|
const binding = require('@lancedb/lancedb-linux-arm-gnueabihf');
|
|
407
407
|
const bindingPackageVersion = require('@lancedb/lancedb-linux-arm-gnueabihf/package.json').version;
|
|
408
|
-
if (bindingPackageVersion !== '0.27.2
|
|
409
|
-
throw new Error(`Native binding package version mismatch, expected 0.27.2
|
|
408
|
+
if (bindingPackageVersion !== '0.27.2' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
409
|
+
throw new Error(`Native binding package version mismatch, expected 0.27.2 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
|
|
410
410
|
}
|
|
411
411
|
return binding;
|
|
412
412
|
}
|
|
@@ -426,8 +426,8 @@ function requireNative() {
|
|
|
426
426
|
try {
|
|
427
427
|
const binding = require('@lancedb/lancedb-linux-loong64-musl');
|
|
428
428
|
const bindingPackageVersion = require('@lancedb/lancedb-linux-loong64-musl/package.json').version;
|
|
429
|
-
if (bindingPackageVersion !== '0.27.2
|
|
430
|
-
throw new Error(`Native binding package version mismatch, expected 0.27.2
|
|
429
|
+
if (bindingPackageVersion !== '0.27.2' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
430
|
+
throw new Error(`Native binding package version mismatch, expected 0.27.2 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
|
|
431
431
|
}
|
|
432
432
|
return binding;
|
|
433
433
|
}
|
|
@@ -445,8 +445,8 @@ function requireNative() {
|
|
|
445
445
|
try {
|
|
446
446
|
const binding = require('@lancedb/lancedb-linux-loong64-gnu');
|
|
447
447
|
const bindingPackageVersion = require('@lancedb/lancedb-linux-loong64-gnu/package.json').version;
|
|
448
|
-
if (bindingPackageVersion !== '0.27.2
|
|
449
|
-
throw new Error(`Native binding package version mismatch, expected 0.27.2
|
|
448
|
+
if (bindingPackageVersion !== '0.27.2' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
449
|
+
throw new Error(`Native binding package version mismatch, expected 0.27.2 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
|
|
450
450
|
}
|
|
451
451
|
return binding;
|
|
452
452
|
}
|
|
@@ -466,8 +466,8 @@ function requireNative() {
|
|
|
466
466
|
try {
|
|
467
467
|
const binding = require('@lancedb/lancedb-linux-riscv64-musl');
|
|
468
468
|
const bindingPackageVersion = require('@lancedb/lancedb-linux-riscv64-musl/package.json').version;
|
|
469
|
-
if (bindingPackageVersion !== '0.27.2
|
|
470
|
-
throw new Error(`Native binding package version mismatch, expected 0.27.2
|
|
469
|
+
if (bindingPackageVersion !== '0.27.2' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
470
|
+
throw new Error(`Native binding package version mismatch, expected 0.27.2 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
|
|
471
471
|
}
|
|
472
472
|
return binding;
|
|
473
473
|
}
|
|
@@ -485,8 +485,8 @@ function requireNative() {
|
|
|
485
485
|
try {
|
|
486
486
|
const binding = require('@lancedb/lancedb-linux-riscv64-gnu');
|
|
487
487
|
const bindingPackageVersion = require('@lancedb/lancedb-linux-riscv64-gnu/package.json').version;
|
|
488
|
-
if (bindingPackageVersion !== '0.27.2
|
|
489
|
-
throw new Error(`Native binding package version mismatch, expected 0.27.2
|
|
488
|
+
if (bindingPackageVersion !== '0.27.2' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
489
|
+
throw new Error(`Native binding package version mismatch, expected 0.27.2 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
|
|
490
490
|
}
|
|
491
491
|
return binding;
|
|
492
492
|
}
|
|
@@ -505,8 +505,8 @@ function requireNative() {
|
|
|
505
505
|
try {
|
|
506
506
|
const binding = require('@lancedb/lancedb-linux-ppc64-gnu');
|
|
507
507
|
const bindingPackageVersion = require('@lancedb/lancedb-linux-ppc64-gnu/package.json').version;
|
|
508
|
-
if (bindingPackageVersion !== '0.27.2
|
|
509
|
-
throw new Error(`Native binding package version mismatch, expected 0.27.2
|
|
508
|
+
if (bindingPackageVersion !== '0.27.2' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
509
|
+
throw new Error(`Native binding package version mismatch, expected 0.27.2 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
|
|
510
510
|
}
|
|
511
511
|
return binding;
|
|
512
512
|
}
|
|
@@ -524,8 +524,8 @@ function requireNative() {
|
|
|
524
524
|
try {
|
|
525
525
|
const binding = require('@lancedb/lancedb-linux-s390x-gnu');
|
|
526
526
|
const bindingPackageVersion = require('@lancedb/lancedb-linux-s390x-gnu/package.json').version;
|
|
527
|
-
if (bindingPackageVersion !== '0.27.2
|
|
528
|
-
throw new Error(`Native binding package version mismatch, expected 0.27.2
|
|
527
|
+
if (bindingPackageVersion !== '0.27.2' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
528
|
+
throw new Error(`Native binding package version mismatch, expected 0.27.2 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
|
|
529
529
|
}
|
|
530
530
|
return binding;
|
|
531
531
|
}
|
|
@@ -548,8 +548,8 @@ function requireNative() {
|
|
|
548
548
|
try {
|
|
549
549
|
const binding = require('@lancedb/lancedb-openharmony-arm64');
|
|
550
550
|
const bindingPackageVersion = require('@lancedb/lancedb-openharmony-arm64/package.json').version;
|
|
551
|
-
if (bindingPackageVersion !== '0.27.2
|
|
552
|
-
throw new Error(`Native binding package version mismatch, expected 0.27.2
|
|
551
|
+
if (bindingPackageVersion !== '0.27.2' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
552
|
+
throw new Error(`Native binding package version mismatch, expected 0.27.2 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
|
|
553
553
|
}
|
|
554
554
|
return binding;
|
|
555
555
|
}
|
|
@@ -567,8 +567,8 @@ function requireNative() {
|
|
|
567
567
|
try {
|
|
568
568
|
const binding = require('@lancedb/lancedb-openharmony-x64');
|
|
569
569
|
const bindingPackageVersion = require('@lancedb/lancedb-openharmony-x64/package.json').version;
|
|
570
|
-
if (bindingPackageVersion !== '0.27.2
|
|
571
|
-
throw new Error(`Native binding package version mismatch, expected 0.27.2
|
|
570
|
+
if (bindingPackageVersion !== '0.27.2' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
571
|
+
throw new Error(`Native binding package version mismatch, expected 0.27.2 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
|
|
572
572
|
}
|
|
573
573
|
return binding;
|
|
574
574
|
}
|
|
@@ -586,8 +586,8 @@ function requireNative() {
|
|
|
586
586
|
try {
|
|
587
587
|
const binding = require('@lancedb/lancedb-openharmony-arm');
|
|
588
588
|
const bindingPackageVersion = require('@lancedb/lancedb-openharmony-arm/package.json').version;
|
|
589
|
-
if (bindingPackageVersion !== '0.27.2
|
|
590
|
-
throw new Error(`Native binding package version mismatch, expected 0.27.2
|
|
589
|
+
if (bindingPackageVersion !== '0.27.2' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
590
|
+
throw new Error(`Native binding package version mismatch, expected 0.27.2 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
|
|
591
591
|
}
|
|
592
592
|
return binding;
|
|
593
593
|
}
|
package/dist/query.js
CHANGED
|
@@ -556,10 +556,8 @@ class VectorQuery extends StandardQueryBase {
|
|
|
556
556
|
const res = (async () => {
|
|
557
557
|
try {
|
|
558
558
|
const v = await vector;
|
|
559
|
-
const arr = Float32Array.from(v);
|
|
560
|
-
//
|
|
561
559
|
// biome-ignore lint/suspicious/noExplicitAny: we need to get the `inner`, but js has no package scoping
|
|
562
|
-
const value = this.addQueryVector(
|
|
560
|
+
const value = this.addQueryVector(v);
|
|
563
561
|
const inner = value.inner;
|
|
564
562
|
return inner;
|
|
565
563
|
}
|
|
@@ -571,7 +569,13 @@ class VectorQuery extends StandardQueryBase {
|
|
|
571
569
|
}
|
|
572
570
|
else {
|
|
573
571
|
super.doCall((inner) => {
|
|
574
|
-
|
|
572
|
+
const raw = Array.isArray(vector) ? null : (0, arrow_1.extractVectorBuffer)(vector);
|
|
573
|
+
if (raw) {
|
|
574
|
+
inner.addQueryVectorRaw(raw.data, raw.dtype);
|
|
575
|
+
}
|
|
576
|
+
else {
|
|
577
|
+
inner.addQueryVector(Float32Array.from(vector));
|
|
578
|
+
}
|
|
575
579
|
});
|
|
576
580
|
return this;
|
|
577
581
|
}
|
|
@@ -650,15 +654,19 @@ class Query extends StandardQueryBase {
|
|
|
650
654
|
* a default `limit` of 10 will be used. @see {@link Query#limit}
|
|
651
655
|
*/
|
|
652
656
|
nearestTo(vector) {
|
|
657
|
+
const callNearestTo = (inner, resolved) => {
|
|
658
|
+
const raw = Array.isArray(resolved)
|
|
659
|
+
? null
|
|
660
|
+
: (0, arrow_1.extractVectorBuffer)(resolved);
|
|
661
|
+
if (raw) {
|
|
662
|
+
return inner.nearestToRaw(raw.data, raw.dtype);
|
|
663
|
+
}
|
|
664
|
+
return inner.nearestTo(Float32Array.from(resolved));
|
|
665
|
+
};
|
|
653
666
|
if (this.inner instanceof Promise) {
|
|
654
667
|
const nativeQuery = this.inner.then(async (inner) => {
|
|
655
|
-
|
|
656
|
-
|
|
657
|
-
return inner.nearestTo(arr);
|
|
658
|
-
}
|
|
659
|
-
else {
|
|
660
|
-
return inner.nearestTo(Float32Array.from(vector));
|
|
661
|
-
}
|
|
668
|
+
const resolved = vector instanceof Promise ? await vector : vector;
|
|
669
|
+
return callNearestTo(inner, resolved);
|
|
662
670
|
});
|
|
663
671
|
return new VectorQuery(nativeQuery);
|
|
664
672
|
}
|
|
@@ -666,10 +674,8 @@ class Query extends StandardQueryBase {
|
|
|
666
674
|
const res = (async () => {
|
|
667
675
|
try {
|
|
668
676
|
const v = await vector;
|
|
669
|
-
const arr = Float32Array.from(v);
|
|
670
|
-
//
|
|
671
677
|
// biome-ignore lint/suspicious/noExplicitAny: we need to get the `inner`, but js has no package scoping
|
|
672
|
-
const value = this.nearestTo(
|
|
678
|
+
const value = this.nearestTo(v);
|
|
673
679
|
const inner = value.inner;
|
|
674
680
|
return inner;
|
|
675
681
|
}
|
|
@@ -680,7 +686,7 @@ class Query extends StandardQueryBase {
|
|
|
680
686
|
return new VectorQuery(res);
|
|
681
687
|
}
|
|
682
688
|
else {
|
|
683
|
-
const vectorQuery = this.inner
|
|
689
|
+
const vectorQuery = callNearestTo(this.inner, vector);
|
|
684
690
|
return new VectorQuery(vectorQuery);
|
|
685
691
|
}
|
|
686
692
|
}
|
package/package.json
CHANGED
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
"ann"
|
|
12
12
|
],
|
|
13
13
|
"private": false,
|
|
14
|
-
"version": "0.27.2
|
|
14
|
+
"version": "0.27.2",
|
|
15
15
|
"main": "dist/index.js",
|
|
16
16
|
"exports": {
|
|
17
17
|
".": "./dist/index.js",
|
|
@@ -102,13 +102,13 @@
|
|
|
102
102
|
"reflect-metadata": "^0.2.2"
|
|
103
103
|
},
|
|
104
104
|
"optionalDependencies": {
|
|
105
|
-
"@lancedb/lancedb-darwin-arm64": "0.27.2
|
|
106
|
-
"@lancedb/lancedb-linux-x64-gnu": "0.27.2
|
|
107
|
-
"@lancedb/lancedb-linux-arm64-gnu": "0.27.2
|
|
108
|
-
"@lancedb/lancedb-linux-x64-musl": "0.27.2
|
|
109
|
-
"@lancedb/lancedb-linux-arm64-musl": "0.27.2
|
|
110
|
-
"@lancedb/lancedb-win32-x64-msvc": "0.27.2
|
|
111
|
-
"@lancedb/lancedb-win32-arm64-msvc": "0.27.2
|
|
105
|
+
"@lancedb/lancedb-darwin-arm64": "0.27.2",
|
|
106
|
+
"@lancedb/lancedb-linux-x64-gnu": "0.27.2",
|
|
107
|
+
"@lancedb/lancedb-linux-arm64-gnu": "0.27.2",
|
|
108
|
+
"@lancedb/lancedb-linux-x64-musl": "0.27.2",
|
|
109
|
+
"@lancedb/lancedb-linux-arm64-musl": "0.27.2",
|
|
110
|
+
"@lancedb/lancedb-win32-x64-msvc": "0.27.2",
|
|
111
|
+
"@lancedb/lancedb-win32-arm64-msvc": "0.27.2"
|
|
112
112
|
},
|
|
113
113
|
"peerDependencies": {
|
|
114
114
|
"apache-arrow": ">=15.0.0 <=18.1.0"
|