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