@workglow/ai 0.0.70 → 0.0.72

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.
Files changed (35) hide show
  1. package/dist/browser.js +987 -284
  2. package/dist/browser.js.map +16 -7
  3. package/dist/bun.js +987 -284
  4. package/dist/bun.js.map +16 -7
  5. package/dist/node.js +987 -284
  6. package/dist/node.js.map +16 -7
  7. package/dist/task/BackgroundRemovalTask.d.ts +351 -0
  8. package/dist/task/BackgroundRemovalTask.d.ts.map +1 -0
  9. package/dist/task/ImageClassificationTask.d.ts +410 -0
  10. package/dist/task/ImageClassificationTask.d.ts.map +1 -0
  11. package/dist/task/ImageEmbeddingTask.d.ts +503 -0
  12. package/dist/task/ImageEmbeddingTask.d.ts.map +1 -0
  13. package/dist/task/ImageSegmentationTask.d.ts +423 -0
  14. package/dist/task/ImageSegmentationTask.d.ts.map +1 -0
  15. package/dist/task/ImageToTextTask.d.ts +355 -0
  16. package/dist/task/ImageToTextTask.d.ts.map +1 -0
  17. package/dist/task/ObjectDetectionTask.d.ts +476 -0
  18. package/dist/task/ObjectDetectionTask.d.ts.map +1 -0
  19. package/dist/task/{TextClassifierTask.d.ts → TextClassificationTask.d.ts} +27 -19
  20. package/dist/task/TextClassificationTask.d.ts.map +1 -0
  21. package/dist/task/TextFillMaskTask.d.ts +202 -0
  22. package/dist/task/TextFillMaskTask.d.ts.map +1 -0
  23. package/dist/task/TextLanguageDetectionTask.d.ts +4 -7
  24. package/dist/task/TextLanguageDetectionTask.d.ts.map +1 -1
  25. package/dist/task/TextNamedEntityRecognitionTask.d.ts +212 -0
  26. package/dist/task/TextNamedEntityRecognitionTask.d.ts.map +1 -0
  27. package/dist/task/base/AiTask.d.ts.map +1 -1
  28. package/dist/task/base/AiTaskSchemas.d.ts +153 -0
  29. package/dist/task/base/AiTaskSchemas.d.ts.map +1 -1
  30. package/dist/task/base/AiVisionTask.d.ts +33 -0
  31. package/dist/task/base/AiVisionTask.d.ts.map +1 -0
  32. package/dist/task/index.d.ts +9 -1
  33. package/dist/task/index.d.ts.map +1 -1
  34. package/package.json +9 -9
  35. package/dist/task/TextClassifierTask.d.ts.map +0 -1
package/dist/browser.js CHANGED
@@ -446,125 +446,9 @@ class DocumentConverterText extends DocumentConverter {
446
446
  return new Document(this.text, this.metadata);
447
447
  }
448
448
  }
449
- // src/task/base/AiTask.ts
450
- import {
451
- JobQueueTask,
452
- TaskConfigurationError
453
- } from "@workglow/task-graph";
454
- function schemaFormat(schema) {
455
- return typeof schema === "object" && schema !== null && "format" in schema ? schema.format : undefined;
456
- }
449
+ // src/task/BackgroundRemovalTask.ts
450
+ import { CreateWorkflow, TaskRegistry, Workflow } from "@workglow/task-graph";
457
451
 
458
- class AiTask extends JobQueueTask {
459
- static type = "AiTask";
460
- modelCache;
461
- constructor(input = {}, config = {}) {
462
- config.name ||= `${new.target.type || new.target.name}${input.model ? " with model " + input.model : ""}`;
463
- super(input, config);
464
- }
465
- async getJobInput(input) {
466
- if (typeof input.model !== "string") {
467
- console.error("AiTask: Model is not a string", input);
468
- throw new TaskConfigurationError("AiTask: Model is not a string, only create job for single model tasks");
469
- }
470
- const runtype = this.constructor.runtype ?? this.constructor.type;
471
- const model = await this.getModelForInput(input);
472
- return {
473
- taskType: runtype,
474
- aiProvider: model.provider,
475
- taskInput: input
476
- };
477
- }
478
- async createJob(input, queueName) {
479
- const jobInput = await this.getJobInput(input);
480
- const resolvedQueueName = queueName ?? await this.getDefaultQueueName(input);
481
- if (!resolvedQueueName) {
482
- throw new TaskConfigurationError("JobQueueTask: Unable to determine queue for AI provider");
483
- }
484
- const job = new AiJob({
485
- queueName: resolvedQueueName,
486
- jobRunId: this.config.runnerId,
487
- input: jobInput
488
- });
489
- return job;
490
- }
491
- async getModelForInput(input) {
492
- const modelname = input.model;
493
- if (!modelname)
494
- throw new TaskConfigurationError("AiTask: No model name found");
495
- if (this.modelCache && this.modelCache.name === modelname) {
496
- return this.modelCache.model;
497
- }
498
- const model = await getGlobalModelRepository().findByName(modelname);
499
- if (!model) {
500
- throw new TaskConfigurationError(`JobQueueTask: No model ${modelname} found`);
501
- }
502
- this.modelCache = { name: modelname, model };
503
- return model;
504
- }
505
- async getDefaultQueueName(input) {
506
- if (typeof input.model === "string") {
507
- const model = await this.getModelForInput(input);
508
- return model.provider;
509
- }
510
- return;
511
- }
512
- async validateInput(input) {
513
- const inputSchema = this.inputSchema();
514
- if (typeof inputSchema === "boolean") {
515
- if (inputSchema === false) {
516
- throw new TaskConfigurationError(`AiTask: Input schema is 'false' and accepts no inputs`);
517
- }
518
- return true;
519
- }
520
- const modelTaskProperties = Object.entries(inputSchema.properties || {}).filter(([key, schema]) => schemaFormat(schema)?.startsWith("model:"));
521
- if (modelTaskProperties.length > 0) {
522
- const taskModels = await getGlobalModelRepository().findModelsByTask(this.type);
523
- for (const [key, propSchema] of modelTaskProperties) {
524
- let requestedModels = Array.isArray(input[key]) ? input[key] : [input[key]];
525
- for (const model of requestedModels) {
526
- const foundModel = taskModels?.find((m) => m.model_id === model);
527
- if (!foundModel) {
528
- throw new TaskConfigurationError(`AiTask: Missing model for '${key}' named '${model}' for task '${this.type}'`);
529
- }
530
- }
531
- }
532
- }
533
- const modelPlainProperties = Object.entries(inputSchema.properties || {}).filter(([key, schema]) => schemaFormat(schema) === "model");
534
- if (modelPlainProperties.length > 0) {
535
- for (const [key, propSchema] of modelPlainProperties) {
536
- let requestedModels = Array.isArray(input[key]) ? input[key] : [input[key]];
537
- for (const model of requestedModels) {
538
- const foundModel = await getGlobalModelRepository().findByName(model);
539
- if (!foundModel) {
540
- throw new TaskConfigurationError(`AiTask: Missing model for "${key}" named "${model}"`);
541
- }
542
- }
543
- }
544
- }
545
- return super.validateInput(input);
546
- }
547
- async narrowInput(input) {
548
- const inputSchema = this.inputSchema();
549
- if (typeof inputSchema === "boolean") {
550
- if (inputSchema === false) {
551
- throw new TaskConfigurationError(`AiTask: Input schema is 'false' and accepts no inputs`);
552
- }
553
- return input;
554
- }
555
- const modelTaskProperties = Object.entries(inputSchema.properties || {}).filter(([key, schema]) => schemaFormat(schema)?.startsWith("model:"));
556
- if (modelTaskProperties.length > 0) {
557
- const taskModels = await getGlobalModelRepository().findModelsByTask(this.type);
558
- for (const [key, propSchema] of modelTaskProperties) {
559
- let requestedModels = Array.isArray(input[key]) ? input[key] : [input[key]];
560
- let usingModels = requestedModels.filter((model) => taskModels?.find((m) => m.model_id === model));
561
- usingModels = usingModels.length > 1 ? usingModels : usingModels[0];
562
- input[key] = usingModels;
563
- }
564
- }
565
- return input;
566
- }
567
- }
568
452
  // src/task/base/AiTaskSchemas.ts
569
453
  import {
570
454
  FromSchemaDefaultOptions
@@ -692,12 +576,316 @@ var TypeReplicateArray = (type, annotations = {}) => ({
692
576
  ...annotations,
693
577
  "x-replicate": true
694
578
  });
579
+ var TypeImageInput = {
580
+ oneOf: [
581
+ {
582
+ type: "string",
583
+ title: "Image Data",
584
+ description: "Image as data-uri"
585
+ },
586
+ {
587
+ type: "object",
588
+ additionalProperties: false,
589
+ properties: {
590
+ data: {
591
+ oneOf: [
592
+ {
593
+ type: "object",
594
+ format: "image:ImageBitmap",
595
+ title: "ImageBitmap"
596
+ },
597
+ {
598
+ type: "object",
599
+ format: "image:OffscreenCanvas",
600
+ title: "OffscreenCanvas"
601
+ },
602
+ {
603
+ type: "object",
604
+ format: "image:VideoFrame",
605
+ title: "VideoFrame"
606
+ },
607
+ {
608
+ type: "object",
609
+ properties: {
610
+ data: {
611
+ type: "array",
612
+ items: { type: "number", format: "Uint8Clamped" },
613
+ format: "Uint8ClampedArray",
614
+ title: "Data",
615
+ description: "Data of the image"
616
+ },
617
+ width: { type: "number", title: "Width", description: "Width of the image" },
618
+ height: { type: "number", title: "Height", description: "Height of the image" },
619
+ channels: {
620
+ type: "number",
621
+ title: "Channels",
622
+ description: "Channels of the image"
623
+ },
624
+ rawChannels: {
625
+ type: "number",
626
+ title: "Raw Channels",
627
+ description: "Raw channels of the image"
628
+ }
629
+ },
630
+ additionalProperties: false,
631
+ required: ["data", "width", "height", "channels"],
632
+ format: "image:ImageBinary",
633
+ title: "ImageBinary"
634
+ }
635
+ ]
636
+ },
637
+ width: { type: "number", title: "Width", description: "Width of the image" },
638
+ height: { type: "number", title: "Height", description: "Height of the image" },
639
+ channels: {
640
+ type: "number",
641
+ title: "Channels",
642
+ description: "Channels of the image",
643
+ minimum: 1,
644
+ maximum: 4
645
+ }
646
+ },
647
+ required: ["data", "width", "height", "channels"]
648
+ }
649
+ ],
650
+ title: "Image",
651
+ description: "Image as URL or base64-encoded data"
652
+ };
653
+ var TypeAudioInput = {
654
+ type: "string",
655
+ title: "Audio",
656
+ description: "Audio as data-uri, or Blob"
657
+ };
658
+ var TypeBoundingBox = {
659
+ type: "object",
660
+ properties: {
661
+ x: { type: "number", title: "X coordinate", description: "Left edge of the bounding box" },
662
+ y: { type: "number", title: "Y coordinate", description: "Top edge of the bounding box" },
663
+ width: { type: "number", title: "Width", description: "Width of the bounding box" },
664
+ height: { type: "number", title: "Height", description: "Height of the bounding box" }
665
+ },
666
+ required: ["x", "y", "width", "height"],
667
+ additionalProperties: false,
668
+ title: "Bounding Box",
669
+ description: "Bounding box coordinates"
670
+ };
671
+ var TypeCategory = {
672
+ type: "object",
673
+ properties: {
674
+ label: { type: "string", title: "Label", description: "Category label" },
675
+ score: {
676
+ type: "number",
677
+ title: "Confidence Score",
678
+ description: "Confidence score between 0 and 1",
679
+ minimum: 0,
680
+ maximum: 1
681
+ }
682
+ },
683
+ required: ["label", "score"],
684
+ additionalProperties: false,
685
+ title: "Category",
686
+ description: "Classification category with label and score"
687
+ };
688
+
689
+ // src/task/base/AiVisionTask.ts
690
+ import { convertImageDataToUseableForm } from "@workglow/util";
691
+
692
+ // src/task/base/AiTask.ts
693
+ import {
694
+ JobQueueTask,
695
+ TaskConfigurationError
696
+ } from "@workglow/task-graph";
697
+ function schemaFormat(schema) {
698
+ return typeof schema === "object" && schema !== null && "format" in schema ? schema.format : undefined;
699
+ }
700
+
701
+ class AiTask extends JobQueueTask {
702
+ static type = "AiTask";
703
+ modelCache;
704
+ constructor(input = {}, config = {}) {
705
+ config.name ||= `${new.target.type || new.target.name}${input.model ? " with model " + input.model : ""}`;
706
+ super(input, config);
707
+ }
708
+ async getJobInput(input) {
709
+ if (typeof input.model !== "string") {
710
+ console.error("AiTask: Model is not a string", input);
711
+ throw new TaskConfigurationError("AiTask: Model is not a string, only create job for single model tasks");
712
+ }
713
+ const runtype = this.constructor.runtype ?? this.constructor.type;
714
+ const model = await this.getModelForInput(input);
715
+ return {
716
+ taskType: runtype,
717
+ aiProvider: model.provider,
718
+ taskInput: input
719
+ };
720
+ }
721
+ async createJob(input, queueName) {
722
+ const jobInput = await this.getJobInput(input);
723
+ const resolvedQueueName = queueName ?? await this.getDefaultQueueName(input);
724
+ if (!resolvedQueueName) {
725
+ throw new TaskConfigurationError("JobQueueTask: Unable to determine queue for AI provider");
726
+ }
727
+ const job = new AiJob({
728
+ queueName: resolvedQueueName,
729
+ jobRunId: this.config.runnerId,
730
+ input: jobInput
731
+ });
732
+ return job;
733
+ }
734
+ async getModelForInput(input) {
735
+ const modelname = input.model;
736
+ if (!modelname)
737
+ throw new TaskConfigurationError("AiTask: No model name found");
738
+ if (this.modelCache && this.modelCache.name === modelname) {
739
+ return this.modelCache.model;
740
+ }
741
+ const model = await getGlobalModelRepository().findByName(modelname);
742
+ if (!model) {
743
+ throw new TaskConfigurationError(`JobQueueTask: No model ${modelname} found`);
744
+ }
745
+ this.modelCache = { name: modelname, model };
746
+ return model;
747
+ }
748
+ async getDefaultQueueName(input) {
749
+ if (typeof input.model === "string") {
750
+ const model = await this.getModelForInput(input);
751
+ return model.provider;
752
+ }
753
+ return;
754
+ }
755
+ async validateInput(input) {
756
+ const inputSchema = this.inputSchema();
757
+ if (typeof inputSchema === "boolean") {
758
+ if (inputSchema === false) {
759
+ throw new TaskConfigurationError(`AiTask: Input schema is 'false' and accepts no inputs`);
760
+ }
761
+ return true;
762
+ }
763
+ const modelTaskProperties = Object.entries(inputSchema.properties || {}).filter(([key, schema]) => schemaFormat(schema)?.startsWith("model:"));
764
+ if (modelTaskProperties.length > 0) {
765
+ const taskModels = await getGlobalModelRepository().findModelsByTask(this.type);
766
+ for (const [key, propSchema] of modelTaskProperties) {
767
+ let requestedModels = Array.isArray(input[key]) ? input[key] : [input[key]];
768
+ for (const model of requestedModels) {
769
+ const foundModel = taskModels?.find((m) => m.model_id === model);
770
+ if (!foundModel) {
771
+ throw new TaskConfigurationError(`AiTask: Missing model for '${key}' named '${model}' for task '${this.type}'`);
772
+ }
773
+ }
774
+ }
775
+ }
776
+ const modelPlainProperties = Object.entries(inputSchema.properties || {}).filter(([key, schema]) => schemaFormat(schema) === "model");
777
+ if (modelPlainProperties.length > 0) {
778
+ for (const [key, propSchema] of modelPlainProperties) {
779
+ let requestedModels = Array.isArray(input[key]) ? input[key] : [input[key]];
780
+ for (const model of requestedModels) {
781
+ const foundModel = await getGlobalModelRepository().findByName(model);
782
+ if (!foundModel) {
783
+ throw new TaskConfigurationError(`AiTask: Missing model for "${key}" named "${model}"`);
784
+ }
785
+ }
786
+ }
787
+ }
788
+ return super.validateInput(input);
789
+ }
790
+ async narrowInput(input) {
791
+ const inputSchema = this.inputSchema();
792
+ if (typeof inputSchema === "boolean") {
793
+ if (inputSchema === false) {
794
+ throw new TaskConfigurationError(`AiTask: Input schema is 'false' and accepts no inputs`);
795
+ }
796
+ return input;
797
+ }
798
+ const modelTaskProperties = Object.entries(inputSchema.properties || {}).filter(([key, schema]) => schemaFormat(schema)?.startsWith("model:"));
799
+ if (modelTaskProperties.length > 0) {
800
+ const taskModels = await getGlobalModelRepository().findModelsByTask(this.type);
801
+ for (const [key, propSchema] of modelTaskProperties) {
802
+ let requestedModels = Array.isArray(input[key]) ? input[key] : [input[key]];
803
+ let usingModels = requestedModels.filter((model) => taskModels?.find((m) => m.model_id === model));
804
+ usingModels = usingModels.length > 1 ? usingModels : usingModels[0];
805
+ input[key] = usingModels;
806
+ }
807
+ }
808
+ return input;
809
+ }
810
+ }
811
+
812
+ // src/task/base/AiVisionTask.ts
813
+ class AiVisionTask extends AiTask {
814
+ static type = "AiVisionTask";
815
+ async getJobInput(input) {
816
+ const jobInput = await super.getJobInput(input);
817
+ const registeredQueue = await this.resolveQueue(input);
818
+ const queueName = registeredQueue?.server.queueName;
819
+ const supports = ["Blob"];
820
+ if (input.image) {
821
+ if ("OffscreenCanvas" in globalThis) {
822
+ supports.push("OffscreenCanvas");
823
+ } else if (queueName === "TENSORFLOW_MEDIAPIPE" && "ImageBitmap" in globalThis) {
824
+ supports.push("ImageBitmap");
825
+ } else if (queueName === "TENSORFLOW_MEDIAPIPE" && "VideoFrame" in globalThis) {
826
+ supports.push("VideoFrame");
827
+ }
828
+ const image = await convertImageDataToUseableForm(input.image, supports);
829
+ jobInput.taskInput.image = image;
830
+ }
831
+ return jobInput;
832
+ }
833
+ }
834
+
835
+ // src/task/BackgroundRemovalTask.ts
836
+ var modelSchema = TypeReplicateArray(TypeModel("model:BackgroundRemovalTask"));
837
+ var processedImageSchema = {
838
+ type: "string",
839
+ contentEncoding: "base64",
840
+ contentMediaType: "image/png",
841
+ title: "Image",
842
+ description: "Base64-encoded PNG image with transparent background"
843
+ };
844
+ var BackgroundRemovalInputSchema = {
845
+ type: "object",
846
+ properties: {
847
+ image: TypeReplicateArray(TypeImageInput),
848
+ model: modelSchema
849
+ },
850
+ required: ["image", "model"],
851
+ additionalProperties: false
852
+ };
853
+ var BackgroundRemovalOutputSchema = {
854
+ type: "object",
855
+ properties: {
856
+ image: {
857
+ oneOf: [processedImageSchema, { type: "array", items: processedImageSchema }],
858
+ title: processedImageSchema.title,
859
+ description: processedImageSchema.description
860
+ }
861
+ },
862
+ required: ["image"],
863
+ additionalProperties: false
864
+ };
865
+
866
+ class BackgroundRemovalTask extends AiVisionTask {
867
+ static type = "BackgroundRemovalTask";
868
+ static category = "AI Vision Model";
869
+ static title = "Background Removal";
870
+ static description = "Removes backgrounds from images, producing images with transparent backgrounds";
871
+ static inputSchema() {
872
+ return BackgroundRemovalInputSchema;
873
+ }
874
+ static outputSchema() {
875
+ return BackgroundRemovalOutputSchema;
876
+ }
877
+ }
878
+ TaskRegistry.registerTask(BackgroundRemovalTask);
879
+ var BackgroundRemoval = (input, config) => {
880
+ return new BackgroundRemovalTask(input, config).run();
881
+ };
882
+ Workflow.prototype.BackgroundRemoval = CreateWorkflow(BackgroundRemovalTask);
695
883
  // src/task/DocumentSplitterTask.ts
696
884
  import {
697
- CreateWorkflow,
885
+ CreateWorkflow as CreateWorkflow2,
698
886
  Task,
699
- TaskRegistry,
700
- Workflow
887
+ TaskRegistry as TaskRegistry2,
888
+ Workflow as Workflow2
701
889
  } from "@workglow/task-graph";
702
890
  var inputSchema = {
703
891
  type: "object",
@@ -709,117 +897,452 @@ var inputSchema = {
709
897
  description: "The kind of document (txt or md)"
710
898
  }
711
899
  },
712
- required: ["parser"],
900
+ required: ["parser"],
901
+ additionalProperties: false
902
+ };
903
+ var outputSchema = {
904
+ type: "object",
905
+ properties: {
906
+ texts: {
907
+ type: "array",
908
+ items: { type: "string" },
909
+ title: "Text Chunks",
910
+ description: "The text chunks of the document"
911
+ }
912
+ },
913
+ required: ["texts"],
914
+ additionalProperties: false
915
+ };
916
+
917
+ class DocumentSplitterTask extends Task {
918
+ static type = "DocumentSplitterTask";
919
+ static category = "Document";
920
+ static title = "Document Splitter";
921
+ static description = "Splits documents into text chunks for processing";
922
+ static inputSchema() {
923
+ return inputSchema;
924
+ }
925
+ static outputSchema() {
926
+ return outputSchema;
927
+ }
928
+ flattenFragmentsToTexts(item) {
929
+ if (item instanceof Document) {
930
+ const texts = [];
931
+ item.fragments.forEach((fragment) => {
932
+ texts.push(...this.flattenFragmentsToTexts(fragment));
933
+ });
934
+ return texts;
935
+ } else {
936
+ return [item.content];
937
+ }
938
+ }
939
+ async executeReactive() {
940
+ return { texts: this.flattenFragmentsToTexts(this.runInputData.file) };
941
+ }
942
+ }
943
+ TaskRegistry2.registerTask(DocumentSplitterTask);
944
+ var DocumentSplitter = (input) => {
945
+ return new DocumentSplitterTask(input).run();
946
+ };
947
+ Workflow2.prototype.DocumentSplitter = CreateWorkflow2(DocumentSplitterTask);
948
+ // src/task/DownloadModelTask.ts
949
+ import { CreateWorkflow as CreateWorkflow3, TaskRegistry as TaskRegistry3, Workflow as Workflow3 } from "@workglow/task-graph";
950
+ var modelSchema2 = TypeReplicateArray(TypeModel("model"));
951
+ var DownloadModelInputSchema = {
952
+ type: "object",
953
+ properties: {
954
+ model: modelSchema2
955
+ },
956
+ required: ["model"],
957
+ additionalProperties: false
958
+ };
959
+ var DownloadModelOutputSchema = {
960
+ type: "object",
961
+ properties: {
962
+ model: modelSchema2
963
+ },
964
+ required: ["model"],
965
+ additionalProperties: false
966
+ };
967
+
968
+ class DownloadModelTask extends AiTask {
969
+ static type = "DownloadModelTask";
970
+ static category = "AI Text Model";
971
+ static title = "Download Model";
972
+ static description = "Downloads and caches AI models locally with progress tracking";
973
+ static inputSchema() {
974
+ return DownloadModelInputSchema;
975
+ }
976
+ static outputSchema() {
977
+ return DownloadModelOutputSchema;
978
+ }
979
+ static cacheable = false;
980
+ files = [];
981
+ constructor(input, config = {}) {
982
+ super(input, config);
983
+ this.on("progress", this.processProgress.bind(this));
984
+ this.on("start", () => {
985
+ this.files = [];
986
+ });
987
+ }
988
+ processProgress(progress, message = "", details) {
989
+ if (details?.file) {
990
+ const file = this.files.find((f) => f.file === details.file);
991
+ if (file) {
992
+ file.progress = details.progress;
993
+ } else {
994
+ this.files.push({ file: details.file, progress: details.progress });
995
+ }
996
+ this.progress = this.files.reduce((acc, f) => acc + f.progress, 0) / this.files.length;
997
+ } else {
998
+ this.progress = progress;
999
+ }
1000
+ }
1001
+ }
1002
+ TaskRegistry3.registerTask(DownloadModelTask);
1003
+ var DownloadModel = (input, config) => {
1004
+ return new DownloadModelTask(input, config).run();
1005
+ };
1006
+ Workflow3.prototype.DownloadModel = CreateWorkflow3(DownloadModelTask);
1007
+ // src/task/ImageClassificationTask.ts
1008
+ import { CreateWorkflow as CreateWorkflow4, TaskRegistry as TaskRegistry4, Workflow as Workflow4 } from "@workglow/task-graph";
1009
+ var modelSchema3 = TypeReplicateArray(TypeModel("model:ImageClassificationTask"));
1010
+ var ImageClassificationInputSchema = {
1011
+ type: "object",
1012
+ properties: {
1013
+ image: TypeReplicateArray(TypeImageInput),
1014
+ model: modelSchema3,
1015
+ categories: {
1016
+ type: "array",
1017
+ items: {
1018
+ type: "string"
1019
+ },
1020
+ title: "Categories",
1021
+ description: "List of candidate categories (optional, if provided uses zero-shot classification)",
1022
+ "x-ui-group": "Configuration"
1023
+ },
1024
+ maxCategories: {
1025
+ type: "number",
1026
+ minimum: 1,
1027
+ maximum: 1000,
1028
+ default: 5,
1029
+ title: "Max Categories",
1030
+ description: "The maximum number of categories to return",
1031
+ "x-ui-group": "Configuration"
1032
+ }
1033
+ },
1034
+ required: ["image", "model"],
1035
+ additionalProperties: false
1036
+ };
1037
+ var ImageClassificationOutputSchema = {
1038
+ type: "object",
1039
+ properties: {
1040
+ categories: {
1041
+ oneOf: [
1042
+ { type: "array", items: TypeCategory },
1043
+ { type: "array", items: { type: "array", items: TypeCategory } }
1044
+ ],
1045
+ title: "Categories",
1046
+ description: "The classification categories with their scores"
1047
+ }
1048
+ },
1049
+ required: ["categories"],
1050
+ additionalProperties: false
1051
+ };
1052
+
1053
+ class ImageClassificationTask extends AiVisionTask {
1054
+ static type = "ImageClassificationTask";
1055
+ static category = "AI Vision Model";
1056
+ static title = "Image Classification";
1057
+ static description = "Classifies images into categories using vision models. Supports zero-shot classification when categories are provided.";
1058
+ static inputSchema() {
1059
+ return ImageClassificationInputSchema;
1060
+ }
1061
+ static outputSchema() {
1062
+ return ImageClassificationOutputSchema;
1063
+ }
1064
+ }
1065
+ TaskRegistry4.registerTask(ImageClassificationTask);
1066
+ var ImageClassification = (input, config) => {
1067
+ return new ImageClassificationTask(input, config).run();
1068
+ };
1069
+ Workflow4.prototype.ImageClassification = CreateWorkflow4(ImageClassificationTask);
1070
+ // src/task/ImageEmbeddingTask.ts
1071
+ import { CreateWorkflow as CreateWorkflow5, TaskRegistry as TaskRegistry5, Workflow as Workflow5 } from "@workglow/task-graph";
1072
+ var modelSchema4 = TypeReplicateArray(TypeModel("model:ImageEmbeddingTask"));
1073
+ var embeddingSchema = TypedArraySchema({
1074
+ title: "Embedding",
1075
+ description: "The image embedding vector"
1076
+ });
1077
+ var ImageEmbeddingInputSchema = {
1078
+ type: "object",
1079
+ properties: {
1080
+ image: TypeReplicateArray(TypeImageInput),
1081
+ model: modelSchema4
1082
+ },
1083
+ required: ["image", "model"],
1084
+ additionalProperties: false
1085
+ };
1086
+ var ImageEmbeddingOutputSchema = {
1087
+ type: "object",
1088
+ properties: {
1089
+ vector: {
1090
+ oneOf: [embeddingSchema, { type: "array", items: embeddingSchema }],
1091
+ title: "Embedding",
1092
+ description: "The image embedding vector"
1093
+ }
1094
+ },
1095
+ required: ["vector"],
1096
+ additionalProperties: false
1097
+ };
1098
+
1099
+ class ImageEmbeddingTask extends AiVisionTask {
1100
+ static type = "ImageEmbeddingTask";
1101
+ static category = "AI Vision Model";
1102
+ static title = "Image Embedding";
1103
+ static description = "Generates embeddings from images using vision models";
1104
+ static inputSchema() {
1105
+ return ImageEmbeddingInputSchema;
1106
+ }
1107
+ static outputSchema() {
1108
+ return ImageEmbeddingOutputSchema;
1109
+ }
1110
+ }
1111
+ TaskRegistry5.registerTask(ImageEmbeddingTask);
1112
+ var ImageEmbedding = (input, config) => {
1113
+ return new ImageEmbeddingTask(input, config).run();
1114
+ };
1115
+ Workflow5.prototype.ImageEmbedding = CreateWorkflow5(ImageEmbeddingTask);
1116
+ // src/task/ImageSegmentationTask.ts
1117
+ import { CreateWorkflow as CreateWorkflow6, TaskRegistry as TaskRegistry6, Workflow as Workflow6 } from "@workglow/task-graph";
1118
+ var modelSchema5 = TypeReplicateArray(TypeModel("model:ImageSegmentationTask"));
1119
+ var ImageSegmentationInputSchema = {
1120
+ type: "object",
1121
+ properties: {
1122
+ image: TypeReplicateArray(TypeImageInput),
1123
+ model: modelSchema5,
1124
+ threshold: {
1125
+ type: "number",
1126
+ title: "Threshold",
1127
+ description: "The threshold for filtering masks by score",
1128
+ minimum: 0,
1129
+ maximum: 1,
1130
+ default: 0.5,
1131
+ "x-ui-group": "Configuration"
1132
+ },
1133
+ maskThreshold: {
1134
+ type: "number",
1135
+ title: "Mask Threshold",
1136
+ description: "Threshold to use when turning predicted masks into binary values",
1137
+ minimum: 0,
1138
+ maximum: 1,
1139
+ default: 0.5,
1140
+ "x-ui-group": "Configuration"
1141
+ }
1142
+ },
1143
+ required: ["image", "model"],
1144
+ additionalProperties: false
1145
+ };
1146
+ var segmentationMaskSchema = {
1147
+ type: "object",
1148
+ properties: {
1149
+ label: {
1150
+ type: "string",
1151
+ title: "Label",
1152
+ description: "The label of the segmented region"
1153
+ },
1154
+ score: {
1155
+ type: "number",
1156
+ title: "Score",
1157
+ description: "The confidence score for this segmentation",
1158
+ minimum: 0,
1159
+ maximum: 1
1160
+ },
1161
+ mask: {
1162
+ type: "object",
1163
+ format: "image",
1164
+ title: "Mask",
1165
+ description: "Mask image"
1166
+ }
1167
+ },
1168
+ required: ["label", "score", "mask"],
713
1169
  additionalProperties: false
714
1170
  };
715
- var outputSchema = {
1171
+ var ImageSegmentationOutputSchema = {
716
1172
  type: "object",
717
1173
  properties: {
718
- texts: {
719
- type: "array",
720
- items: { type: "string" },
721
- title: "Text Chunks",
722
- description: "The text chunks of the document"
1174
+ masks: {
1175
+ oneOf: [
1176
+ { type: "array", items: segmentationMaskSchema },
1177
+ { type: "array", items: { type: "array", items: segmentationMaskSchema } }
1178
+ ],
1179
+ title: "Segmentation Masks",
1180
+ description: "The segmented regions with their labels, scores, and masks"
723
1181
  }
724
1182
  },
725
- required: ["texts"],
1183
+ required: ["masks"],
726
1184
  additionalProperties: false
727
1185
  };
728
1186
 
729
- class DocumentSplitterTask extends Task {
730
- static type = "DocumentSplitterTask";
731
- static category = "Document";
732
- static title = "Document Splitter";
733
- static description = "Splits documents into text chunks for processing";
1187
+ class ImageSegmentationTask extends AiVisionTask {
1188
+ static type = "ImageSegmentationTask";
1189
+ static category = "AI Vision Model";
1190
+ static title = "Image Segmentation";
1191
+ static description = "Segments images into regions with labels using computer vision models";
734
1192
  static inputSchema() {
735
- return inputSchema;
1193
+ return ImageSegmentationInputSchema;
736
1194
  }
737
1195
  static outputSchema() {
738
- return outputSchema;
1196
+ return ImageSegmentationOutputSchema;
739
1197
  }
740
- flattenFragmentsToTexts(item) {
741
- if (item instanceof Document) {
742
- const texts = [];
743
- item.fragments.forEach((fragment) => {
744
- texts.push(...this.flattenFragmentsToTexts(fragment));
745
- });
746
- return texts;
747
- } else {
748
- return [item.content];
1198
+ }
1199
+ TaskRegistry6.registerTask(ImageSegmentationTask);
1200
+ var ImageSegmentation = (input, config) => {
1201
+ return new ImageSegmentationTask(input, config).run();
1202
+ };
1203
+ Workflow6.prototype.ImageSegmentation = CreateWorkflow6(ImageSegmentationTask);
1204
+ // src/task/ImageToTextTask.ts
1205
+ import { CreateWorkflow as CreateWorkflow7, TaskRegistry as TaskRegistry7, Workflow as Workflow7 } from "@workglow/task-graph";
1206
+ var modelSchema6 = TypeReplicateArray(TypeModel("model:ImageToTextTask"));
1207
+ var generatedTextSchema = {
1208
+ type: "string",
1209
+ title: "Text",
1210
+ description: "The generated text description"
1211
+ };
1212
+ var ImageToTextInputSchema = {
1213
+ type: "object",
1214
+ properties: {
1215
+ image: TypeReplicateArray(TypeImageInput),
1216
+ model: modelSchema6,
1217
+ maxTokens: {
1218
+ type: "number",
1219
+ title: "Max Tokens",
1220
+ description: "The maximum number of tokens to generate",
1221
+ minimum: 1,
1222
+ maximum: 4096,
1223
+ "x-ui-group": "Configuration"
1224
+ }
1225
+ },
1226
+ required: ["image", "model"],
1227
+ additionalProperties: false
1228
+ };
1229
+ var ImageToTextOutputSchema = {
1230
+ type: "object",
1231
+ properties: {
1232
+ text: {
1233
+ oneOf: [generatedTextSchema, { type: "array", items: generatedTextSchema }],
1234
+ title: generatedTextSchema.title,
1235
+ description: generatedTextSchema.description
749
1236
  }
1237
+ },
1238
+ required: ["text"],
1239
+ additionalProperties: false
1240
+ };
1241
+
1242
+ class ImageToTextTask extends AiVisionTask {
1243
+ static type = "ImageToTextTask";
1244
+ static category = "AI Vision Model";
1245
+ static title = "Image to Text";
1246
+ static description = "Generates text descriptions from images using vision-language models";
1247
+ static inputSchema() {
1248
+ return ImageToTextInputSchema;
750
1249
  }
751
- async executeReactive() {
752
- return { texts: this.flattenFragmentsToTexts(this.runInputData.file) };
1250
+ static outputSchema() {
1251
+ return ImageToTextOutputSchema;
753
1252
  }
754
1253
  }
755
- TaskRegistry.registerTask(DocumentSplitterTask);
756
- var DocumentSplitter = (input) => {
757
- return new DocumentSplitterTask(input).run();
1254
+ TaskRegistry7.registerTask(ImageToTextTask);
1255
+ var ImageToText = (input, config) => {
1256
+ return new ImageToTextTask(input, config).run();
758
1257
  };
759
- Workflow.prototype.DocumentSplitter = CreateWorkflow(DocumentSplitterTask);
760
- // src/task/DownloadModelTask.ts
761
- import { CreateWorkflow as CreateWorkflow2, TaskRegistry as TaskRegistry2, Workflow as Workflow2 } from "@workglow/task-graph";
762
- var modelSchema = TypeReplicateArray(TypeModel("model"));
763
- var DownloadModelInputSchema = {
1258
+ Workflow7.prototype.ImageToText = CreateWorkflow7(ImageToTextTask);
1259
+ // src/task/ObjectDetectionTask.ts
1260
+ import { CreateWorkflow as CreateWorkflow8, TaskRegistry as TaskRegistry8, Workflow as Workflow8 } from "@workglow/task-graph";
1261
+ var modelSchema7 = TypeReplicateArray(TypeModel("model:ObjectDetectionTask"));
1262
+ var detectionSchema = {
764
1263
  type: "object",
765
1264
  properties: {
766
- model: modelSchema
1265
+ label: {
1266
+ type: "string",
1267
+ title: "Label",
1268
+ description: "The label of the detected object"
1269
+ },
1270
+ score: {
1271
+ type: "number",
1272
+ title: "Confidence Score",
1273
+ description: "The confidence score for this detection",
1274
+ minimum: 0,
1275
+ maximum: 1
1276
+ },
1277
+ box: TypeBoundingBox
767
1278
  },
768
- required: ["model"],
1279
+ required: ["label", "score", "box"],
769
1280
  additionalProperties: false
770
1281
  };
771
- var DownloadModelOutputSchema = {
1282
+ var ObjectDetectionInputSchema = {
772
1283
  type: "object",
773
1284
  properties: {
774
- model: modelSchema
1285
+ image: TypeReplicateArray(TypeImageInput),
1286
+ model: modelSchema7,
1287
+ labels: {
1288
+ type: "array",
1289
+ items: {
1290
+ type: "string"
1291
+ },
1292
+ title: "Labels",
1293
+ description: "List of object labels to detect (optional, if provided uses zero-shot detection)",
1294
+ "x-ui-group": "Configuration"
1295
+ },
1296
+ threshold: {
1297
+ type: "number",
1298
+ title: "Threshold",
1299
+ description: "The threshold for filtering detections by score",
1300
+ minimum: 0,
1301
+ maximum: 1,
1302
+ default: 0.5,
1303
+ "x-ui-group": "Configuration"
1304
+ }
775
1305
  },
776
- required: ["model"],
1306
+ required: ["image", "model"],
1307
+ additionalProperties: false
1308
+ };
1309
+ var ObjectDetectionOutputSchema = {
1310
+ type: "object",
1311
+ properties: {
1312
+ detections: {
1313
+ oneOf: [
1314
+ { type: "array", items: detectionSchema },
1315
+ { type: "array", items: { type: "array", items: detectionSchema } }
1316
+ ],
1317
+ title: "Detections",
1318
+ description: "The detected objects with their labels, scores, and bounding boxes"
1319
+ }
1320
+ },
1321
+ required: ["detections"],
777
1322
  additionalProperties: false
778
1323
  };
779
1324
 
780
- class DownloadModelTask extends AiTask {
781
- static type = "DownloadModelTask";
782
- static category = "AI Text Model";
783
- static title = "Download Model";
784
- static description = "Downloads and caches AI models locally with progress tracking";
1325
+ class ObjectDetectionTask extends AiVisionTask {
1326
+ static type = "ObjectDetectionTask";
1327
+ static category = "AI Vision Model";
1328
+ static title = "Object Detection";
1329
+ static description = "Detects objects in images using vision models. Supports zero-shot detection when labels are provided.";
785
1330
  static inputSchema() {
786
- return DownloadModelInputSchema;
1331
+ return ObjectDetectionInputSchema;
787
1332
  }
788
1333
  static outputSchema() {
789
- return DownloadModelOutputSchema;
790
- }
791
- static cacheable = false;
792
- files = [];
793
- constructor(input, config = {}) {
794
- super(input, config);
795
- this.on("progress", this.processProgress.bind(this));
796
- this.on("start", () => {
797
- this.files = [];
798
- });
799
- }
800
- processProgress(progress, message = "", details) {
801
- if (details?.file) {
802
- const file = this.files.find((f) => f.file === details.file);
803
- if (file) {
804
- file.progress = details.progress;
805
- } else {
806
- this.files.push({ file: details.file, progress: details.progress });
807
- }
808
- this.progress = this.files.reduce((acc, f) => acc + f.progress, 0) / this.files.length;
809
- } else {
810
- this.progress = progress;
811
- }
1334
+ return ObjectDetectionOutputSchema;
812
1335
  }
813
1336
  }
814
- TaskRegistry2.registerTask(DownloadModelTask);
815
- var DownloadModel = (input, config) => {
816
- return new DownloadModelTask(input, config).run();
1337
+ TaskRegistry8.registerTask(ObjectDetectionTask);
1338
+ var ObjectDetection = (input, config) => {
1339
+ return new ObjectDetectionTask(input, config).run();
817
1340
  };
818
- Workflow2.prototype.DownloadModel = CreateWorkflow2(DownloadModelTask);
819
- // src/task/TextClassifierTask.ts
820
- import { CreateWorkflow as CreateWorkflow3, TaskRegistry as TaskRegistry3, Workflow as Workflow3 } from "@workglow/task-graph";
821
- var modelSchema2 = TypeReplicateArray(TypeModel("model:TextClassifierTask"));
822
- var TextClassifierInputSchema = {
1341
+ Workflow8.prototype.ObjectDetection = CreateWorkflow8(ObjectDetectionTask);
1342
+ // src/task/TextClassificationTask.ts
1343
+ import { CreateWorkflow as CreateWorkflow9, TaskRegistry as TaskRegistry9, Workflow as Workflow9 } from "@workglow/task-graph";
1344
+ var modelSchema8 = TypeReplicateArray(TypeModel("model:TextClassificationTask"));
1345
+ var TextClassificationInputSchema = {
823
1346
  type: "object",
824
1347
  properties: {
825
1348
  text: TypeReplicateArray({
@@ -827,26 +1350,30 @@ var TextClassifierInputSchema = {
827
1350
  title: "Text",
828
1351
  description: "The text to classify"
829
1352
  }),
1353
+ candidateLabels: {
1354
+ type: "array",
1355
+ items: {
1356
+ type: "string"
1357
+ },
1358
+ title: "Candidate Labels",
1359
+ description: "List of candidate labels (optional, if provided uses zero-shot classification)",
1360
+ "x-ui-group": "Configuration"
1361
+ },
830
1362
  maxCategories: {
831
- oneOf: [
832
- {
833
- type: "number",
834
- minimum: 1,
835
- maximum: 1000
836
- },
837
- {
838
- type: "null"
839
- }
840
- ],
1363
+ type: "number",
1364
+ minimum: 1,
1365
+ maximum: 1000,
1366
+ default: 5,
841
1367
  title: "Max Categories",
842
- description: "The maximum number of categories to return"
1368
+ description: "The maximum number of categories to return",
1369
+ "x-ui-group": "Configuration"
843
1370
  },
844
- model: modelSchema2
1371
+ model: modelSchema8
845
1372
  },
846
1373
  required: ["text", "model"],
847
1374
  additionalProperties: false
848
1375
  };
849
- var TextClassifierOutputSchema = {
1376
+ var TextClassificationOutputSchema = {
850
1377
  type: "object",
851
1378
  properties: {
852
1379
  categories: {
@@ -876,26 +1403,26 @@ var TextClassifierOutputSchema = {
876
1403
  additionalProperties: false
877
1404
  };
878
1405
 
879
- class TextClassifierTask extends AiTask {
880
- static type = "TextClassifierTask";
1406
+ class TextClassificationTask extends AiTask {
1407
+ static type = "TextClassificationTask";
881
1408
  static category = "AI Text Model";
882
1409
  static title = "Text Classifier";
883
- static description = "Classifies text into predefined categories using language models";
1410
+ static description = "Classifies text into categories using language models. Supports zero-shot classification when candidate labels are provided.";
884
1411
  static inputSchema() {
885
- return TextClassifierInputSchema;
1412
+ return TextClassificationInputSchema;
886
1413
  }
887
1414
  static outputSchema() {
888
- return TextClassifierOutputSchema;
1415
+ return TextClassificationOutputSchema;
889
1416
  }
890
1417
  }
891
- TaskRegistry3.registerTask(TextClassifierTask);
892
- var TextClassifier = (input, config) => {
893
- return new TextClassifierTask(input, config).run();
1418
+ TaskRegistry9.registerTask(TextClassificationTask);
1419
+ var TextClassification = (input, config) => {
1420
+ return new TextClassificationTask(input, config).run();
894
1421
  };
895
- Workflow3.prototype.TextClassifier = CreateWorkflow3(TextClassifierTask);
1422
+ Workflow9.prototype.TextClassification = CreateWorkflow9(TextClassificationTask);
896
1423
  // src/task/TextEmbeddingTask.ts
897
- import { CreateWorkflow as CreateWorkflow4, TaskRegistry as TaskRegistry4, Workflow as Workflow4 } from "@workglow/task-graph";
898
- var modelSchema3 = TypeReplicateArray(TypeModel("model:TextEmbeddingTask"));
1424
+ import { CreateWorkflow as CreateWorkflow10, TaskRegistry as TaskRegistry10, Workflow as Workflow10 } from "@workglow/task-graph";
1425
+ var modelSchema9 = TypeReplicateArray(TypeModel("model:TextEmbeddingTask"));
899
1426
  var TextEmbeddingInputSchema = {
900
1427
  type: "object",
901
1428
  properties: {
@@ -904,7 +1431,7 @@ var TextEmbeddingInputSchema = {
904
1431
  title: "Text",
905
1432
  description: "The text to embed"
906
1433
  }),
907
- model: modelSchema3
1434
+ model: modelSchema9
908
1435
  },
909
1436
  required: ["text", "model"],
910
1437
  additionalProperties: false
@@ -933,23 +1460,91 @@ class TextEmbeddingTask extends AiTask {
933
1460
  return TextEmbeddingOutputSchema;
934
1461
  }
935
1462
  }
936
- TaskRegistry4.registerTask(TextEmbeddingTask);
1463
+ TaskRegistry10.registerTask(TextEmbeddingTask);
937
1464
  var TextEmbedding = async (input, config) => {
938
1465
  return new TextEmbeddingTask(input, config).run();
939
1466
  };
940
- Workflow4.prototype.TextEmbedding = CreateWorkflow4(TextEmbeddingTask);
1467
+ Workflow10.prototype.TextEmbedding = CreateWorkflow10(TextEmbeddingTask);
1468
+ // src/task/TextFillMaskTask.ts
1469
+ import { CreateWorkflow as CreateWorkflow11, TaskRegistry as TaskRegistry11, Workflow as Workflow11 } from "@workglow/task-graph";
1470
+ var modelSchema10 = TypeReplicateArray(TypeModel("model:TextFillMaskTask"));
1471
+ var TextFillMaskInputSchema = {
1472
+ type: "object",
1473
+ properties: {
1474
+ text: TypeReplicateArray({
1475
+ type: "string",
1476
+ title: "Text",
1477
+ description: "The text with a mask token to fill"
1478
+ }),
1479
+ model: modelSchema10
1480
+ },
1481
+ required: ["text", "model"],
1482
+ additionalProperties: false
1483
+ };
1484
+ var TextFillMaskOutputSchema = {
1485
+ type: "object",
1486
+ properties: {
1487
+ predictions: {
1488
+ type: "array",
1489
+ items: {
1490
+ type: "object",
1491
+ properties: {
1492
+ entity: {
1493
+ type: "string",
1494
+ title: "Entity",
1495
+ description: "The token that was predicted to fill the mask"
1496
+ },
1497
+ score: {
1498
+ type: "number",
1499
+ title: "Score",
1500
+ description: "The confidence score for this prediction"
1501
+ },
1502
+ sequence: {
1503
+ type: "string",
1504
+ title: "Sequence",
1505
+ description: "The complete text with the mask filled"
1506
+ }
1507
+ },
1508
+ required: ["entity", "score", "sequence"],
1509
+ additionalProperties: false
1510
+ },
1511
+ title: "Predictions",
1512
+ description: "The predicted tokens to fill the mask with their scores and complete sequences"
1513
+ }
1514
+ },
1515
+ required: ["predictions"],
1516
+ additionalProperties: false
1517
+ };
1518
+
1519
+ class TextFillMaskTask extends AiTask {
1520
+ static type = "TextFillMaskTask";
1521
+ static category = "AI Text Model";
1522
+ static title = "Fill Mask";
1523
+ static description = "Fills masked tokens in text";
1524
+ static inputSchema() {
1525
+ return TextFillMaskInputSchema;
1526
+ }
1527
+ static outputSchema() {
1528
+ return TextFillMaskOutputSchema;
1529
+ }
1530
+ }
1531
+ TaskRegistry11.registerTask(TextFillMaskTask);
1532
+ var TextFillMask = (input, config) => {
1533
+ return new TextFillMaskTask(input, config).run();
1534
+ };
1535
+ Workflow11.prototype.TextFillMask = CreateWorkflow11(TextFillMaskTask);
941
1536
  // src/task/TextGenerationTask.ts
942
- import { CreateWorkflow as CreateWorkflow5, TaskRegistry as TaskRegistry5, Workflow as Workflow5 } from "@workglow/task-graph";
943
- var generatedTextSchema = {
1537
+ import { CreateWorkflow as CreateWorkflow12, TaskRegistry as TaskRegistry12, Workflow as Workflow12 } from "@workglow/task-graph";
1538
+ var generatedTextSchema2 = {
944
1539
  type: "string",
945
1540
  title: "Text",
946
1541
  description: "The generated text"
947
1542
  };
948
- var modelSchema4 = TypeReplicateArray(TypeModel("model:TextGenerationTask"));
1543
+ var modelSchema11 = TypeReplicateArray(TypeModel("model:TextGenerationTask"));
949
1544
  var TextGenerationInputSchema = {
950
1545
  type: "object",
951
1546
  properties: {
952
- model: modelSchema4,
1547
+ model: modelSchema11,
953
1548
  prompt: TypeReplicateArray({
954
1549
  type: "string",
955
1550
  title: "Prompt",
@@ -1003,9 +1598,9 @@ var TextGenerationOutputSchema = {
1003
1598
  type: "object",
1004
1599
  properties: {
1005
1600
  text: {
1006
- oneOf: [generatedTextSchema, { type: "array", items: generatedTextSchema }],
1007
- title: generatedTextSchema.title,
1008
- description: generatedTextSchema.description
1601
+ oneOf: [generatedTextSchema2, { type: "array", items: generatedTextSchema2 }],
1602
+ title: generatedTextSchema2.title,
1603
+ description: generatedTextSchema2.description
1009
1604
  }
1010
1605
  },
1011
1606
  required: ["text"],
@@ -1024,14 +1619,14 @@ class TextGenerationTask extends AiTask {
1024
1619
  return TextGenerationOutputSchema;
1025
1620
  }
1026
1621
  }
1027
- TaskRegistry5.registerTask(TextGenerationTask);
1622
+ TaskRegistry12.registerTask(TextGenerationTask);
1028
1623
  var TextGeneration = (input, config) => {
1029
1624
  return new TextGenerationTask(input, config).run();
1030
1625
  };
1031
- Workflow5.prototype.TextGeneration = CreateWorkflow5(TextGenerationTask);
1626
+ Workflow12.prototype.TextGeneration = CreateWorkflow12(TextGenerationTask);
1032
1627
  // src/task/TextLanguageDetectionTask.ts
1033
- import { CreateWorkflow as CreateWorkflow6, TaskRegistry as TaskRegistry6, Workflow as Workflow6 } from "@workglow/task-graph";
1034
- var modelSchema5 = TypeReplicateArray(TypeModel("model:TextLanguageDetectionTask"));
1628
+ import { CreateWorkflow as CreateWorkflow13, TaskRegistry as TaskRegistry13, Workflow as Workflow13 } from "@workglow/task-graph";
1629
+ var modelSchema12 = TypeReplicateArray(TypeModel("model:TextLanguageDetectionTask"));
1035
1630
  var TextLanguageDetectionInputSchema = {
1036
1631
  type: "object",
1037
1632
  properties: {
@@ -1041,20 +1636,14 @@ var TextLanguageDetectionInputSchema = {
1041
1636
  description: "The text to detect the language of"
1042
1637
  }),
1043
1638
  maxLanguages: {
1044
- oneOf: [
1045
- {
1046
- type: "number",
1047
- minimum: 1,
1048
- maximum: 1000
1049
- },
1050
- {
1051
- type: "null"
1052
- }
1053
- ],
1639
+ type: "number",
1640
+ minimum: 0,
1641
+ maximum: 100,
1642
+ default: 5,
1054
1643
  title: "Max Languages",
1055
1644
  description: "The maximum number of languages to return"
1056
1645
  },
1057
- model: modelSchema5
1646
+ model: modelSchema12
1058
1647
  },
1059
1648
  required: ["text", "model"],
1060
1649
  additionalProperties: false
@@ -1101,13 +1690,91 @@ class TextLanguageDetectionTask extends AiTask {
1101
1690
  return TextLanguageDetectionOutputSchema;
1102
1691
  }
1103
1692
  }
1104
- TaskRegistry6.registerTask(TextLanguageDetectionTask);
1693
+ TaskRegistry13.registerTask(TextLanguageDetectionTask);
1105
1694
  var TextLanguageDetection = (input, config) => {
1106
1695
  return new TextLanguageDetectionTask(input, config).run();
1107
1696
  };
1108
- Workflow6.prototype.TextLanguageDetection = CreateWorkflow6(TextLanguageDetectionTask);
1697
+ Workflow13.prototype.TextLanguageDetection = CreateWorkflow13(TextLanguageDetectionTask);
1698
+ // src/task/TextNamedEntityRecognitionTask.ts
1699
+ import { CreateWorkflow as CreateWorkflow14, TaskRegistry as TaskRegistry14, Workflow as Workflow14 } from "@workglow/task-graph";
1700
+ var modelSchema13 = TypeReplicateArray(TypeModel("model:NamedEntityRecognitionTask"));
1701
+ var TextNamedEntityRecognitionInputSchema = {
1702
+ type: "object",
1703
+ properties: {
1704
+ text: TypeReplicateArray({
1705
+ type: "string",
1706
+ title: "Text",
1707
+ description: "The text to extract named entities from"
1708
+ }),
1709
+ blockList: {
1710
+ type: "array",
1711
+ items: {
1712
+ type: "string"
1713
+ },
1714
+ title: "Block List",
1715
+ description: "The entity types to exclude from results",
1716
+ "x-ui-group": "Configuration",
1717
+ "x-ui-group-open": false
1718
+ },
1719
+ model: modelSchema13
1720
+ },
1721
+ required: ["text", "model"],
1722
+ additionalProperties: false
1723
+ };
1724
+ var TextNamedEntityRecognitionOutputSchema = {
1725
+ type: "object",
1726
+ properties: {
1727
+ entities: {
1728
+ type: "array",
1729
+ items: {
1730
+ type: "object",
1731
+ properties: {
1732
+ entity: {
1733
+ type: "string",
1734
+ title: "Entity",
1735
+ description: "The type of the named entity"
1736
+ },
1737
+ score: {
1738
+ type: "number",
1739
+ title: "Score",
1740
+ description: "The confidence score for this entity"
1741
+ },
1742
+ word: {
1743
+ type: "string",
1744
+ title: "Word",
1745
+ description: "The extracted text of the named entity"
1746
+ }
1747
+ },
1748
+ required: ["entity", "score", "word"],
1749
+ additionalProperties: false
1750
+ },
1751
+ title: "Entities",
1752
+ description: "The extracted named entities with their types, scores, and text"
1753
+ }
1754
+ },
1755
+ required: ["entities"],
1756
+ additionalProperties: false
1757
+ };
1758
+
1759
+ class TextNamedEntityRecognitionTask extends AiTask {
1760
+ static type = "TextNamedEntityRecognitionTask";
1761
+ static category = "AI Text Model";
1762
+ static title = "Named Entity Recognition";
1763
+ static description = "Extracts named entities from text";
1764
+ static inputSchema() {
1765
+ return TextNamedEntityRecognitionInputSchema;
1766
+ }
1767
+ static outputSchema() {
1768
+ return TextNamedEntityRecognitionOutputSchema;
1769
+ }
1770
+ }
1771
+ TaskRegistry14.registerTask(TextNamedEntityRecognitionTask);
1772
+ var TextNamedEntityRecognition = (input, config) => {
1773
+ return new TextNamedEntityRecognitionTask(input, config).run();
1774
+ };
1775
+ Workflow14.prototype.TextNamedEntityRecognition = CreateWorkflow14(TextNamedEntityRecognitionTask);
1109
1776
  // src/task/TextQuestionAnswerTask.ts
1110
- import { CreateWorkflow as CreateWorkflow7, TaskRegistry as TaskRegistry7, Workflow as Workflow7 } from "@workglow/task-graph";
1777
+ import { CreateWorkflow as CreateWorkflow15, TaskRegistry as TaskRegistry15, Workflow as Workflow15 } from "@workglow/task-graph";
1111
1778
  var contextSchema = {
1112
1779
  type: "string",
1113
1780
  title: "Context",
@@ -1123,13 +1790,13 @@ var textSchema = {
1123
1790
  title: "Text",
1124
1791
  description: "The generated text"
1125
1792
  };
1126
- var modelSchema6 = TypeReplicateArray(TypeModel("model:TextQuestionAnswerTask"));
1793
+ var modelSchema14 = TypeReplicateArray(TypeModel("model:TextQuestionAnswerTask"));
1127
1794
  var TextQuestionAnswerInputSchema = {
1128
1795
  type: "object",
1129
1796
  properties: {
1130
1797
  context: TypeReplicateArray(contextSchema),
1131
1798
  question: TypeReplicateArray(questionSchema),
1132
- model: modelSchema6
1799
+ model: modelSchema14
1133
1800
  },
1134
1801
  required: ["context", "question", "model"],
1135
1802
  additionalProperties: false
@@ -1159,14 +1826,14 @@ class TextQuestionAnswerTask extends AiTask {
1159
1826
  return TextQuestionAnswerOutputSchema;
1160
1827
  }
1161
1828
  }
1162
- TaskRegistry7.registerTask(TextQuestionAnswerTask);
1829
+ TaskRegistry15.registerTask(TextQuestionAnswerTask);
1163
1830
  var TextQuestionAnswer = (input, config) => {
1164
1831
  return new TextQuestionAnswerTask(input, config).run();
1165
1832
  };
1166
- Workflow7.prototype.TextQuestionAnswer = CreateWorkflow7(TextQuestionAnswerTask);
1833
+ Workflow15.prototype.TextQuestionAnswer = CreateWorkflow15(TextQuestionAnswerTask);
1167
1834
  // src/task/TextRewriterTask.ts
1168
- import { CreateWorkflow as CreateWorkflow8, TaskRegistry as TaskRegistry8, Workflow as Workflow8 } from "@workglow/task-graph";
1169
- var modelSchema7 = TypeReplicateArray(TypeModel("model:TextRewriterTask"));
1835
+ import { CreateWorkflow as CreateWorkflow16, TaskRegistry as TaskRegistry16, Workflow as Workflow16 } from "@workglow/task-graph";
1836
+ var modelSchema15 = TypeReplicateArray(TypeModel("model:TextRewriterTask"));
1170
1837
  var TextRewriterInputSchema = {
1171
1838
  type: "object",
1172
1839
  properties: {
@@ -1180,7 +1847,7 @@ var TextRewriterInputSchema = {
1180
1847
  title: "Prompt",
1181
1848
  description: "The prompt to direct the rewriting"
1182
1849
  }),
1183
- model: modelSchema7
1850
+ model: modelSchema15
1184
1851
  },
1185
1852
  required: ["text", "prompt", "model"],
1186
1853
  additionalProperties: false
@@ -1210,14 +1877,14 @@ class TextRewriterTask extends AiTask {
1210
1877
  return TextRewriterOutputSchema;
1211
1878
  }
1212
1879
  }
1213
- TaskRegistry8.registerTask(TextRewriterTask);
1880
+ TaskRegistry16.registerTask(TextRewriterTask);
1214
1881
  var TextRewriter = (input, config) => {
1215
1882
  return new TextRewriterTask(input, config).run();
1216
1883
  };
1217
- Workflow8.prototype.TextRewriter = CreateWorkflow8(TextRewriterTask);
1884
+ Workflow16.prototype.TextRewriter = CreateWorkflow16(TextRewriterTask);
1218
1885
  // src/task/TextSummaryTask.ts
1219
- import { CreateWorkflow as CreateWorkflow9, TaskRegistry as TaskRegistry9, Workflow as Workflow9 } from "@workglow/task-graph";
1220
- var modelSchema8 = TypeReplicateArray(TypeModel("model:TextSummaryTask"));
1886
+ import { CreateWorkflow as CreateWorkflow17, TaskRegistry as TaskRegistry17, Workflow as Workflow17 } from "@workglow/task-graph";
1887
+ var modelSchema16 = TypeReplicateArray(TypeModel("model:TextSummaryTask"));
1221
1888
  var TextSummaryInputSchema = {
1222
1889
  type: "object",
1223
1890
  properties: {
@@ -1226,7 +1893,7 @@ var TextSummaryInputSchema = {
1226
1893
  title: "Text",
1227
1894
  description: "The text to summarize"
1228
1895
  }),
1229
- model: modelSchema8
1896
+ model: modelSchema16
1230
1897
  },
1231
1898
  required: ["text", "model"],
1232
1899
  additionalProperties: false
@@ -1256,14 +1923,14 @@ class TextSummaryTask extends AiTask {
1256
1923
  return TextSummaryOutputSchema;
1257
1924
  }
1258
1925
  }
1259
- TaskRegistry9.registerTask(TextSummaryTask);
1926
+ TaskRegistry17.registerTask(TextSummaryTask);
1260
1927
  var TextSummary = async (input, config) => {
1261
1928
  return new TextSummaryTask(input, config).run();
1262
1929
  };
1263
- Workflow9.prototype.TextSummary = CreateWorkflow9(TextSummaryTask);
1930
+ Workflow17.prototype.TextSummary = CreateWorkflow17(TextSummaryTask);
1264
1931
  // src/task/TextTranslationTask.ts
1265
- import { CreateWorkflow as CreateWorkflow10, TaskRegistry as TaskRegistry10, Workflow as Workflow10 } from "@workglow/task-graph";
1266
- var modelSchema9 = TypeReplicateArray(TypeModel("model:TextTranslationTask"));
1932
+ import { CreateWorkflow as CreateWorkflow18, TaskRegistry as TaskRegistry18, Workflow as Workflow18 } from "@workglow/task-graph";
1933
+ var modelSchema17 = TypeReplicateArray(TypeModel("model:TextTranslationTask"));
1267
1934
  var translationTextSchema = {
1268
1935
  type: "string",
1269
1936
  title: "Text",
@@ -1289,7 +1956,7 @@ var TextTranslationInputSchema = {
1289
1956
  minLength: 2,
1290
1957
  maxLength: 2
1291
1958
  })),
1292
- model: modelSchema9
1959
+ model: modelSchema17
1293
1960
  },
1294
1961
  required: ["text", "source_lang", "target_lang", "model"],
1295
1962
  additionalProperties: false
@@ -1325,18 +1992,18 @@ class TextTranslationTask extends AiTask {
1325
1992
  return TextTranslationOutputSchema;
1326
1993
  }
1327
1994
  }
1328
- TaskRegistry10.registerTask(TextTranslationTask);
1995
+ TaskRegistry18.registerTask(TextTranslationTask);
1329
1996
  var TextTranslation = (input, config) => {
1330
1997
  return new TextTranslationTask(input, config).run();
1331
1998
  };
1332
- Workflow10.prototype.TextTranslation = CreateWorkflow10(TextTranslationTask);
1999
+ Workflow18.prototype.TextTranslation = CreateWorkflow18(TextTranslationTask);
1333
2000
  // src/task/UnloadModelTask.ts
1334
- import { CreateWorkflow as CreateWorkflow11, TaskRegistry as TaskRegistry11, Workflow as Workflow11 } from "@workglow/task-graph";
1335
- var modelSchema10 = TypeReplicateArray(TypeModel("model"));
2001
+ import { CreateWorkflow as CreateWorkflow19, TaskRegistry as TaskRegistry19, Workflow as Workflow19 } from "@workglow/task-graph";
2002
+ var modelSchema18 = TypeReplicateArray(TypeModel("model"));
1336
2003
  var UnloadModelInputSchema = {
1337
2004
  type: "object",
1338
2005
  properties: {
1339
- model: modelSchema10
2006
+ model: modelSchema18
1340
2007
  },
1341
2008
  required: ["model"],
1342
2009
  additionalProperties: false
@@ -1344,7 +2011,7 @@ var UnloadModelInputSchema = {
1344
2011
  var UnloadModelOutputSchema = {
1345
2012
  type: "object",
1346
2013
  properties: {
1347
- model: modelSchema10
2014
+ model: modelSchema18
1348
2015
  },
1349
2016
  required: ["model"],
1350
2017
  additionalProperties: false
@@ -1363,18 +2030,18 @@ class UnloadModelTask extends AiTask {
1363
2030
  }
1364
2031
  static cacheable = false;
1365
2032
  }
1366
- TaskRegistry11.registerTask(UnloadModelTask);
2033
+ TaskRegistry19.registerTask(UnloadModelTask);
1367
2034
  var UnloadModel = (input, config) => {
1368
2035
  return new UnloadModelTask(input, config).run();
1369
2036
  };
1370
- Workflow11.prototype.UnloadModel = CreateWorkflow11(UnloadModelTask);
2037
+ Workflow19.prototype.UnloadModel = CreateWorkflow19(UnloadModelTask);
1371
2038
  // src/task/VectorSimilarityTask.ts
1372
2039
  import {
1373
2040
  ArrayTask,
1374
- CreateWorkflow as CreateWorkflow12,
2041
+ CreateWorkflow as CreateWorkflow20,
1375
2042
  TaskError,
1376
- TaskRegistry as TaskRegistry12,
1377
- Workflow as Workflow12
2043
+ TaskRegistry as TaskRegistry20,
2044
+ Workflow as Workflow20
1378
2045
  } from "@workglow/task-graph";
1379
2046
  var SimilarityFn = {
1380
2047
  COSINE: "cosine",
@@ -1468,11 +2135,11 @@ class VectorSimilarityTask extends ArrayTask {
1468
2135
  };
1469
2136
  }
1470
2137
  }
1471
- TaskRegistry12.registerTask(VectorSimilarityTask);
2138
+ TaskRegistry20.registerTask(VectorSimilarityTask);
1472
2139
  var Similarity = (input, config) => {
1473
2140
  return new VectorSimilarityTask(input, config).run();
1474
2141
  };
1475
- Workflow12.prototype.Similarity = CreateWorkflow12(VectorSimilarityTask);
2142
+ Workflow20.prototype.Similarity = CreateWorkflow20(VectorSimilarityTask);
1476
2143
  function inner(arr1, arr2) {
1477
2144
  return 1 - arr1.reduce((acc, val, i) => acc + val * arr2[i], 0);
1478
2145
  }
@@ -1516,6 +2183,10 @@ export {
1516
2183
  TypeModelAsString,
1517
2184
  TypeModel,
1518
2185
  TypeLanguage,
2186
+ TypeImageInput,
2187
+ TypeCategory,
2188
+ TypeBoundingBox,
2189
+ TypeAudioInput,
1519
2190
  TextTranslationTask,
1520
2191
  TextTranslationOutputSchema,
1521
2192
  TextTranslationInputSchema,
@@ -1532,6 +2203,10 @@ export {
1532
2203
  TextQuestionAnswerOutputSchema,
1533
2204
  TextQuestionAnswerInputSchema,
1534
2205
  TextQuestionAnswer,
2206
+ TextNamedEntityRecognitionTask,
2207
+ TextNamedEntityRecognitionOutputSchema,
2208
+ TextNamedEntityRecognitionInputSchema,
2209
+ TextNamedEntityRecognition,
1535
2210
  TextLanguageDetectionTask,
1536
2211
  TextLanguageDetectionOutputSchema,
1537
2212
  TextLanguageDetectionInputSchema,
@@ -1541,23 +2216,47 @@ export {
1541
2216
  TextGenerationInputSchema,
1542
2217
  TextGeneration,
1543
2218
  TextFragment,
2219
+ TextFillMaskTask,
2220
+ TextFillMaskOutputSchema,
2221
+ TextFillMaskInputSchema,
2222
+ TextFillMask,
1544
2223
  TextEmbeddingTask,
1545
2224
  TextEmbeddingOutputSchema,
1546
2225
  TextEmbeddingInputSchema,
1547
2226
  TextEmbedding,
1548
- TextClassifierTask,
1549
- TextClassifierOutputSchema,
1550
- TextClassifierInputSchema,
1551
- TextClassifier,
2227
+ TextClassificationTask,
2228
+ TextClassificationOutputSchema,
2229
+ TextClassificationInputSchema,
2230
+ TextClassification,
1552
2231
  TableFragment,
1553
2232
  SimilarityFn,
1554
2233
  Similarity,
2234
+ ObjectDetectionTask,
2235
+ ObjectDetectionOutputSchema,
2236
+ ObjectDetectionInputSchema,
2237
+ ObjectDetection,
1555
2238
  ModelSchema,
1556
2239
  ModelRepository,
1557
2240
  ModelPrimaryKeyNames,
1558
2241
  MODEL_REPOSITORY,
1559
2242
  InMemoryModelRepository,
2243
+ ImageToTextTask,
2244
+ ImageToTextOutputSchema,
2245
+ ImageToTextInputSchema,
2246
+ ImageToText,
2247
+ ImageSegmentationTask,
2248
+ ImageSegmentationOutputSchema,
2249
+ ImageSegmentationInputSchema,
2250
+ ImageSegmentation,
1560
2251
  ImageFragment,
2252
+ ImageEmbeddingTask,
2253
+ ImageEmbeddingOutputSchema,
2254
+ ImageEmbeddingInputSchema,
2255
+ ImageEmbedding,
2256
+ ImageClassificationTask,
2257
+ ImageClassificationOutputSchema,
2258
+ ImageClassificationInputSchema,
2259
+ ImageClassification,
1561
2260
  DownloadModelTask,
1562
2261
  DownloadModel,
1563
2262
  DocumentSplitterTask,
@@ -1567,9 +2266,13 @@ export {
1567
2266
  DocumentConverterMarkdown,
1568
2267
  DocumentBaseFragment,
1569
2268
  Document,
2269
+ BackgroundRemovalTask,
2270
+ BackgroundRemovalOutputSchema,
2271
+ BackgroundRemovalInputSchema,
2272
+ BackgroundRemoval,
1570
2273
  AiTask,
1571
2274
  AiProviderRegistry,
1572
2275
  AiJob
1573
2276
  };
1574
2277
 
1575
- //# debugId=7179DF21BC09BC6364756E2164756E21
2278
+ //# debugId=7B9E2A3103106B9D64756E2164756E21