@larkup/vector-stores 0.1.21 → 0.1.22
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/CHANGELOG.md +6 -0
- package/package.json +4 -4
- package/src/adapters/lancedb.ts +23 -5
- package/tsconfig.tsbuildinfo +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,11 @@
|
|
|
1
1
|
# @larkup/vector-stores
|
|
2
2
|
|
|
3
|
+
## 0.1.22
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- 08e7029: Fix LanceDB native-module loading in packaged Larkup installations, align marketplace catalog versions with published tools, and make clearing a knowledge base discoverable.
|
|
8
|
+
|
|
3
9
|
## 0.1.21
|
|
4
10
|
|
|
5
11
|
### Patch Changes
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@larkup/vector-stores",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.22",
|
|
4
4
|
"publishConfig": {
|
|
5
5
|
"access": "public"
|
|
6
6
|
},
|
|
@@ -14,14 +14,14 @@
|
|
|
14
14
|
"./chroma": "./src/adapters/chroma.ts"
|
|
15
15
|
},
|
|
16
16
|
"dependencies": {
|
|
17
|
-
"@lancedb/lancedb": "^0.
|
|
18
|
-
"@pinecone-database/pinecone": "^
|
|
17
|
+
"@lancedb/lancedb": "^0.31.0",
|
|
18
|
+
"@pinecone-database/pinecone": "^8.1.0"
|
|
19
19
|
},
|
|
20
20
|
"peerDependencies": {
|
|
21
21
|
"@larkup/core": ">=0.1.20 <1.0.0"
|
|
22
22
|
},
|
|
23
23
|
"devDependencies": {
|
|
24
|
-
"chromadb": "^
|
|
24
|
+
"chromadb": "^3.5.0",
|
|
25
25
|
"typescript": "5.7.3"
|
|
26
26
|
}
|
|
27
27
|
}
|
package/src/adapters/lancedb.ts
CHANGED
|
@@ -1,8 +1,25 @@
|
|
|
1
1
|
import path from 'node:path';
|
|
2
2
|
import fs from 'node:fs/promises';
|
|
3
|
-
import * as lancedb from '@lancedb/lancedb';
|
|
4
3
|
import type { QueryHit, VectorRecord, VectorStoreAdapter } from './base';
|
|
5
4
|
|
|
5
|
+
type LanceDBModule = typeof import('@lancedb/lancedb');
|
|
6
|
+
type LanceConnection = Awaited<ReturnType<LanceDBModule['connect']>>;
|
|
7
|
+
type LanceTable = Awaited<ReturnType<LanceConnection['openTable']>>;
|
|
8
|
+
|
|
9
|
+
let lancedbModule: LanceDBModule | null = null;
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* Keep LanceDB outside Turbopack's server bundle. Its native binding resolves
|
|
13
|
+
* platform-specific optional packages at runtime, and static bundling turns
|
|
14
|
+
* the package name into a non-resolvable hashed external module.
|
|
15
|
+
*/
|
|
16
|
+
async function getLanceDB(): Promise<LanceDBModule> {
|
|
17
|
+
if (!lancedbModule) {
|
|
18
|
+
lancedbModule = await import(/* turbopackIgnore: true */ '@lancedb/lancedb');
|
|
19
|
+
}
|
|
20
|
+
return lancedbModule;
|
|
21
|
+
}
|
|
22
|
+
|
|
6
23
|
/**
|
|
7
24
|
* LanceDB adapter — embedded/on-disk for local dev, LanceDB Cloud, or an
|
|
8
25
|
* S3-compatible object store (including Cloudflare R2).
|
|
@@ -37,16 +54,17 @@ interface LanceRow extends Record<string, unknown> {
|
|
|
37
54
|
}
|
|
38
55
|
|
|
39
56
|
export class LanceDBAdapter implements VectorStoreAdapter {
|
|
40
|
-
private conn:
|
|
41
|
-
private table:
|
|
57
|
+
private conn: LanceConnection | null = null;
|
|
58
|
+
private table: LanceTable | null = null;
|
|
42
59
|
private readonly tableName: string;
|
|
43
60
|
|
|
44
61
|
constructor(private readonly config: LanceConfig) {
|
|
45
62
|
this.tableName = config.tableName?.trim() || 'documents';
|
|
46
63
|
}
|
|
47
64
|
|
|
48
|
-
private async connect(): Promise<
|
|
65
|
+
private async connect(): Promise<LanceConnection> {
|
|
49
66
|
if (this.conn) return this.conn;
|
|
67
|
+
const lancedb = await getLanceDB();
|
|
50
68
|
if (this.config.mode === 'cloud') {
|
|
51
69
|
if (!this.config.uri || !this.config.apiKey) {
|
|
52
70
|
throw new Error('LanceDB Cloud requires both a URI and an API key.');
|
|
@@ -208,7 +226,7 @@ export class LanceDBAdapter implements VectorStoreAdapter {
|
|
|
208
226
|
|
|
209
227
|
// ── Cloud mode ───────────────────────────────────────────────────────────
|
|
210
228
|
// to force a real authenticated HTTP round-trip.
|
|
211
|
-
let conn:
|
|
229
|
+
let conn: LanceConnection;
|
|
212
230
|
try {
|
|
213
231
|
conn = await this.connect();
|
|
214
232
|
} catch (err: any) {
|