@workglow/ai 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/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 repository |
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 { InMemoryVectorRepository } from "@workglow/storage";
448
+ import { createKnowledgeBase } from "@workglow/knowledge-base";
449
449
 
450
- const vectorRepo = new InMemoryVectorRepository();
451
- await vectorRepo.setupDatabase();
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
- .vectorStoreUpsert({
474
- repository: vectorRepo,
476
+ .chunkVectorUpsert({
477
+ knowledgeBase: "my-kb",
475
478
  })
476
479
  .run();
477
480
 
478
- // Query pipeline
479
- const answer = await new Workflow()
480
- .queryExpander({
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
- | `vectorStoreUpsert` | - | `count`, `ids` |
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/dist/browser.js CHANGED
@@ -779,7 +779,7 @@ var backgroundRemoval = (input, config) => {
779
779
  Workflow.prototype.backgroundRemoval = CreateWorkflow(BackgroundRemovalTask);
780
780
 
781
781
  // src/task/ChunkRetrievalTask.ts
782
- import { TypeKnowledgeBase } from "@workglow/dataset";
782
+ import { TypeKnowledgeBase } from "@workglow/knowledge-base";
783
783
  import {
784
784
  CreateWorkflow as CreateWorkflow3,
785
785
  Task,
@@ -1031,7 +1031,7 @@ var chunkRetrieval = (input, config) => {
1031
1031
  Workflow3.prototype.chunkRetrieval = CreateWorkflow3(ChunkRetrievalTask);
1032
1032
 
1033
1033
  // src/task/ChunkToVectorTask.ts
1034
- import { ChunkRecordSchema } from "@workglow/dataset";
1034
+ import { ChunkRecordSchema } from "@workglow/knowledge-base";
1035
1035
  import {
1036
1036
  CreateWorkflow as CreateWorkflow4,
1037
1037
  Task as Task2,
@@ -1165,7 +1165,7 @@ var chunkToVector = (input, config) => {
1165
1165
  Workflow4.prototype.chunkToVector = CreateWorkflow4(ChunkToVectorTask);
1166
1166
 
1167
1167
  // src/task/ChunkVectorHybridSearchTask.ts
1168
- import { TypeKnowledgeBase as TypeKnowledgeBase2 } from "@workglow/dataset";
1168
+ import { TypeKnowledgeBase as TypeKnowledgeBase2 } from "@workglow/knowledge-base";
1169
1169
  import {
1170
1170
  CreateWorkflow as CreateWorkflow5,
1171
1171
  Task as Task3,
@@ -1339,7 +1339,7 @@ var hybridSearch = async (input, config) => {
1339
1339
  Workflow5.prototype.hybridSearch = CreateWorkflow5(ChunkVectorHybridSearchTask);
1340
1340
 
1341
1341
  // src/task/ChunkVectorSearchTask.ts
1342
- import { TypeKnowledgeBase as TypeKnowledgeBase3 } from "@workglow/dataset";
1342
+ import { TypeKnowledgeBase as TypeKnowledgeBase3 } from "@workglow/knowledge-base";
1343
1343
  import {
1344
1344
  CreateWorkflow as CreateWorkflow6,
1345
1345
  Task as Task4,
@@ -1439,7 +1439,7 @@ class ChunkVectorSearchTask extends Task4 {
1439
1439
  static outputSchema() {
1440
1440
  return outputSchema4;
1441
1441
  }
1442
- async execute(input, context) {
1442
+ async execute(input, _context) {
1443
1443
  const { knowledgeBase, query, topK = 10, filter, scoreThreshold = 0 } = input;
1444
1444
  const kb = knowledgeBase;
1445
1445
  const results = await kb.similaritySearch(query, {
@@ -1462,7 +1462,7 @@ var vectorStoreSearch = (input, config) => {
1462
1462
  Workflow6.prototype.vectorStoreSearch = CreateWorkflow6(ChunkVectorSearchTask);
1463
1463
 
1464
1464
  // src/task/ChunkVectorUpsertTask.ts
1465
- import { TypeKnowledgeBase as TypeKnowledgeBase4 } from "@workglow/dataset";
1465
+ import { TypeKnowledgeBase as TypeKnowledgeBase4 } from "@workglow/knowledge-base";
1466
1466
  import {
1467
1467
  CreateWorkflow as CreateWorkflow7,
1468
1468
  Task as Task5,
@@ -1584,7 +1584,7 @@ var chunkVectorUpsert = (input, config) => {
1584
1584
  Workflow7.prototype.chunkVectorUpsert = CreateWorkflow7(ChunkVectorUpsertTask);
1585
1585
 
1586
1586
  // src/task/ContextBuilderTask.ts
1587
- import { estimateTokens } from "@workglow/dataset";
1587
+ import { estimateTokens } from "@workglow/knowledge-base";
1588
1588
  import {
1589
1589
  CreateWorkflow as CreateWorkflow9,
1590
1590
  Task as Task6,
@@ -1942,7 +1942,7 @@ Workflow9.prototype.contextBuilder = CreateWorkflow9(ContextBuilderTask);
1942
1942
  import {
1943
1943
  getChildren,
1944
1944
  hasChildren
1945
- } from "@workglow/dataset";
1945
+ } from "@workglow/knowledge-base";
1946
1946
  import {
1947
1947
  CreateWorkflow as CreateWorkflow12,
1948
1948
  Task as Task7,
@@ -3009,7 +3009,7 @@ import {
3009
3009
  estimateTokens as estimateTokens2,
3010
3010
  getChildren as getChildren2,
3011
3011
  hasChildren as hasChildren2
3012
- } from "@workglow/dataset";
3012
+ } from "@workglow/knowledge-base";
3013
3013
  import {
3014
3014
  CreateWorkflow as CreateWorkflow18,
3015
3015
  Task as Task8,
@@ -3245,7 +3245,7 @@ Workflow18.prototype.hierarchicalChunker = CreateWorkflow18(HierarchicalChunkerT
3245
3245
  import {
3246
3246
  ChunkRecordArraySchema,
3247
3247
  TypeKnowledgeBase as TypeKnowledgeBase5
3248
- } from "@workglow/dataset";
3248
+ } from "@workglow/knowledge-base";
3249
3249
  import {
3250
3250
  CreateWorkflow as CreateWorkflow19,
3251
3251
  Task as Task9,
@@ -4506,7 +4506,7 @@ var reranker = (input, config) => {
4506
4506
  Workflow29.prototype.reranker = CreateWorkflow29(RerankerTask);
4507
4507
 
4508
4508
  // src/task/StructuralParserTask.ts
4509
- import { StructuralParser } from "@workglow/dataset";
4509
+ import { StructuralParser } from "@workglow/knowledge-base";
4510
4510
  import {
4511
4511
  CreateWorkflow as CreateWorkflow30,
4512
4512
  Task as Task12,
@@ -6348,4 +6348,4 @@ export {
6348
6348
  AiJob
6349
6349
  };
6350
6350
 
6351
- //# debugId=0E9DD67701C6DF9264756E2164756E21
6351
+ //# debugId=168B101D45A05FA664756E2164756E21