@workglow/storage 0.0.113 → 0.0.115
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/package.json +8 -8
- package/src/vector/README.md +8 -9
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@workglow/storage",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.0.
|
|
4
|
+
"version": "0.0.115",
|
|
5
5
|
"description": "Storage abstraction layer for Workglow, supporting IndexedDB, PostgreSQL, and Supabase with unified interfaces.",
|
|
6
6
|
"scripts": {
|
|
7
7
|
"watch": "concurrently -c 'auto' 'bun:watch-*'",
|
|
@@ -21,9 +21,9 @@
|
|
|
21
21
|
"test": "bun test"
|
|
22
22
|
},
|
|
23
23
|
"peerDependencies": {
|
|
24
|
-
"@workglow/sqlite": "0.0.
|
|
25
|
-
"@workglow/util": "0.0.
|
|
26
|
-
"pg": "^8.
|
|
24
|
+
"@workglow/sqlite": "0.0.115",
|
|
25
|
+
"@workglow/util": "0.0.115",
|
|
26
|
+
"pg": "^8.20.0",
|
|
27
27
|
"@supabase/supabase-js": "^2.98.0"
|
|
28
28
|
},
|
|
29
29
|
"peerDependenciesMeta": {
|
|
@@ -35,10 +35,10 @@
|
|
|
35
35
|
}
|
|
36
36
|
},
|
|
37
37
|
"devDependencies": {
|
|
38
|
-
"@workglow/sqlite": "0.0.
|
|
39
|
-
"@workglow/util": "0.0.
|
|
40
|
-
"pg": "^8.
|
|
41
|
-
"@types/pg": "^8.
|
|
38
|
+
"@workglow/sqlite": "0.0.115",
|
|
39
|
+
"@workglow/util": "0.0.115",
|
|
40
|
+
"pg": "^8.20.0",
|
|
41
|
+
"@types/pg": "^8.18.0",
|
|
42
42
|
"@supabase/supabase-js": "^2.98.0",
|
|
43
43
|
"fake-indexeddb": "^6.2.4"
|
|
44
44
|
},
|
package/src/vector/README.md
CHANGED
|
@@ -293,7 +293,7 @@ Register and retrieve chunk vector repositories globally:
|
|
|
293
293
|
|
|
294
294
|
```typescript
|
|
295
295
|
import { getChunkVectorRepository, getGlobalChunkVectorRepositories } from "@workglow/storage";
|
|
296
|
-
import { registerChunkVectorRepository, getGlobalChunkVectorRepositories } from "@workglow/
|
|
296
|
+
import { registerChunkVectorRepository, getGlobalChunkVectorRepositories } from "@workglow/knowledge-base";
|
|
297
297
|
|
|
298
298
|
// Register a repository
|
|
299
299
|
registerChunkVectorRepository("my-chunks", repo);
|
|
@@ -344,17 +344,16 @@ Quantized vectors reduce storage and can improve performance:
|
|
|
344
344
|
- **Cons:** Requires PostgreSQL server and pgvector extension
|
|
345
345
|
- **Setup:** `CREATE EXTENSION vector;`
|
|
346
346
|
|
|
347
|
-
## Integration with
|
|
347
|
+
## Integration with KnowledgeBase
|
|
348
348
|
|
|
349
|
-
The chunk vector repository works alongside `
|
|
349
|
+
The chunk vector repository works alongside `KnowledgeBase` for hierarchical document storage:
|
|
350
350
|
|
|
351
351
|
```typescript
|
|
352
|
+
import { KnowledgeBase, DocumentStorageSchema } from "@workglow/knowledge-base";
|
|
352
353
|
import {
|
|
353
|
-
DocumentDataset,
|
|
354
354
|
InMemoryChunkVectorStorage,
|
|
355
355
|
InMemoryTabularStorage,
|
|
356
356
|
} from "@workglow/storage";
|
|
357
|
-
import { DocumentStorageSchema } from "@workglow/storage";
|
|
358
357
|
|
|
359
358
|
// Initialize storage backends
|
|
360
359
|
const tabularStorage = new InMemoryTabularStorage(DocumentStorageSchema, ["doc_id"]);
|
|
@@ -363,14 +362,14 @@ await tabularStorage.setupDatabase();
|
|
|
363
362
|
const vectorStorage = new InMemoryChunkVectorStorage(384);
|
|
364
363
|
await vectorStorage.setupDatabase();
|
|
365
364
|
|
|
366
|
-
// Create
|
|
367
|
-
const
|
|
365
|
+
// Create knowledge base with both storages
|
|
366
|
+
const kb = new KnowledgeBase("my-kb", tabularStorage, vectorStorage, "My KB", "Description");
|
|
368
367
|
|
|
369
368
|
// Store document structure in tabular, chunks in vector
|
|
370
|
-
await
|
|
369
|
+
await kb.upsertDocument(document);
|
|
371
370
|
|
|
372
371
|
// Search chunks by vector similarity
|
|
373
|
-
const results = await
|
|
372
|
+
const results = await kb.similaritySearch(queryVector, { topK: 5 });
|
|
374
373
|
```
|
|
375
374
|
|
|
376
375
|
### Chunk Metadata for Hierarchical Documents
|