@workglow/ai 0.0.66 → 0.0.67

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/browser.js CHANGED
@@ -816,9 +816,86 @@ var DownloadModel = (input, config) => {
816
816
  return new DownloadModelTask(input, config).run();
817
817
  };
818
818
  Workflow2.prototype.DownloadModel = CreateWorkflow2(DownloadModelTask);
819
- // src/task/TextEmbeddingTask.ts
819
+ // src/task/TextClassifierTask.ts
820
820
  import { CreateWorkflow as CreateWorkflow3, TaskRegistry as TaskRegistry3, Workflow as Workflow3 } from "@workglow/task-graph";
821
- var modelSchema2 = TypeReplicateArray(TypeModel("model:TextEmbeddingTask"));
821
+ var modelSchema2 = TypeReplicateArray(TypeModel("model:TextClassifierTask"));
822
+ var TextClassifierInputSchema = {
823
+ type: "object",
824
+ properties: {
825
+ text: TypeReplicateArray({
826
+ type: "string",
827
+ title: "Text",
828
+ description: "The text to classify"
829
+ }),
830
+ maxCategories: {
831
+ oneOf: [
832
+ {
833
+ type: "number",
834
+ minimum: 1,
835
+ maximum: 1000
836
+ },
837
+ {
838
+ type: "null"
839
+ }
840
+ ],
841
+ title: "Max Categories",
842
+ description: "The maximum number of categories to return"
843
+ },
844
+ model: modelSchema2
845
+ },
846
+ required: ["text", "model"],
847
+ additionalProperties: false
848
+ };
849
+ var TextClassifierOutputSchema = {
850
+ type: "object",
851
+ properties: {
852
+ categories: {
853
+ type: "array",
854
+ items: {
855
+ type: "object",
856
+ properties: {
857
+ label: {
858
+ type: "string",
859
+ title: "Label",
860
+ description: "The name of the category"
861
+ },
862
+ score: {
863
+ type: "number",
864
+ title: "Score",
865
+ description: "The confidence score for this category"
866
+ }
867
+ },
868
+ required: ["label", "score"],
869
+ additionalProperties: false
870
+ },
871
+ title: "Categories",
872
+ description: "The classification categories with their scores"
873
+ }
874
+ },
875
+ required: ["categories"],
876
+ additionalProperties: false
877
+ };
878
+
879
+ class TextClassifierTask extends AiTask {
880
+ static type = "TextClassifierTask";
881
+ static category = "AI Text Model";
882
+ static title = "Text Classifier";
883
+ static description = "Classifies text into predefined categories using language models";
884
+ static inputSchema() {
885
+ return TextClassifierInputSchema;
886
+ }
887
+ static outputSchema() {
888
+ return TextClassifierOutputSchema;
889
+ }
890
+ }
891
+ TaskRegistry3.registerTask(TextClassifierTask);
892
+ var TextClassifier = (input, config) => {
893
+ return new TextClassifierTask(input, config).run();
894
+ };
895
+ Workflow3.prototype.TextClassifier = CreateWorkflow3(TextClassifierTask);
896
+ // 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"));
822
899
  var TextEmbeddingInputSchema = {
823
900
  type: "object",
824
901
  properties: {
@@ -827,7 +904,7 @@ var TextEmbeddingInputSchema = {
827
904
  title: "Text",
828
905
  description: "The text to embed"
829
906
  }),
830
- model: modelSchema2
907
+ model: modelSchema3
831
908
  },
832
909
  required: ["text", "model"],
833
910
  additionalProperties: false
@@ -856,23 +933,23 @@ class TextEmbeddingTask extends AiTask {
856
933
  return TextEmbeddingOutputSchema;
857
934
  }
858
935
  }
859
- TaskRegistry3.registerTask(TextEmbeddingTask);
936
+ TaskRegistry4.registerTask(TextEmbeddingTask);
860
937
  var TextEmbedding = async (input, config) => {
861
938
  return new TextEmbeddingTask(input, config).run();
862
939
  };
863
- Workflow3.prototype.TextEmbedding = CreateWorkflow3(TextEmbeddingTask);
940
+ Workflow4.prototype.TextEmbedding = CreateWorkflow4(TextEmbeddingTask);
864
941
  // src/task/TextGenerationTask.ts
865
- import { CreateWorkflow as CreateWorkflow4, TaskRegistry as TaskRegistry4, Workflow as Workflow4 } from "@workglow/task-graph";
942
+ import { CreateWorkflow as CreateWorkflow5, TaskRegistry as TaskRegistry5, Workflow as Workflow5 } from "@workglow/task-graph";
866
943
  var generatedTextSchema = {
867
944
  type: "string",
868
945
  title: "Text",
869
946
  description: "The generated text"
870
947
  };
871
- var modelSchema3 = TypeReplicateArray(TypeModel("model:TextGenerationTask"));
948
+ var modelSchema4 = TypeReplicateArray(TypeModel("model:TextGenerationTask"));
872
949
  var TextGenerationInputSchema = {
873
950
  type: "object",
874
951
  properties: {
875
- model: modelSchema3,
952
+ model: modelSchema4,
876
953
  prompt: TypeReplicateArray({
877
954
  type: "string",
878
955
  title: "Prompt",
@@ -947,13 +1024,90 @@ class TextGenerationTask extends AiTask {
947
1024
  return TextGenerationOutputSchema;
948
1025
  }
949
1026
  }
950
- TaskRegistry4.registerTask(TextGenerationTask);
1027
+ TaskRegistry5.registerTask(TextGenerationTask);
951
1028
  var TextGeneration = (input, config) => {
952
1029
  return new TextGenerationTask(input, config).run();
953
1030
  };
954
- Workflow4.prototype.TextGeneration = CreateWorkflow4(TextGenerationTask);
1031
+ Workflow5.prototype.TextGeneration = CreateWorkflow5(TextGenerationTask);
1032
+ // 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"));
1035
+ var TextLanguageDetectionInputSchema = {
1036
+ type: "object",
1037
+ properties: {
1038
+ text: TypeReplicateArray({
1039
+ type: "string",
1040
+ title: "Text",
1041
+ description: "The text to detect the language of"
1042
+ }),
1043
+ maxLanguages: {
1044
+ oneOf: [
1045
+ {
1046
+ type: "number",
1047
+ minimum: 1,
1048
+ maximum: 1000
1049
+ },
1050
+ {
1051
+ type: "null"
1052
+ }
1053
+ ],
1054
+ title: "Max Languages",
1055
+ description: "The maximum number of languages to return"
1056
+ },
1057
+ model: modelSchema5
1058
+ },
1059
+ required: ["text", "model"],
1060
+ additionalProperties: false
1061
+ };
1062
+ var TextLanguageDetectionOutputSchema = {
1063
+ type: "object",
1064
+ properties: {
1065
+ languages: {
1066
+ type: "array",
1067
+ items: {
1068
+ type: "object",
1069
+ properties: {
1070
+ language: {
1071
+ type: "string",
1072
+ title: "Language",
1073
+ description: "The language"
1074
+ },
1075
+ score: {
1076
+ type: "number",
1077
+ title: "Score",
1078
+ description: "The confidence score for this language"
1079
+ }
1080
+ },
1081
+ required: ["language", "score"],
1082
+ additionalProperties: false
1083
+ },
1084
+ title: "Languages",
1085
+ description: "The languages with their scores"
1086
+ }
1087
+ },
1088
+ required: ["languages"],
1089
+ additionalProperties: false
1090
+ };
1091
+
1092
+ class TextLanguageDetectionTask extends AiTask {
1093
+ static type = "TextLanguageDetectionTask";
1094
+ static category = "AI Text Model";
1095
+ static title = "Language Detection";
1096
+ static description = "Detects the language of text using language models";
1097
+ static inputSchema() {
1098
+ return TextLanguageDetectionInputSchema;
1099
+ }
1100
+ static outputSchema() {
1101
+ return TextLanguageDetectionOutputSchema;
1102
+ }
1103
+ }
1104
+ TaskRegistry6.registerTask(TextLanguageDetectionTask);
1105
+ var TextLanguageDetection = (input, config) => {
1106
+ return new TextLanguageDetectionTask(input, config).run();
1107
+ };
1108
+ Workflow6.prototype.TextLanguageDetection = CreateWorkflow6(TextLanguageDetectionTask);
955
1109
  // src/task/TextQuestionAnswerTask.ts
956
- import { CreateWorkflow as CreateWorkflow5, TaskRegistry as TaskRegistry5, Workflow as Workflow5 } from "@workglow/task-graph";
1110
+ import { CreateWorkflow as CreateWorkflow7, TaskRegistry as TaskRegistry7, Workflow as Workflow7 } from "@workglow/task-graph";
957
1111
  var contextSchema = {
958
1112
  type: "string",
959
1113
  title: "Context",
@@ -969,13 +1123,13 @@ var textSchema = {
969
1123
  title: "Text",
970
1124
  description: "The generated text"
971
1125
  };
972
- var modelSchema4 = TypeReplicateArray(TypeModel("model:TextQuestionAnswerTask"));
1126
+ var modelSchema6 = TypeReplicateArray(TypeModel("model:TextQuestionAnswerTask"));
973
1127
  var TextQuestionAnswerInputSchema = {
974
1128
  type: "object",
975
1129
  properties: {
976
1130
  context: TypeReplicateArray(contextSchema),
977
1131
  question: TypeReplicateArray(questionSchema),
978
- model: modelSchema4
1132
+ model: modelSchema6
979
1133
  },
980
1134
  required: ["context", "question", "model"],
981
1135
  additionalProperties: false
@@ -1005,14 +1159,14 @@ class TextQuestionAnswerTask extends AiTask {
1005
1159
  return TextQuestionAnswerOutputSchema;
1006
1160
  }
1007
1161
  }
1008
- TaskRegistry5.registerTask(TextQuestionAnswerTask);
1162
+ TaskRegistry7.registerTask(TextQuestionAnswerTask);
1009
1163
  var TextQuestionAnswer = (input, config) => {
1010
1164
  return new TextQuestionAnswerTask(input, config).run();
1011
1165
  };
1012
- Workflow5.prototype.TextQuestionAnswer = CreateWorkflow5(TextQuestionAnswerTask);
1166
+ Workflow7.prototype.TextQuestionAnswer = CreateWorkflow7(TextQuestionAnswerTask);
1013
1167
  // src/task/TextRewriterTask.ts
1014
- import { CreateWorkflow as CreateWorkflow6, TaskRegistry as TaskRegistry6, Workflow as Workflow6 } from "@workglow/task-graph";
1015
- var modelSchema5 = TypeReplicateArray(TypeModel("model:TextRewriterTask"));
1168
+ import { CreateWorkflow as CreateWorkflow8, TaskRegistry as TaskRegistry8, Workflow as Workflow8 } from "@workglow/task-graph";
1169
+ var modelSchema7 = TypeReplicateArray(TypeModel("model:TextRewriterTask"));
1016
1170
  var TextRewriterInputSchema = {
1017
1171
  type: "object",
1018
1172
  properties: {
@@ -1026,7 +1180,7 @@ var TextRewriterInputSchema = {
1026
1180
  title: "Prompt",
1027
1181
  description: "The prompt to direct the rewriting"
1028
1182
  }),
1029
- model: modelSchema5
1183
+ model: modelSchema7
1030
1184
  },
1031
1185
  required: ["text", "prompt", "model"],
1032
1186
  additionalProperties: false
@@ -1056,14 +1210,14 @@ class TextRewriterTask extends AiTask {
1056
1210
  return TextRewriterOutputSchema;
1057
1211
  }
1058
1212
  }
1059
- TaskRegistry6.registerTask(TextRewriterTask);
1213
+ TaskRegistry8.registerTask(TextRewriterTask);
1060
1214
  var TextRewriter = (input, config) => {
1061
1215
  return new TextRewriterTask(input, config).run();
1062
1216
  };
1063
- Workflow6.prototype.TextRewriter = CreateWorkflow6(TextRewriterTask);
1217
+ Workflow8.prototype.TextRewriter = CreateWorkflow8(TextRewriterTask);
1064
1218
  // src/task/TextSummaryTask.ts
1065
- import { CreateWorkflow as CreateWorkflow7, TaskRegistry as TaskRegistry7, Workflow as Workflow7 } from "@workglow/task-graph";
1066
- var modelSchema6 = TypeReplicateArray(TypeModel("model:TextSummaryTask"));
1219
+ import { CreateWorkflow as CreateWorkflow9, TaskRegistry as TaskRegistry9, Workflow as Workflow9 } from "@workglow/task-graph";
1220
+ var modelSchema8 = TypeReplicateArray(TypeModel("model:TextSummaryTask"));
1067
1221
  var TextSummaryInputSchema = {
1068
1222
  type: "object",
1069
1223
  properties: {
@@ -1072,7 +1226,7 @@ var TextSummaryInputSchema = {
1072
1226
  title: "Text",
1073
1227
  description: "The text to summarize"
1074
1228
  }),
1075
- model: modelSchema6
1229
+ model: modelSchema8
1076
1230
  },
1077
1231
  required: ["text", "model"],
1078
1232
  additionalProperties: false
@@ -1102,14 +1256,14 @@ class TextSummaryTask extends AiTask {
1102
1256
  return TextSummaryOutputSchema;
1103
1257
  }
1104
1258
  }
1105
- TaskRegistry7.registerTask(TextSummaryTask);
1259
+ TaskRegistry9.registerTask(TextSummaryTask);
1106
1260
  var TextSummary = async (input, config) => {
1107
1261
  return new TextSummaryTask(input, config).run();
1108
1262
  };
1109
- Workflow7.prototype.TextSummary = CreateWorkflow7(TextSummaryTask);
1263
+ Workflow9.prototype.TextSummary = CreateWorkflow9(TextSummaryTask);
1110
1264
  // src/task/TextTranslationTask.ts
1111
- import { CreateWorkflow as CreateWorkflow8, TaskRegistry as TaskRegistry8, Workflow as Workflow8 } from "@workglow/task-graph";
1112
- var modelSchema7 = TypeReplicateArray(TypeModel("model:TextTranslationTask"));
1265
+ import { CreateWorkflow as CreateWorkflow10, TaskRegistry as TaskRegistry10, Workflow as Workflow10 } from "@workglow/task-graph";
1266
+ var modelSchema9 = TypeReplicateArray(TypeModel("model:TextTranslationTask"));
1113
1267
  var translationTextSchema = {
1114
1268
  type: "string",
1115
1269
  title: "Text",
@@ -1135,7 +1289,7 @@ var TextTranslationInputSchema = {
1135
1289
  minLength: 2,
1136
1290
  maxLength: 2
1137
1291
  })),
1138
- model: modelSchema7
1292
+ model: modelSchema9
1139
1293
  },
1140
1294
  required: ["text", "source_lang", "target_lang", "model"],
1141
1295
  additionalProperties: false
@@ -1171,18 +1325,56 @@ class TextTranslationTask extends AiTask {
1171
1325
  return TextTranslationOutputSchema;
1172
1326
  }
1173
1327
  }
1174
- TaskRegistry8.registerTask(TextTranslationTask);
1328
+ TaskRegistry10.registerTask(TextTranslationTask);
1175
1329
  var TextTranslation = (input, config) => {
1176
1330
  return new TextTranslationTask(input, config).run();
1177
1331
  };
1178
- Workflow8.prototype.TextTranslation = CreateWorkflow8(TextTranslationTask);
1332
+ Workflow10.prototype.TextTranslation = CreateWorkflow10(TextTranslationTask);
1333
+ // 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"));
1336
+ var UnloadModelInputSchema = {
1337
+ type: "object",
1338
+ properties: {
1339
+ model: modelSchema10
1340
+ },
1341
+ required: ["model"],
1342
+ additionalProperties: false
1343
+ };
1344
+ var UnloadModelOutputSchema = {
1345
+ type: "object",
1346
+ properties: {
1347
+ model: modelSchema10
1348
+ },
1349
+ required: ["model"],
1350
+ additionalProperties: false
1351
+ };
1352
+
1353
+ class UnloadModelTask extends AiTask {
1354
+ static type = "UnloadModelTask";
1355
+ static category = "Hidden";
1356
+ static title = "Unload Model";
1357
+ static description = "Unloads and clears cached AI models from memory and storage";
1358
+ static inputSchema() {
1359
+ return UnloadModelInputSchema;
1360
+ }
1361
+ static outputSchema() {
1362
+ return UnloadModelOutputSchema;
1363
+ }
1364
+ static cacheable = false;
1365
+ }
1366
+ TaskRegistry11.registerTask(UnloadModelTask);
1367
+ var UnloadModel = (input, config) => {
1368
+ return new UnloadModelTask(input, config).run();
1369
+ };
1370
+ Workflow11.prototype.UnloadModel = CreateWorkflow11(UnloadModelTask);
1179
1371
  // src/task/VectorSimilarityTask.ts
1180
1372
  import {
1181
1373
  ArrayTask,
1182
- CreateWorkflow as CreateWorkflow9,
1374
+ CreateWorkflow as CreateWorkflow12,
1183
1375
  TaskError,
1184
- TaskRegistry as TaskRegistry9,
1185
- Workflow as Workflow9
1376
+ TaskRegistry as TaskRegistry12,
1377
+ Workflow as Workflow12
1186
1378
  } from "@workglow/task-graph";
1187
1379
  var SimilarityFn = {
1188
1380
  COSINE: "cosine",
@@ -1276,11 +1468,11 @@ class VectorSimilarityTask extends ArrayTask {
1276
1468
  };
1277
1469
  }
1278
1470
  }
1279
- TaskRegistry9.registerTask(VectorSimilarityTask);
1471
+ TaskRegistry12.registerTask(VectorSimilarityTask);
1280
1472
  var Similarity = (input, config) => {
1281
1473
  return new VectorSimilarityTask(input, config).run();
1282
1474
  };
1283
- Workflow9.prototype.Similarity = CreateWorkflow9(VectorSimilarityTask);
1475
+ Workflow12.prototype.Similarity = CreateWorkflow12(VectorSimilarityTask);
1284
1476
  function inner(arr1, arr2) {
1285
1477
  return 1 - arr1.reduce((acc, val, i) => acc + val * arr2[i], 0);
1286
1478
  }
@@ -1316,6 +1508,8 @@ export {
1316
1508
  getGlobalModelRepository,
1317
1509
  getAiProviderRegistry,
1318
1510
  VectorSimilarityTask,
1511
+ UnloadModelTask,
1512
+ UnloadModel,
1319
1513
  TypedArraySchema,
1320
1514
  TypeReplicateArray,
1321
1515
  TypeModelByDetail,
@@ -1338,6 +1532,10 @@ export {
1338
1532
  TextQuestionAnswerOutputSchema,
1339
1533
  TextQuestionAnswerInputSchema,
1340
1534
  TextQuestionAnswer,
1535
+ TextLanguageDetectionTask,
1536
+ TextLanguageDetectionOutputSchema,
1537
+ TextLanguageDetectionInputSchema,
1538
+ TextLanguageDetection,
1341
1539
  TextGenerationTask,
1342
1540
  TextGenerationOutputSchema,
1343
1541
  TextGenerationInputSchema,
@@ -1347,6 +1545,10 @@ export {
1347
1545
  TextEmbeddingOutputSchema,
1348
1546
  TextEmbeddingInputSchema,
1349
1547
  TextEmbedding,
1548
+ TextClassifierTask,
1549
+ TextClassifierOutputSchema,
1550
+ TextClassifierInputSchema,
1551
+ TextClassifier,
1350
1552
  TableFragment,
1351
1553
  SimilarityFn,
1352
1554
  Similarity,
@@ -1370,4 +1572,4 @@ export {
1370
1572
  AiJob
1371
1573
  };
1372
1574
 
1373
- //# debugId=94CC5A5D8734D74E64756E2164756E21
1575
+ //# debugId=7179DF21BC09BC6364756E2164756E21