@workglow/ai 0.2.2 → 0.2.3

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/bun.js CHANGED
@@ -3427,8 +3427,77 @@ var documentEnricher = (input, config) => {
3427
3427
  };
3428
3428
  Workflow14.prototype.documentEnricher = CreateWorkflow14(DocumentEnricherTask);
3429
3429
 
3430
+ // src/task/DocumentUpsertTask.ts
3431
+ import { Document, TypeKnowledgeBase as TypeKnowledgeBase5 } from "@workglow/knowledge-base";
3432
+ import { CreateWorkflow as CreateWorkflow15, Task as Task10, Workflow as Workflow15 } from "@workglow/task-graph";
3433
+ var inputSchema8 = {
3434
+ type: "object",
3435
+ properties: {
3436
+ knowledgeBase: TypeKnowledgeBase5({
3437
+ title: "Knowledge Base",
3438
+ description: "The knowledge base instance to store the document in"
3439
+ }),
3440
+ doc_id: {
3441
+ type: "string",
3442
+ title: "Document ID",
3443
+ description: "The document ID (from the parser)"
3444
+ },
3445
+ documentTree: {
3446
+ title: "Document Tree",
3447
+ description: "The hierarchical document tree to persist"
3448
+ },
3449
+ title: {
3450
+ type: "string",
3451
+ title: "Title",
3452
+ description: "Human-readable title stored in the document metadata"
3453
+ }
3454
+ },
3455
+ required: ["knowledgeBase", "doc_id", "documentTree", "title"],
3456
+ additionalProperties: false
3457
+ };
3458
+ var outputSchema8 = {
3459
+ type: "object",
3460
+ properties: {
3461
+ doc_id: {
3462
+ type: "string",
3463
+ title: "Document ID",
3464
+ description: "The document ID (passed through after persistence)"
3465
+ }
3466
+ },
3467
+ required: ["doc_id"],
3468
+ additionalProperties: false
3469
+ };
3470
+
3471
+ class DocumentUpsertTask extends Task10 {
3472
+ static type = "DocumentUpsertTask";
3473
+ static category = "Vector Store";
3474
+ static title = "Add Document";
3475
+ static description = "Persist a parsed document tree to a knowledge base";
3476
+ static cacheable = false;
3477
+ static inputSchema() {
3478
+ return inputSchema8;
3479
+ }
3480
+ static outputSchema() {
3481
+ return outputSchema8;
3482
+ }
3483
+ async execute(input, context) {
3484
+ const { knowledgeBase, doc_id, documentTree, title } = input;
3485
+ const kb = knowledgeBase;
3486
+ await context.updateProgress(1, "Upserting document");
3487
+ const document = new Document(documentTree, { title }, [], doc_id);
3488
+ const stored = await kb.upsertDocument(document);
3489
+ return {
3490
+ doc_id: stored.doc_id ?? doc_id
3491
+ };
3492
+ }
3493
+ }
3494
+ var documentUpsert = (input, config) => {
3495
+ return new DocumentUpsertTask(config).run(input);
3496
+ };
3497
+ Workflow15.prototype.documentUpsert = CreateWorkflow15(DocumentUpsertTask);
3498
+
3430
3499
  // src/task/DownloadModelTask.ts
3431
- import { CreateWorkflow as CreateWorkflow15, Workflow as Workflow15 } from "@workglow/task-graph";
3500
+ import { CreateWorkflow as CreateWorkflow16, Workflow as Workflow16 } from "@workglow/task-graph";
3432
3501
  var modelSchema9 = TypeModel("model");
3433
3502
  var DownloadModelInputSchema = {
3434
3503
  type: "object",
@@ -3495,10 +3564,10 @@ class DownloadModelTask extends AiTask {
3495
3564
  var downloadModel = (input, config) => {
3496
3565
  return new DownloadModelTask(config).run(input);
3497
3566
  };
3498
- Workflow15.prototype.downloadModel = CreateWorkflow15(DownloadModelTask);
3567
+ Workflow16.prototype.downloadModel = CreateWorkflow16(DownloadModelTask);
3499
3568
 
3500
3569
  // src/task/FaceDetectorTask.ts
3501
- import { CreateWorkflow as CreateWorkflow16, Workflow as Workflow16 } from "@workglow/task-graph";
3570
+ import { CreateWorkflow as CreateWorkflow17, Workflow as Workflow17 } from "@workglow/task-graph";
3502
3571
  var modelSchema10 = TypeModel("model:FaceDetectorTask");
3503
3572
  var TypeBoundingBox2 = {
3504
3573
  type: "object",
@@ -3626,10 +3695,10 @@ class FaceDetectorTask extends AiVisionTask {
3626
3695
  var faceDetector = (input, config) => {
3627
3696
  return new FaceDetectorTask(config).run(input);
3628
3697
  };
3629
- Workflow16.prototype.faceDetector = CreateWorkflow16(FaceDetectorTask);
3698
+ Workflow17.prototype.faceDetector = CreateWorkflow17(FaceDetectorTask);
3630
3699
 
3631
3700
  // src/task/FaceLandmarkerTask.ts
3632
- import { CreateWorkflow as CreateWorkflow17, Workflow as Workflow17 } from "@workglow/task-graph";
3701
+ import { CreateWorkflow as CreateWorkflow18, Workflow as Workflow18 } from "@workglow/task-graph";
3633
3702
  var modelSchema11 = TypeModel("model:FaceLandmarkerTask");
3634
3703
  var TypeLandmark = {
3635
3704
  type: "object",
@@ -3788,10 +3857,10 @@ class FaceLandmarkerTask extends AiVisionTask {
3788
3857
  var faceLandmarker = (input, config) => {
3789
3858
  return new FaceLandmarkerTask(config).run(input);
3790
3859
  };
3791
- Workflow17.prototype.faceLandmarker = CreateWorkflow17(FaceLandmarkerTask);
3860
+ Workflow18.prototype.faceLandmarker = CreateWorkflow18(FaceLandmarkerTask);
3792
3861
 
3793
3862
  // src/task/GestureRecognizerTask.ts
3794
- import { CreateWorkflow as CreateWorkflow18, Workflow as Workflow18 } from "@workglow/task-graph";
3863
+ import { CreateWorkflow as CreateWorkflow19, Workflow as Workflow19 } from "@workglow/task-graph";
3795
3864
  var modelSchema12 = TypeModel("model:GestureRecognizerTask");
3796
3865
  var TypeLandmark2 = {
3797
3866
  type: "object",
@@ -3956,10 +4025,10 @@ class GestureRecognizerTask extends AiVisionTask {
3956
4025
  var gestureRecognizer = (input, config) => {
3957
4026
  return new GestureRecognizerTask(config).run(input);
3958
4027
  };
3959
- Workflow18.prototype.gestureRecognizer = CreateWorkflow18(GestureRecognizerTask);
4028
+ Workflow19.prototype.gestureRecognizer = CreateWorkflow19(GestureRecognizerTask);
3960
4029
 
3961
4030
  // src/task/HandLandmarkerTask.ts
3962
- import { CreateWorkflow as CreateWorkflow19, Workflow as Workflow19 } from "@workglow/task-graph";
4031
+ import { CreateWorkflow as CreateWorkflow20, Workflow as Workflow20 } from "@workglow/task-graph";
3963
4032
  var modelSchema13 = TypeModel("model:HandLandmarkerTask");
3964
4033
  var TypeLandmark3 = {
3965
4034
  type: "object",
@@ -4101,7 +4170,7 @@ class HandLandmarkerTask extends AiVisionTask {
4101
4170
  var handLandmarker = (input, config) => {
4102
4171
  return new HandLandmarkerTask(config).run(input);
4103
4172
  };
4104
- Workflow19.prototype.handLandmarker = CreateWorkflow19(HandLandmarkerTask);
4173
+ Workflow20.prototype.handLandmarker = CreateWorkflow20(HandLandmarkerTask);
4105
4174
 
4106
4175
  // src/task/HierarchicalChunkerTask.ts
4107
4176
  import {
@@ -4110,13 +4179,13 @@ import {
4110
4179
  getChildren as getChildren2,
4111
4180
  hasChildren as hasChildren2
4112
4181
  } from "@workglow/knowledge-base";
4113
- import { CreateWorkflow as CreateWorkflow20, Task as Task10, Workflow as Workflow20 } from "@workglow/task-graph";
4182
+ import { CreateWorkflow as CreateWorkflow21, Task as Task11, Workflow as Workflow21 } from "@workglow/task-graph";
4114
4183
  import { uuid4 } from "@workglow/util";
4115
4184
  var modelSchema14 = TypeModel("model", {
4116
4185
  title: "Model",
4117
4186
  description: "Model to use for token counting"
4118
4187
  });
4119
- var inputSchema8 = {
4188
+ var inputSchema9 = {
4120
4189
  type: "object",
4121
4190
  properties: {
4122
4191
  doc_id: {
@@ -4161,7 +4230,7 @@ var inputSchema8 = {
4161
4230
  required: ["doc_id", "documentTree"],
4162
4231
  additionalProperties: false
4163
4232
  };
4164
- var outputSchema8 = {
4233
+ var outputSchema9 = {
4165
4234
  type: "object",
4166
4235
  properties: {
4167
4236
  doc_id: {
@@ -4191,17 +4260,17 @@ var outputSchema8 = {
4191
4260
  additionalProperties: false
4192
4261
  };
4193
4262
 
4194
- class HierarchicalChunkerTask extends Task10 {
4263
+ class HierarchicalChunkerTask extends Task11 {
4195
4264
  static type = "HierarchicalChunkerTask";
4196
4265
  static category = "Document";
4197
4266
  static title = "Hierarchical Chunker";
4198
4267
  static description = "Chunk documents hierarchically respecting token budgets";
4199
4268
  static cacheable = true;
4200
4269
  static inputSchema() {
4201
- return inputSchema8;
4270
+ return inputSchema9;
4202
4271
  }
4203
4272
  static outputSchema() {
4204
- return outputSchema8;
4273
+ return outputSchema9;
4205
4274
  }
4206
4275
  async execute(input, context) {
4207
4276
  const {
@@ -4335,15 +4404,15 @@ class HierarchicalChunkerTask extends Task10 {
4335
4404
  var hierarchicalChunker = (input, config) => {
4336
4405
  return new HierarchicalChunkerTask(config).run(input);
4337
4406
  };
4338
- Workflow20.prototype.hierarchicalChunker = CreateWorkflow20(HierarchicalChunkerTask);
4407
+ Workflow21.prototype.hierarchicalChunker = CreateWorkflow21(HierarchicalChunkerTask);
4339
4408
 
4340
4409
  // src/task/HierarchyJoinTask.ts
4341
- import { ChunkRecordArraySchema, TypeKnowledgeBase as TypeKnowledgeBase5 } from "@workglow/knowledge-base";
4342
- import { CreateWorkflow as CreateWorkflow21, Task as Task11, Workflow as Workflow21 } from "@workglow/task-graph";
4343
- var inputSchema9 = {
4410
+ import { ChunkRecordArraySchema, TypeKnowledgeBase as TypeKnowledgeBase6 } from "@workglow/knowledge-base";
4411
+ import { CreateWorkflow as CreateWorkflow22, Task as Task12, Workflow as Workflow22 } from "@workglow/task-graph";
4412
+ var inputSchema10 = {
4344
4413
  type: "object",
4345
4414
  properties: {
4346
- knowledgeBase: TypeKnowledgeBase5({
4415
+ knowledgeBase: TypeKnowledgeBase6({
4347
4416
  title: "Knowledge Base",
4348
4417
  description: "The knowledge base to query for hierarchy"
4349
4418
  }),
@@ -4382,7 +4451,7 @@ var inputSchema9 = {
4382
4451
  required: ["knowledgeBase", "chunks", "chunk_ids", "metadata", "scores"],
4383
4452
  additionalProperties: false
4384
4453
  };
4385
- var outputSchema9 = {
4454
+ var outputSchema10 = {
4386
4455
  type: "object",
4387
4456
  properties: {
4388
4457
  chunks: {
@@ -4414,17 +4483,17 @@ var outputSchema9 = {
4414
4483
  additionalProperties: false
4415
4484
  };
4416
4485
 
4417
- class HierarchyJoinTask extends Task11 {
4486
+ class HierarchyJoinTask extends Task12 {
4418
4487
  static type = "HierarchyJoinTask";
4419
4488
  static category = "RAG";
4420
4489
  static title = "Hierarchy Join";
4421
4490
  static description = "Enrich search results with document hierarchy context";
4422
4491
  static cacheable = false;
4423
4492
  static inputSchema() {
4424
- return inputSchema9;
4493
+ return inputSchema10;
4425
4494
  }
4426
4495
  static outputSchema() {
4427
- return outputSchema9;
4496
+ return outputSchema10;
4428
4497
  }
4429
4498
  async execute(input, context) {
4430
4499
  const {
@@ -4508,10 +4577,10 @@ class HierarchyJoinTask extends Task11 {
4508
4577
  var hierarchyJoin = (input, config) => {
4509
4578
  return new HierarchyJoinTask(config).run(input);
4510
4579
  };
4511
- Workflow21.prototype.hierarchyJoin = CreateWorkflow21(HierarchyJoinTask);
4580
+ Workflow22.prototype.hierarchyJoin = CreateWorkflow22(HierarchyJoinTask);
4512
4581
 
4513
4582
  // src/task/ImageClassificationTask.ts
4514
- import { CreateWorkflow as CreateWorkflow22, Workflow as Workflow22 } from "@workglow/task-graph";
4583
+ import { CreateWorkflow as CreateWorkflow23, Workflow as Workflow23 } from "@workglow/task-graph";
4515
4584
  var modelSchema15 = TypeModel("model:ImageClassificationTask");
4516
4585
  var ImageClassificationInputSchema = {
4517
4586
  type: "object",
@@ -4571,10 +4640,10 @@ class ImageClassificationTask extends AiVisionTask {
4571
4640
  var imageClassification = (input, config) => {
4572
4641
  return new ImageClassificationTask(config).run(input);
4573
4642
  };
4574
- Workflow22.prototype.imageClassification = CreateWorkflow22(ImageClassificationTask);
4643
+ Workflow23.prototype.imageClassification = CreateWorkflow23(ImageClassificationTask);
4575
4644
 
4576
4645
  // src/task/ImageEmbeddingTask.ts
4577
- import { CreateWorkflow as CreateWorkflow23, Workflow as Workflow23 } from "@workglow/task-graph";
4646
+ import { CreateWorkflow as CreateWorkflow24, Workflow as Workflow24 } from "@workglow/task-graph";
4578
4647
  import {
4579
4648
  TypedArraySchema as TypedArraySchema7
4580
4649
  } from "@workglow/util/schema";
@@ -4615,10 +4684,10 @@ class ImageEmbeddingTask extends AiVisionTask {
4615
4684
  var imageEmbedding = (input, config) => {
4616
4685
  return new ImageEmbeddingTask(config).run(input);
4617
4686
  };
4618
- Workflow23.prototype.imageEmbedding = CreateWorkflow23(ImageEmbeddingTask);
4687
+ Workflow24.prototype.imageEmbedding = CreateWorkflow24(ImageEmbeddingTask);
4619
4688
 
4620
4689
  // src/task/ImageSegmentationTask.ts
4621
- import { CreateWorkflow as CreateWorkflow24, Workflow as Workflow24 } from "@workglow/task-graph";
4690
+ import { CreateWorkflow as CreateWorkflow25, Workflow as Workflow25 } from "@workglow/task-graph";
4622
4691
  var modelSchema17 = TypeModel("model:ImageSegmentationTask");
4623
4692
  var ImageSegmentationInputSchema = {
4624
4693
  type: "object",
@@ -4703,10 +4772,10 @@ class ImageSegmentationTask extends AiVisionTask {
4703
4772
  var imageSegmentation = (input, config) => {
4704
4773
  return new ImageSegmentationTask(config).run(input);
4705
4774
  };
4706
- Workflow24.prototype.imageSegmentation = CreateWorkflow24(ImageSegmentationTask);
4775
+ Workflow25.prototype.imageSegmentation = CreateWorkflow25(ImageSegmentationTask);
4707
4776
 
4708
4777
  // src/task/ImageToTextTask.ts
4709
- import { CreateWorkflow as CreateWorkflow25, Workflow as Workflow25 } from "@workglow/task-graph";
4778
+ import { CreateWorkflow as CreateWorkflow26, Workflow as Workflow26 } from "@workglow/task-graph";
4710
4779
  var modelSchema18 = TypeModel("model:ImageToTextTask");
4711
4780
  var generatedTextSchema = {
4712
4781
  type: "string",
@@ -4758,10 +4827,10 @@ class ImageToTextTask extends AiVisionTask {
4758
4827
  var imageToText = (input, config) => {
4759
4828
  return new ImageToTextTask(config).run(input);
4760
4829
  };
4761
- Workflow25.prototype.imageToText = CreateWorkflow25(ImageToTextTask);
4830
+ Workflow26.prototype.imageToText = CreateWorkflow26(ImageToTextTask);
4762
4831
 
4763
4832
  // src/task/ModelInfoTask.ts
4764
- import { CreateWorkflow as CreateWorkflow26, Workflow as Workflow26 } from "@workglow/task-graph";
4833
+ import { CreateWorkflow as CreateWorkflow27, Workflow as Workflow27 } from "@workglow/task-graph";
4765
4834
  var modelSchema19 = TypeModel("model");
4766
4835
  var ModelInfoInputSchema = {
4767
4836
  type: "object",
@@ -4829,10 +4898,10 @@ class ModelInfoTask extends AiTask {
4829
4898
  var modelInfo = (input, config) => {
4830
4899
  return new ModelInfoTask(config).run(input);
4831
4900
  };
4832
- Workflow26.prototype.modelInfo = CreateWorkflow26(ModelInfoTask);
4901
+ Workflow27.prototype.modelInfo = CreateWorkflow27(ModelInfoTask);
4833
4902
 
4834
4903
  // src/task/ModelSearchTask.ts
4835
- import { CreateWorkflow as CreateWorkflow27, Task as Task12, Workflow as Workflow27 } from "@workglow/task-graph";
4904
+ import { CreateWorkflow as CreateWorkflow28, Task as Task13, Workflow as Workflow28 } from "@workglow/task-graph";
4836
4905
  var ModelSearchInputSchema = {
4837
4906
  type: "object",
4838
4907
  properties: {
@@ -4897,7 +4966,7 @@ var ModelSearchOutputSchema = {
4897
4966
  additionalProperties: false
4898
4967
  };
4899
4968
 
4900
- class ModelSearchTask extends Task12 {
4969
+ class ModelSearchTask extends Task13 {
4901
4970
  static type = "ModelSearchTask";
4902
4971
  static category = "AI Model";
4903
4972
  static title = "Model Search";
@@ -4923,10 +4992,10 @@ class ModelSearchTask extends Task12 {
4923
4992
  var modelSearch = (input, config) => {
4924
4993
  return new ModelSearchTask(config).run(input);
4925
4994
  };
4926
- Workflow27.prototype.modelSearch = CreateWorkflow27(ModelSearchTask);
4995
+ Workflow28.prototype.modelSearch = CreateWorkflow28(ModelSearchTask);
4927
4996
 
4928
4997
  // src/task/ObjectDetectionTask.ts
4929
- import { CreateWorkflow as CreateWorkflow28, Workflow as Workflow28 } from "@workglow/task-graph";
4998
+ import { CreateWorkflow as CreateWorkflow29, Workflow as Workflow29 } from "@workglow/task-graph";
4930
4999
  var modelSchema20 = TypeModel("model:ObjectDetectionTask");
4931
5000
  var detectionSchema = {
4932
5001
  type: "object",
@@ -5006,10 +5075,10 @@ class ObjectDetectionTask extends AiVisionTask {
5006
5075
  var objectDetection = (input, config) => {
5007
5076
  return new ObjectDetectionTask(config).run(input);
5008
5077
  };
5009
- Workflow28.prototype.objectDetection = CreateWorkflow28(ObjectDetectionTask);
5078
+ Workflow29.prototype.objectDetection = CreateWorkflow29(ObjectDetectionTask);
5010
5079
 
5011
5080
  // src/task/PoseLandmarkerTask.ts
5012
- import { CreateWorkflow as CreateWorkflow29, Workflow as Workflow29 } from "@workglow/task-graph";
5081
+ import { CreateWorkflow as CreateWorkflow30, Workflow as Workflow30 } from "@workglow/task-graph";
5013
5082
  var modelSchema21 = TypeModel("model:PoseLandmarkerTask");
5014
5083
  var TypePoseLandmark = {
5015
5084
  type: "object",
@@ -5168,17 +5237,17 @@ class PoseLandmarkerTask extends AiVisionTask {
5168
5237
  var poseLandmarker = (input, config) => {
5169
5238
  return new PoseLandmarkerTask(config).run(input);
5170
5239
  };
5171
- Workflow29.prototype.poseLandmarker = CreateWorkflow29(PoseLandmarkerTask);
5240
+ Workflow30.prototype.poseLandmarker = CreateWorkflow30(PoseLandmarkerTask);
5172
5241
 
5173
5242
  // src/task/QueryExpanderTask.ts
5174
- import { CreateWorkflow as CreateWorkflow30, Task as Task13, Workflow as Workflow30 } from "@workglow/task-graph";
5243
+ import { CreateWorkflow as CreateWorkflow31, Task as Task14, Workflow as Workflow31 } from "@workglow/task-graph";
5175
5244
  var QueryExpansionMethod = {
5176
5245
  MULTI_QUERY: "multi-query",
5177
5246
  HYDE: "hyde",
5178
5247
  SYNONYMS: "synonyms",
5179
5248
  PARAPHRASE: "paraphrase"
5180
5249
  };
5181
- var inputSchema10 = {
5250
+ var inputSchema11 = {
5182
5251
  type: "object",
5183
5252
  properties: {
5184
5253
  query: {
@@ -5210,7 +5279,7 @@ var inputSchema10 = {
5210
5279
  required: ["query"],
5211
5280
  additionalProperties: false
5212
5281
  };
5213
- var outputSchema10 = {
5282
+ var outputSchema11 = {
5214
5283
  type: "object",
5215
5284
  properties: {
5216
5285
  query: {
@@ -5239,17 +5308,17 @@ var outputSchema10 = {
5239
5308
  additionalProperties: false
5240
5309
  };
5241
5310
 
5242
- class QueryExpanderTask extends Task13 {
5311
+ class QueryExpanderTask extends Task14 {
5243
5312
  static type = "QueryExpanderTask";
5244
5313
  static category = "RAG";
5245
5314
  static title = "Query Expander";
5246
5315
  static description = "Expand queries to improve retrieval coverage";
5247
5316
  static cacheable = true;
5248
5317
  static inputSchema() {
5249
- return inputSchema10;
5318
+ return inputSchema11;
5250
5319
  }
5251
5320
  static outputSchema() {
5252
- return outputSchema10;
5321
+ return outputSchema11;
5253
5322
  }
5254
5323
  async execute(input, context) {
5255
5324
  const { query, method = QueryExpansionMethod.MULTI_QUERY, numVariations = 3 } = input;
@@ -5381,13 +5450,13 @@ class QueryExpanderTask extends Task13 {
5381
5450
  var queryExpander = (input, config) => {
5382
5451
  return new QueryExpanderTask(config).run(input);
5383
5452
  };
5384
- Workflow30.prototype.queryExpander = CreateWorkflow30(QueryExpanderTask);
5453
+ Workflow31.prototype.queryExpander = CreateWorkflow31(QueryExpanderTask);
5385
5454
 
5386
5455
  // src/task/RerankerTask.ts
5387
- import { CreateWorkflow as CreateWorkflow32, Task as Task14, Workflow as Workflow32 } from "@workglow/task-graph";
5456
+ import { CreateWorkflow as CreateWorkflow33, Task as Task15, Workflow as Workflow33 } from "@workglow/task-graph";
5388
5457
 
5389
5458
  // src/task/TextClassificationTask.ts
5390
- import { CreateWorkflow as CreateWorkflow31, Workflow as Workflow31 } from "@workglow/task-graph";
5459
+ import { CreateWorkflow as CreateWorkflow32, Workflow as Workflow32 } from "@workglow/task-graph";
5391
5460
  var modelSchema22 = TypeModel("model:TextClassificationTask");
5392
5461
  var TextClassificationInputSchema = {
5393
5462
  type: "object",
@@ -5465,10 +5534,10 @@ class TextClassificationTask extends AiTask {
5465
5534
  var textClassification = (input, config) => {
5466
5535
  return new TextClassificationTask(config).run(input);
5467
5536
  };
5468
- Workflow31.prototype.textClassification = CreateWorkflow31(TextClassificationTask);
5537
+ Workflow32.prototype.textClassification = CreateWorkflow32(TextClassificationTask);
5469
5538
 
5470
5539
  // src/task/RerankerTask.ts
5471
- var inputSchema11 = {
5540
+ var inputSchema12 = {
5472
5541
  type: "object",
5473
5542
  properties: {
5474
5543
  query: {
@@ -5519,7 +5588,7 @@ var inputSchema11 = {
5519
5588
  required: ["query", "chunks"],
5520
5589
  additionalProperties: false
5521
5590
  };
5522
- var outputSchema11 = {
5591
+ var outputSchema12 = {
5523
5592
  type: "object",
5524
5593
  properties: {
5525
5594
  chunks: {
@@ -5560,7 +5629,7 @@ var outputSchema11 = {
5560
5629
  additionalProperties: false
5561
5630
  };
5562
5631
 
5563
- class RerankerTask extends Task14 {
5632
+ class RerankerTask extends Task15 {
5564
5633
  static type = "RerankerTask";
5565
5634
  static category = "RAG";
5566
5635
  static title = "Reranker";
@@ -5568,10 +5637,10 @@ class RerankerTask extends Task14 {
5568
5637
  static cacheable = true;
5569
5638
  resolvedCrossEncoderModel;
5570
5639
  static inputSchema() {
5571
- return inputSchema11;
5640
+ return inputSchema12;
5572
5641
  }
5573
5642
  static outputSchema() {
5574
- return outputSchema11;
5643
+ return outputSchema12;
5575
5644
  }
5576
5645
  async execute(input, context) {
5577
5646
  const { query, chunks, scores = [], metadata = [], topK, method = "simple", model } = input;
@@ -5689,13 +5758,13 @@ class RerankerTask extends Task14 {
5689
5758
  var reranker = (input, config) => {
5690
5759
  return new RerankerTask(config).run(input);
5691
5760
  };
5692
- Workflow32.prototype.reranker = CreateWorkflow32(RerankerTask);
5761
+ Workflow33.prototype.reranker = CreateWorkflow33(RerankerTask);
5693
5762
 
5694
5763
  // src/task/StructuralParserTask.ts
5695
5764
  import { StructuralParser } from "@workglow/knowledge-base";
5696
- import { CreateWorkflow as CreateWorkflow33, Task as Task15, Workflow as Workflow33 } from "@workglow/task-graph";
5765
+ import { CreateWorkflow as CreateWorkflow34, Task as Task16, Workflow as Workflow34 } from "@workglow/task-graph";
5697
5766
  import { uuid4 as uuid42 } from "@workglow/util";
5698
- var inputSchema12 = {
5767
+ var inputSchema13 = {
5699
5768
  type: "object",
5700
5769
  properties: {
5701
5770
  text: {
@@ -5729,7 +5798,7 @@ var inputSchema12 = {
5729
5798
  required: ["text", "title"],
5730
5799
  additionalProperties: false
5731
5800
  };
5732
- var outputSchema12 = {
5801
+ var outputSchema13 = {
5733
5802
  type: "object",
5734
5803
  properties: {
5735
5804
  doc_id: {
@@ -5751,17 +5820,17 @@ var outputSchema12 = {
5751
5820
  additionalProperties: false
5752
5821
  };
5753
5822
 
5754
- class StructuralParserTask extends Task15 {
5823
+ class StructuralParserTask extends Task16 {
5755
5824
  static type = "StructuralParserTask";
5756
5825
  static category = "Document";
5757
5826
  static title = "Structural Parser";
5758
5827
  static description = "Parse documents into hierarchical tree structure";
5759
5828
  static cacheable = true;
5760
5829
  static inputSchema() {
5761
- return inputSchema12;
5830
+ return inputSchema13;
5762
5831
  }
5763
5832
  static outputSchema() {
5764
- return outputSchema12;
5833
+ return outputSchema13;
5765
5834
  }
5766
5835
  async execute(input, context) {
5767
5836
  const { text, title, format = "auto", sourceUri, doc_id: providedDocId } = input;
@@ -5794,10 +5863,10 @@ class StructuralParserTask extends Task15 {
5794
5863
  var structuralParser = (input, config) => {
5795
5864
  return new StructuralParserTask(config).run(input);
5796
5865
  };
5797
- Workflow33.prototype.structuralParser = CreateWorkflow33(StructuralParserTask);
5866
+ Workflow34.prototype.structuralParser = CreateWorkflow34(StructuralParserTask);
5798
5867
 
5799
5868
  // src/task/StructuredGenerationTask.ts
5800
- import { CreateWorkflow as CreateWorkflow34, Workflow as Workflow34 } from "@workglow/task-graph";
5869
+ import { CreateWorkflow as CreateWorkflow35, Workflow as Workflow35 } from "@workglow/task-graph";
5801
5870
  var modelSchema23 = TypeModel("model:StructuredGenerationTask");
5802
5871
  var StructuredGenerationInputSchema = {
5803
5872
  type: "object",
@@ -5865,17 +5934,17 @@ class StructuredGenerationTask extends StreamingAiTask {
5865
5934
  var structuredGeneration = (input, config) => {
5866
5935
  return new StructuredGenerationTask(config).run(input);
5867
5936
  };
5868
- Workflow34.prototype.structuredGeneration = CreateWorkflow34(StructuredGenerationTask);
5937
+ Workflow35.prototype.structuredGeneration = CreateWorkflow35(StructuredGenerationTask);
5869
5938
 
5870
5939
  // src/task/TextChunkerTask.ts
5871
- import { CreateWorkflow as CreateWorkflow35, Task as Task16, Workflow as Workflow35 } from "@workglow/task-graph";
5940
+ import { CreateWorkflow as CreateWorkflow36, Task as Task17, Workflow as Workflow36 } from "@workglow/task-graph";
5872
5941
  var ChunkingStrategy = {
5873
5942
  FIXED: "fixed",
5874
5943
  SENTENCE: "sentence",
5875
5944
  PARAGRAPH: "paragraph",
5876
5945
  SEMANTIC: "semantic"
5877
5946
  };
5878
- var inputSchema13 = {
5947
+ var inputSchema14 = {
5879
5948
  type: "object",
5880
5949
  properties: {
5881
5950
  text: {
@@ -5908,7 +5977,7 @@ var inputSchema13 = {
5908
5977
  required: ["text"],
5909
5978
  additionalProperties: false
5910
5979
  };
5911
- var outputSchema13 = {
5980
+ var outputSchema14 = {
5912
5981
  type: "object",
5913
5982
  properties: {
5914
5983
  chunks: {
@@ -5937,17 +6006,17 @@ var outputSchema13 = {
5937
6006
  additionalProperties: false
5938
6007
  };
5939
6008
 
5940
- class TextChunkerTask extends Task16 {
6009
+ class TextChunkerTask extends Task17 {
5941
6010
  static type = "TextChunkerTask";
5942
6011
  static category = "Document";
5943
6012
  static title = "Text Chunker";
5944
6013
  static description = "Splits text into chunks using various strategies (fixed, sentence, paragraph)";
5945
6014
  static cacheable = true;
5946
6015
  static inputSchema() {
5947
- return inputSchema13;
6016
+ return inputSchema14;
5948
6017
  }
5949
6018
  static outputSchema() {
5950
- return outputSchema13;
6019
+ return outputSchema14;
5951
6020
  }
5952
6021
  async execute(input, context) {
5953
6022
  const { text, chunkSize = 512, chunkOverlap = 50, strategy = ChunkingStrategy.FIXED } = input;
@@ -6117,10 +6186,10 @@ class TextChunkerTask extends Task16 {
6117
6186
  var textChunker = (input, config) => {
6118
6187
  return new TextChunkerTask(config).run(input);
6119
6188
  };
6120
- Workflow35.prototype.textChunker = CreateWorkflow35(TextChunkerTask);
6189
+ Workflow36.prototype.textChunker = CreateWorkflow36(TextChunkerTask);
6121
6190
 
6122
6191
  // src/task/TextFillMaskTask.ts
6123
- import { CreateWorkflow as CreateWorkflow36, Workflow as Workflow36 } from "@workglow/task-graph";
6192
+ import { CreateWorkflow as CreateWorkflow37, Workflow as Workflow37 } from "@workglow/task-graph";
6124
6193
  var modelSchema24 = TypeModel("model:TextFillMaskTask");
6125
6194
  var TextFillMaskInputSchema = {
6126
6195
  type: "object",
@@ -6185,10 +6254,10 @@ class TextFillMaskTask extends AiTask {
6185
6254
  var textFillMask = (input, config) => {
6186
6255
  return new TextFillMaskTask(config).run(input);
6187
6256
  };
6188
- Workflow36.prototype.textFillMask = CreateWorkflow36(TextFillMaskTask);
6257
+ Workflow37.prototype.textFillMask = CreateWorkflow37(TextFillMaskTask);
6189
6258
 
6190
6259
  // src/task/TextGenerationTask.ts
6191
- import { CreateWorkflow as CreateWorkflow37, Workflow as Workflow37 } from "@workglow/task-graph";
6260
+ import { CreateWorkflow as CreateWorkflow38, Workflow as Workflow38 } from "@workglow/task-graph";
6192
6261
  var generatedTextSchema2 = {
6193
6262
  type: "string",
6194
6263
  title: "Text",
@@ -6273,10 +6342,10 @@ class TextGenerationTask extends StreamingAiTask {
6273
6342
  var textGeneration = (input, config) => {
6274
6343
  return new TextGenerationTask(config).run(input);
6275
6344
  };
6276
- Workflow37.prototype.textGeneration = CreateWorkflow37(TextGenerationTask);
6345
+ Workflow38.prototype.textGeneration = CreateWorkflow38(TextGenerationTask);
6277
6346
 
6278
6347
  // src/task/TextLanguageDetectionTask.ts
6279
- import { CreateWorkflow as CreateWorkflow38, Workflow as Workflow38 } from "@workglow/task-graph";
6348
+ import { CreateWorkflow as CreateWorkflow39, Workflow as Workflow39 } from "@workglow/task-graph";
6280
6349
  var modelSchema26 = TypeModel("model:TextLanguageDetectionTask");
6281
6350
  var TextLanguageDetectionInputSchema = {
6282
6351
  type: "object",
@@ -6344,10 +6413,10 @@ class TextLanguageDetectionTask extends AiTask {
6344
6413
  var textLanguageDetection = (input, config) => {
6345
6414
  return new TextLanguageDetectionTask(config).run(input);
6346
6415
  };
6347
- Workflow38.prototype.textLanguageDetection = CreateWorkflow38(TextLanguageDetectionTask);
6416
+ Workflow39.prototype.textLanguageDetection = CreateWorkflow39(TextLanguageDetectionTask);
6348
6417
 
6349
6418
  // src/task/TextQuestionAnswerTask.ts
6350
- import { CreateWorkflow as CreateWorkflow39, Workflow as Workflow39 } from "@workglow/task-graph";
6419
+ import { CreateWorkflow as CreateWorkflow40, Workflow as Workflow40 } from "@workglow/task-graph";
6351
6420
  var contextSchema = {
6352
6421
  type: "string",
6353
6422
  title: "Context",
@@ -6399,10 +6468,10 @@ class TextQuestionAnswerTask extends StreamingAiTask {
6399
6468
  var textQuestionAnswer = (input, config) => {
6400
6469
  return new TextQuestionAnswerTask(config).run(input);
6401
6470
  };
6402
- Workflow39.prototype.textQuestionAnswer = CreateWorkflow39(TextQuestionAnswerTask);
6471
+ Workflow40.prototype.textQuestionAnswer = CreateWorkflow40(TextQuestionAnswerTask);
6403
6472
 
6404
6473
  // src/task/TextRewriterTask.ts
6405
- import { CreateWorkflow as CreateWorkflow40, Workflow as Workflow40 } from "@workglow/task-graph";
6474
+ import { CreateWorkflow as CreateWorkflow41, Workflow as Workflow41 } from "@workglow/task-graph";
6406
6475
  var modelSchema28 = TypeModel("model:TextRewriterTask");
6407
6476
  var TextRewriterInputSchema = {
6408
6477
  type: "object",
@@ -6451,10 +6520,10 @@ class TextRewriterTask extends StreamingAiTask {
6451
6520
  var textRewriter = (input, config) => {
6452
6521
  return new TextRewriterTask(config).run(input);
6453
6522
  };
6454
- Workflow40.prototype.textRewriter = CreateWorkflow40(TextRewriterTask);
6523
+ Workflow41.prototype.textRewriter = CreateWorkflow41(TextRewriterTask);
6455
6524
 
6456
6525
  // src/task/TextTranslationTask.ts
6457
- import { CreateWorkflow as CreateWorkflow41, Workflow as Workflow41 } from "@workglow/task-graph";
6526
+ import { CreateWorkflow as CreateWorkflow42, Workflow as Workflow42 } from "@workglow/task-graph";
6458
6527
  var modelSchema29 = TypeModel("model:TextTranslationTask");
6459
6528
  var translationTextSchema = {
6460
6529
  type: "string",
@@ -6517,16 +6586,16 @@ class TextTranslationTask extends StreamingAiTask {
6517
6586
  var textTranslation = (input, config) => {
6518
6587
  return new TextTranslationTask(config).run(input);
6519
6588
  };
6520
- Workflow41.prototype.textTranslation = CreateWorkflow41(TextTranslationTask);
6589
+ Workflow42.prototype.textTranslation = CreateWorkflow42(TextTranslationTask);
6521
6590
 
6522
6591
  // src/task/TopicSegmenterTask.ts
6523
- import { CreateWorkflow as CreateWorkflow42, Task as Task17, Workflow as Workflow42 } from "@workglow/task-graph";
6592
+ import { CreateWorkflow as CreateWorkflow43, Task as Task18, Workflow as Workflow43 } from "@workglow/task-graph";
6524
6593
  var SegmentationMethod = {
6525
6594
  HEURISTIC: "heuristic",
6526
6595
  EMBEDDING_SIMILARITY: "embedding-similarity",
6527
6596
  HYBRID: "hybrid"
6528
6597
  };
6529
- var inputSchema14 = {
6598
+ var inputSchema15 = {
6530
6599
  type: "object",
6531
6600
  properties: {
6532
6601
  text: {
@@ -6567,7 +6636,7 @@ var inputSchema14 = {
6567
6636
  required: ["text"],
6568
6637
  additionalProperties: false
6569
6638
  };
6570
- var outputSchema14 = {
6639
+ var outputSchema15 = {
6571
6640
  type: "object",
6572
6641
  properties: {
6573
6642
  segments: {
@@ -6595,7 +6664,7 @@ var outputSchema14 = {
6595
6664
  additionalProperties: false
6596
6665
  };
6597
6666
 
6598
- class TopicSegmenterTask extends Task17 {
6667
+ class TopicSegmenterTask extends Task18 {
6599
6668
  static type = "TopicSegmenterTask";
6600
6669
  static category = "Document";
6601
6670
  static title = "Topic Segmenter";
@@ -6603,10 +6672,10 @@ class TopicSegmenterTask extends Task17 {
6603
6672
  static cacheable = true;
6604
6673
  static EMBEDDING_DIMENSIONS = 256;
6605
6674
  static inputSchema() {
6606
- return inputSchema14;
6675
+ return inputSchema15;
6607
6676
  }
6608
6677
  static outputSchema() {
6609
- return outputSchema14;
6678
+ return outputSchema15;
6610
6679
  }
6611
6680
  async execute(input, context) {
6612
6681
  const {
@@ -6800,10 +6869,10 @@ class TopicSegmenterTask extends Task17 {
6800
6869
  var topicSegmenter = (input, config) => {
6801
6870
  return new TopicSegmenterTask(config).run(input);
6802
6871
  };
6803
- Workflow42.prototype.topicSegmenter = CreateWorkflow42(TopicSegmenterTask);
6872
+ Workflow43.prototype.topicSegmenter = CreateWorkflow43(TopicSegmenterTask);
6804
6873
 
6805
6874
  // src/task/UnloadModelTask.ts
6806
- import { CreateWorkflow as CreateWorkflow43, Workflow as Workflow43 } from "@workglow/task-graph";
6875
+ import { CreateWorkflow as CreateWorkflow44, Workflow as Workflow44 } from "@workglow/task-graph";
6807
6876
  var modelSchema30 = TypeModel("model");
6808
6877
  var UnloadModelInputSchema = {
6809
6878
  type: "object",
@@ -6838,16 +6907,16 @@ class UnloadModelTask extends AiTask {
6838
6907
  var unloadModel = (input, config) => {
6839
6908
  return new UnloadModelTask(config).run(input);
6840
6909
  };
6841
- Workflow43.prototype.unloadModel = CreateWorkflow43(UnloadModelTask);
6910
+ Workflow44.prototype.unloadModel = CreateWorkflow44(UnloadModelTask);
6842
6911
 
6843
6912
  // src/task/VectorQuantizeTask.ts
6844
- import { CreateWorkflow as CreateWorkflow44, Task as Task18, Workflow as Workflow44 } from "@workglow/task-graph";
6913
+ import { CreateWorkflow as CreateWorkflow45, Task as Task19, Workflow as Workflow45 } from "@workglow/task-graph";
6845
6914
  import {
6846
6915
  normalizeNumberArray,
6847
6916
  TensorType,
6848
6917
  TypedArraySchema as TypedArraySchema8
6849
6918
  } from "@workglow/util/schema";
6850
- var inputSchema15 = {
6919
+ var inputSchema16 = {
6851
6920
  type: "object",
6852
6921
  properties: {
6853
6922
  vector: {
@@ -6884,7 +6953,7 @@ var inputSchema15 = {
6884
6953
  required: ["vector", "targetType"],
6885
6954
  additionalProperties: false
6886
6955
  };
6887
- var outputSchema15 = {
6956
+ var outputSchema16 = {
6888
6957
  type: "object",
6889
6958
  properties: {
6890
6959
  vector: {
@@ -6921,17 +6990,17 @@ var outputSchema15 = {
6921
6990
  additionalProperties: false
6922
6991
  };
6923
6992
 
6924
- class VectorQuantizeTask extends Task18 {
6993
+ class VectorQuantizeTask extends Task19 {
6925
6994
  static type = "VectorQuantizeTask";
6926
6995
  static category = "Vector";
6927
6996
  static title = "Quantize";
6928
6997
  static description = "Quantize vectors to reduce storage and improve performance";
6929
6998
  static cacheable = true;
6930
6999
  static inputSchema() {
6931
- return inputSchema15;
7000
+ return inputSchema16;
6932
7001
  }
6933
7002
  static outputSchema() {
6934
- return outputSchema15;
7003
+ return outputSchema16;
6935
7004
  }
6936
7005
  async executeReactive(input) {
6937
7006
  const { vector, targetType, normalize = true } = input;
@@ -7021,10 +7090,10 @@ class VectorQuantizeTask extends Task18 {
7021
7090
  var vectorQuantize = (input, config) => {
7022
7091
  return new VectorQuantizeTask(config).run(input);
7023
7092
  };
7024
- Workflow44.prototype.vectorQuantize = CreateWorkflow44(VectorQuantizeTask);
7093
+ Workflow45.prototype.vectorQuantize = CreateWorkflow45(VectorQuantizeTask);
7025
7094
 
7026
7095
  // src/task/VectorSimilarityTask.ts
7027
- import { CreateWorkflow as CreateWorkflow45, GraphAsTask, Workflow as Workflow45 } from "@workglow/task-graph";
7096
+ import { CreateWorkflow as CreateWorkflow46, GraphAsTask, Workflow as Workflow46 } from "@workglow/task-graph";
7028
7097
  import {
7029
7098
  cosineSimilarity,
7030
7099
  hammingSimilarity,
@@ -7130,7 +7199,7 @@ class VectorSimilarityTask extends GraphAsTask {
7130
7199
  var similarity = (input, config) => {
7131
7200
  return new VectorSimilarityTask(config).run(input);
7132
7201
  };
7133
- Workflow45.prototype.similarity = CreateWorkflow45(VectorSimilarityTask);
7202
+ Workflow46.prototype.similarity = CreateWorkflow46(VectorSimilarityTask);
7134
7203
  // src/task/MessageConversion.ts
7135
7204
  function getInputMessages(input) {
7136
7205
  const messages = input.messages;
@@ -7337,6 +7406,7 @@ var registerAiTasks = () => {
7337
7406
  CountTokensTask,
7338
7407
  ContextBuilderTask,
7339
7408
  DocumentEnricherTask,
7409
+ DocumentUpsertTask,
7340
7410
  ChunkRetrievalTask,
7341
7411
  ChunkVectorHybridSearchTask,
7342
7412
  ChunkVectorSearchTask,
@@ -7438,6 +7508,7 @@ export {
7438
7508
  executeToolCalls,
7439
7509
  executeToolCall,
7440
7510
  downloadModel,
7511
+ documentUpsert,
7441
7512
  documentEnricher,
7442
7513
  countTokens,
7443
7514
  countAssistantToolUses,
@@ -7553,6 +7624,7 @@ export {
7553
7624
  FaceDetectorOutputSchema,
7554
7625
  FaceDetectorInputSchema,
7555
7626
  DownloadModelTask,
7627
+ DocumentUpsertTask,
7556
7628
  DocumentEnricherTask,
7557
7629
  DirectExecutionStrategy,
7558
7630
  CountTokensTask,
@@ -7578,4 +7650,4 @@ export {
7578
7650
  AgentInputSchema
7579
7651
  };
7580
7652
 
7581
- //# debugId=3B27AB4CF952BD5A64756E2164756E21
7653
+ //# debugId=A0AE35A82942CF9964756E2164756E21