@workglow/ai 0.0.113 → 0.0.114
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/README.md +15 -19
- package/package.json +11 -11
package/README.md
CHANGED
|
@@ -425,8 +425,8 @@ The AI package provides a comprehensive set of tasks for building RAG pipelines.
|
|
|
425
425
|
|
|
426
426
|
| Task | Description |
|
|
427
427
|
| ----------------------- | ---------------------------------------- |
|
|
428
|
-
| `ChunkToVectorTask` | Transforms chunks to vector store format |
|
|
429
|
-
| `ChunkVectorUpsertTask` | Stores vectors in a
|
|
428
|
+
| `ChunkToVectorTask` | Transforms chunks to vector store format (input: `vector` + `chunks`, output: `vectors`) |
|
|
429
|
+
| `ChunkVectorUpsertTask` | Stores vectors in a KnowledgeBase (input: `knowledgeBase` + `vectors`) |
|
|
430
430
|
| `ChunkVectorSearchTask` | Searches vectors by similarity |
|
|
431
431
|
| `VectorQuantizeTask` | Quantizes vectors for storage efficiency |
|
|
432
432
|
|
|
@@ -445,10 +445,13 @@ The AI package provides a comprehensive set of tasks for building RAG pipelines.
|
|
|
445
445
|
|
|
446
446
|
```typescript
|
|
447
447
|
import { Workflow } from "@workglow/task-graph";
|
|
448
|
-
import {
|
|
448
|
+
import { createKnowledgeBase } from "@workglow/dataset";
|
|
449
449
|
|
|
450
|
-
|
|
451
|
-
await
|
|
450
|
+
// Create a KnowledgeBase (auto-registers globally as "my-kb")
|
|
451
|
+
const kb = await createKnowledgeBase({
|
|
452
|
+
name: "my-kb",
|
|
453
|
+
vectorDimensions: 384, // must match your embedding model
|
|
454
|
+
});
|
|
452
455
|
|
|
453
456
|
// Document ingestion - fully chainable, no loops required
|
|
454
457
|
await new Workflow()
|
|
@@ -470,25 +473,18 @@ await new Workflow()
|
|
|
470
473
|
model: "Xenova/all-MiniLM-L6-v2",
|
|
471
474
|
})
|
|
472
475
|
.chunkToVector()
|
|
473
|
-
.
|
|
474
|
-
|
|
476
|
+
.chunkVectorUpsert({
|
|
477
|
+
knowledgeBase: "my-kb",
|
|
475
478
|
})
|
|
476
479
|
.run();
|
|
477
480
|
|
|
478
|
-
// Query pipeline
|
|
479
|
-
const
|
|
480
|
-
.
|
|
481
|
+
// Query pipeline — ChunkRetrievalTask handles embedding + vector search end-to-end
|
|
482
|
+
const result = await new Workflow()
|
|
483
|
+
.chunkRetrieval({
|
|
484
|
+
knowledgeBase: "my-kb",
|
|
481
485
|
query: "What is transfer learning?",
|
|
482
|
-
method: "multi-query",
|
|
483
|
-
numVariations: 3,
|
|
484
|
-
})
|
|
485
|
-
.textEmbedding({
|
|
486
486
|
model: "Xenova/all-MiniLM-L6-v2",
|
|
487
|
-
})
|
|
488
|
-
.vectorStoreSearch({
|
|
489
|
-
repository: vectorRepo,
|
|
490
487
|
topK: 10,
|
|
491
|
-
scoreThreshold: 0.5,
|
|
492
488
|
})
|
|
493
489
|
.reranker({
|
|
494
490
|
query: "What is transfer learning?",
|
|
@@ -537,7 +533,7 @@ Each task passes through what the next task needs:
|
|
|
537
533
|
| `hierarchicalChunker` | `doc_id` | `chunks`, `text[]`, `count` |
|
|
538
534
|
| `textEmbedding` | (implicit) | `vector[]` |
|
|
539
535
|
| `chunkToVector` | - | `ids[]`, `vectors[]`, `metadata[]` |
|
|
540
|
-
| `
|
|
536
|
+
| `chunkVectorUpsert` | - | `count`, `ids` |
|
|
541
537
|
|
|
542
538
|
This design eliminates the need for external loops - the entire pipeline chains together naturally.
|
|
543
539
|
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@workglow/ai",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.0.
|
|
4
|
+
"version": "0.0.114",
|
|
5
5
|
"description": "Core AI functionality for Workglow, including task execution, model management, and AI pipeline orchestration.",
|
|
6
6
|
"scripts": {
|
|
7
7
|
"watch": "concurrently -c 'auto' 'bun:watch-*'",
|
|
@@ -37,11 +37,11 @@
|
|
|
37
37
|
"access": "public"
|
|
38
38
|
},
|
|
39
39
|
"peerDependencies": {
|
|
40
|
-
"@workglow/dataset": "0.0.
|
|
41
|
-
"@workglow/job-queue": "0.0.
|
|
42
|
-
"@workglow/storage": "0.0.
|
|
43
|
-
"@workglow/task-graph": "0.0.
|
|
44
|
-
"@workglow/util": "0.0.
|
|
40
|
+
"@workglow/dataset": "0.0.114",
|
|
41
|
+
"@workglow/job-queue": "0.0.114",
|
|
42
|
+
"@workglow/storage": "0.0.114",
|
|
43
|
+
"@workglow/task-graph": "0.0.114",
|
|
44
|
+
"@workglow/util": "0.0.114"
|
|
45
45
|
},
|
|
46
46
|
"peerDependenciesMeta": {
|
|
47
47
|
"@workglow/dataset": {
|
|
@@ -61,10 +61,10 @@
|
|
|
61
61
|
}
|
|
62
62
|
},
|
|
63
63
|
"devDependencies": {
|
|
64
|
-
"@workglow/dataset": "0.0.
|
|
65
|
-
"@workglow/job-queue": "0.0.
|
|
66
|
-
"@workglow/storage": "0.0.
|
|
67
|
-
"@workglow/task-graph": "0.0.
|
|
68
|
-
"@workglow/util": "0.0.
|
|
64
|
+
"@workglow/dataset": "0.0.114",
|
|
65
|
+
"@workglow/job-queue": "0.0.114",
|
|
66
|
+
"@workglow/storage": "0.0.114",
|
|
67
|
+
"@workglow/task-graph": "0.0.114",
|
|
68
|
+
"@workglow/util": "0.0.114"
|
|
69
69
|
}
|
|
70
70
|
}
|