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