@workglow/ai 0.0.66 → 0.0.68

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