@workglow/ai 0.0.109 → 0.0.110

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 (34) hide show
  1. package/dist/browser.js +57 -51
  2. package/dist/browser.js.map +20 -20
  3. package/dist/bun.js +57 -51
  4. package/dist/bun.js.map +20 -20
  5. package/dist/node.js +57 -51
  6. package/dist/node.js.map +20 -20
  7. package/dist/task/CountTokensTask.d.ts +25 -7
  8. package/dist/task/CountTokensTask.d.ts.map +1 -1
  9. package/dist/task/DocumentEnricherTask.d.ts.map +1 -1
  10. package/dist/task/ModelInfoTask.d.ts +5 -0
  11. package/dist/task/ModelInfoTask.d.ts.map +1 -1
  12. package/dist/task/RerankerTask.d.ts.map +1 -1
  13. package/dist/task/TextClassificationTask.d.ts +59 -21
  14. package/dist/task/TextClassificationTask.d.ts.map +1 -1
  15. package/dist/task/TextFillMaskTask.d.ts +70 -26
  16. package/dist/task/TextFillMaskTask.d.ts.map +1 -1
  17. package/dist/task/TextGenerationTask.d.ts +27 -8
  18. package/dist/task/TextGenerationTask.d.ts.map +1 -1
  19. package/dist/task/TextLanguageDetectionTask.d.ts +59 -21
  20. package/dist/task/TextLanguageDetectionTask.d.ts.map +1 -1
  21. package/dist/task/TextNamedEntityRecognitionTask.d.ts +70 -26
  22. package/dist/task/TextNamedEntityRecognitionTask.d.ts.map +1 -1
  23. package/dist/task/TextQuestionAnswerTask.d.ts +39 -11
  24. package/dist/task/TextQuestionAnswerTask.d.ts.map +1 -1
  25. package/dist/task/TextRewriterTask.d.ts +27 -8
  26. package/dist/task/TextRewriterTask.d.ts.map +1 -1
  27. package/dist/task/TextSummaryTask.d.ts +27 -8
  28. package/dist/task/TextSummaryTask.d.ts.map +1 -1
  29. package/dist/task/TextTranslationTask.d.ts +27 -8
  30. package/dist/task/TextTranslationTask.d.ts.map +1 -1
  31. package/dist/task/ToolCallingTask.d.ts +45 -13
  32. package/dist/task/ToolCallingTask.d.ts.map +1 -1
  33. package/dist/task/base/AiTask.d.ts.map +1 -1
  34. package/package.json +13 -11
package/dist/browser.js CHANGED
@@ -321,7 +321,7 @@ async function createDefaultQueue(providerName, concurrency) {
321
321
  const server = new JobQueueServer(AiJob, {
322
322
  storage,
323
323
  queueName: providerName,
324
- limiter: new ConcurrencyLimiter(concurrency, 100)
324
+ limiter: new ConcurrencyLimiter(concurrency)
325
325
  });
326
326
  const client = new JobQueueClient({
327
327
  storage,
@@ -600,6 +600,7 @@ class AiTask extends JobQueueTask {
600
600
  const modelLabel = typeof input.model === "string" ? input.model : typeof input.model === "object" && input.model ? input.model.model_id || input.model.title || input.model.provider : undefined;
601
601
  config.title ||= `${new.target.type || new.target.name}${modelLabel ? " with model " + modelLabel : ""}`;
602
602
  super(input, config);
603
+ this.jobClass = AiJob;
603
604
  }
604
605
  async getJobInput(input) {
605
606
  const model = input.model;
@@ -1580,11 +1581,11 @@ var modelSchema3 = TypeModel("model");
1580
1581
  var CountTokensInputSchema = {
1581
1582
  type: "object",
1582
1583
  properties: {
1583
- text: {
1584
+ text: TypeSingleOrArray({
1584
1585
  type: "string",
1585
1586
  title: "Text",
1586
1587
  description: "The text to count tokens for"
1587
- },
1588
+ }),
1588
1589
  model: modelSchema3
1589
1590
  },
1590
1591
  required: ["text", "model"],
@@ -1593,11 +1594,11 @@ var CountTokensInputSchema = {
1593
1594
  var CountTokensOutputSchema = {
1594
1595
  type: "object",
1595
1596
  properties: {
1596
- count: {
1597
+ count: TypeSingleOrArray({
1597
1598
  type: "number",
1598
1599
  title: "Token Count",
1599
1600
  description: "The number of tokens in the text"
1600
- }
1601
+ })
1601
1602
  },
1602
1603
  required: ["count"],
1603
1604
  additionalProperties: false
@@ -1938,11 +1939,11 @@ var modelSchema5 = TypeModel("model:TextNamedEntityRecognitionTask");
1938
1939
  var TextNamedEntityRecognitionInputSchema = {
1939
1940
  type: "object",
1940
1941
  properties: {
1941
- text: {
1942
+ text: TypeSingleOrArray({
1942
1943
  type: "string",
1943
1944
  title: "Text",
1944
1945
  description: "The text to extract named entities from"
1945
- },
1946
+ }),
1946
1947
  blockList: {
1947
1948
  type: "array",
1948
1949
  items: {
@@ -1961,7 +1962,7 @@ var TextNamedEntityRecognitionInputSchema = {
1961
1962
  var TextNamedEntityRecognitionOutputSchema = {
1962
1963
  type: "object",
1963
1964
  properties: {
1964
- entities: {
1965
+ entities: TypeSingleOrArray({
1965
1966
  type: "array",
1966
1967
  items: {
1967
1968
  type: "object",
@@ -1987,7 +1988,7 @@ var TextNamedEntityRecognitionOutputSchema = {
1987
1988
  },
1988
1989
  title: "Entities",
1989
1990
  description: "The extracted named entities with their types, scores, and text"
1990
- }
1991
+ })
1991
1992
  },
1992
1993
  required: ["entities"],
1993
1994
  additionalProperties: false
@@ -2049,11 +2050,11 @@ var modelSchema6 = TypeModel("model:TextSummaryTask");
2049
2050
  var TextSummaryInputSchema = {
2050
2051
  type: "object",
2051
2052
  properties: {
2052
- text: {
2053
+ text: TypeSingleOrArray({
2053
2054
  type: "string",
2054
2055
  title: "Text",
2055
2056
  description: "The text to summarize"
2056
- },
2057
+ }),
2057
2058
  model: modelSchema6
2058
2059
  },
2059
2060
  required: ["text", "model"],
@@ -2062,12 +2063,12 @@ var TextSummaryInputSchema = {
2062
2063
  var TextSummaryOutputSchema = {
2063
2064
  type: "object",
2064
2065
  properties: {
2065
- text: {
2066
+ text: TypeSingleOrArray({
2066
2067
  type: "string",
2067
2068
  title: "Text",
2068
2069
  description: "The summarized text",
2069
2070
  "x-stream": "append"
2070
- }
2071
+ })
2071
2072
  },
2072
2073
  required: ["text"],
2073
2074
  additionalProperties: false
@@ -3662,7 +3663,12 @@ var modelSchema17 = TypeModel("model");
3662
3663
  var ModelInfoInputSchema = {
3663
3664
  type: "object",
3664
3665
  properties: {
3665
- model: modelSchema17
3666
+ model: modelSchema17,
3667
+ detail: {
3668
+ type: "string",
3669
+ enum: ["cached_status", "files", "files_with_metadata"],
3670
+ default: "files_with_metadata"
3671
+ }
3666
3672
  },
3667
3673
  required: ["model"],
3668
3674
  additionalProperties: false
@@ -4185,11 +4191,11 @@ var modelSchema20 = TypeModel("model:TextClassificationTask");
4185
4191
  var TextClassificationInputSchema = {
4186
4192
  type: "object",
4187
4193
  properties: {
4188
- text: {
4194
+ text: TypeSingleOrArray({
4189
4195
  type: "string",
4190
4196
  title: "Text",
4191
4197
  description: "The text to classify"
4192
- },
4198
+ }),
4193
4199
  candidateLabels: {
4194
4200
  type: "array",
4195
4201
  items: {
@@ -4216,7 +4222,7 @@ var TextClassificationInputSchema = {
4216
4222
  var TextClassificationOutputSchema = {
4217
4223
  type: "object",
4218
4224
  properties: {
4219
- categories: {
4225
+ categories: TypeSingleOrArray({
4220
4226
  type: "array",
4221
4227
  items: {
4222
4228
  type: "object",
@@ -4237,7 +4243,7 @@ var TextClassificationOutputSchema = {
4237
4243
  },
4238
4244
  title: "Categories",
4239
4245
  description: "The classification categories with their scores"
4240
- }
4246
+ })
4241
4247
  },
4242
4248
  required: ["categories"],
4243
4249
  additionalProperties: false
@@ -4926,11 +4932,11 @@ var modelSchema22 = TypeModel("model:TextFillMaskTask");
4926
4932
  var TextFillMaskInputSchema = {
4927
4933
  type: "object",
4928
4934
  properties: {
4929
- text: {
4935
+ text: TypeSingleOrArray({
4930
4936
  type: "string",
4931
4937
  title: "Text",
4932
4938
  description: "The text with a mask token to fill"
4933
- },
4939
+ }),
4934
4940
  model: modelSchema22
4935
4941
  },
4936
4942
  required: ["text", "model"],
@@ -4939,7 +4945,7 @@ var TextFillMaskInputSchema = {
4939
4945
  var TextFillMaskOutputSchema = {
4940
4946
  type: "object",
4941
4947
  properties: {
4942
- predictions: {
4948
+ predictions: TypeSingleOrArray({
4943
4949
  type: "array",
4944
4950
  items: {
4945
4951
  type: "object",
@@ -4965,7 +4971,7 @@ var TextFillMaskOutputSchema = {
4965
4971
  },
4966
4972
  title: "Predictions",
4967
4973
  description: "The predicted tokens to fill the mask with their scores and complete sequences"
4968
- }
4974
+ })
4969
4975
  },
4970
4976
  required: ["predictions"],
4971
4977
  additionalProperties: false
@@ -4990,22 +4996,22 @@ Workflow33.prototype.textFillMask = CreateWorkflow33(TextFillMaskTask);
4990
4996
 
4991
4997
  // src/task/TextGenerationTask.ts
4992
4998
  import { CreateWorkflow as CreateWorkflow34, Workflow as Workflow34 } from "@workglow/task-graph";
4993
- var generatedTextSchema2 = {
4999
+ var generatedTextSchema2 = TypeSingleOrArray({
4994
5000
  type: "string",
4995
5001
  title: "Text",
4996
5002
  description: "The generated text",
4997
5003
  "x-stream": "append"
4998
- };
5004
+ });
4999
5005
  var modelSchema23 = TypeModel("model:TextGenerationTask");
5000
5006
  var TextGenerationInputSchema = {
5001
5007
  type: "object",
5002
5008
  properties: {
5003
5009
  model: modelSchema23,
5004
- prompt: {
5010
+ prompt: TypeSingleOrArray({
5005
5011
  type: "string",
5006
5012
  title: "Prompt",
5007
5013
  description: "The prompt to generate text from"
5008
- },
5014
+ }),
5009
5015
  maxTokens: {
5010
5016
  type: "number",
5011
5017
  title: "Max Tokens",
@@ -5082,11 +5088,11 @@ var modelSchema24 = TypeModel("model:TextLanguageDetectionTask");
5082
5088
  var TextLanguageDetectionInputSchema = {
5083
5089
  type: "object",
5084
5090
  properties: {
5085
- text: {
5091
+ text: TypeSingleOrArray({
5086
5092
  type: "string",
5087
5093
  title: "Text",
5088
5094
  description: "The text to detect the language of"
5089
- },
5095
+ }),
5090
5096
  maxLanguages: {
5091
5097
  type: "number",
5092
5098
  minimum: 0,
@@ -5103,7 +5109,7 @@ var TextLanguageDetectionInputSchema = {
5103
5109
  var TextLanguageDetectionOutputSchema = {
5104
5110
  type: "object",
5105
5111
  properties: {
5106
- languages: {
5112
+ languages: TypeSingleOrArray({
5107
5113
  type: "array",
5108
5114
  items: {
5109
5115
  type: "object",
@@ -5124,7 +5130,7 @@ var TextLanguageDetectionOutputSchema = {
5124
5130
  },
5125
5131
  title: "Languages",
5126
5132
  description: "The languages with their scores"
5127
- }
5133
+ })
5128
5134
  },
5129
5135
  required: ["languages"],
5130
5136
  additionalProperties: false
@@ -5149,22 +5155,22 @@ Workflow35.prototype.textLanguageDetection = CreateWorkflow35(TextLanguageDetect
5149
5155
 
5150
5156
  // src/task/TextQuestionAnswerTask.ts
5151
5157
  import { CreateWorkflow as CreateWorkflow36, Workflow as Workflow36 } from "@workglow/task-graph";
5152
- var contextSchema = {
5158
+ var contextSchema = TypeSingleOrArray({
5153
5159
  type: "string",
5154
5160
  title: "Context",
5155
5161
  description: "The context of the question"
5156
- };
5157
- var questionSchema = {
5162
+ });
5163
+ var questionSchema = TypeSingleOrArray({
5158
5164
  type: "string",
5159
5165
  title: "Question",
5160
5166
  description: "The question to answer"
5161
- };
5162
- var textSchema = {
5167
+ });
5168
+ var textSchema = TypeSingleOrArray({
5163
5169
  type: "string",
5164
5170
  title: "Text",
5165
5171
  description: "The generated text",
5166
5172
  "x-stream": "append"
5167
- };
5173
+ });
5168
5174
  var modelSchema25 = TypeModel("model:TextQuestionAnswerTask");
5169
5175
  var TextQuestionAnswerInputSchema = {
5170
5176
  type: "object",
@@ -5208,11 +5214,11 @@ var modelSchema26 = TypeModel("model:TextRewriterTask");
5208
5214
  var TextRewriterInputSchema = {
5209
5215
  type: "object",
5210
5216
  properties: {
5211
- text: {
5217
+ text: TypeSingleOrArray({
5212
5218
  type: "string",
5213
5219
  title: "Text",
5214
5220
  description: "The text to rewrite"
5215
- },
5221
+ }),
5216
5222
  prompt: {
5217
5223
  type: "string",
5218
5224
  title: "Prompt",
@@ -5226,12 +5232,12 @@ var TextRewriterInputSchema = {
5226
5232
  var TextRewriterOutputSchema = {
5227
5233
  type: "object",
5228
5234
  properties: {
5229
- text: {
5235
+ text: TypeSingleOrArray({
5230
5236
  type: "string",
5231
5237
  title: "Text",
5232
5238
  description: "The rewritten text",
5233
5239
  "x-stream": "append"
5234
- }
5240
+ })
5235
5241
  },
5236
5242
  required: ["text"],
5237
5243
  additionalProperties: false
@@ -5332,11 +5338,11 @@ var ToolCallingInputSchema = {
5332
5338
  type: "object",
5333
5339
  properties: {
5334
5340
  model: modelSchema27,
5335
- prompt: {
5341
+ prompt: TypeSingleOrArray({
5336
5342
  type: "string",
5337
5343
  title: "Prompt",
5338
5344
  description: "The prompt to send to the model"
5339
- },
5345
+ }),
5340
5346
  systemPrompt: {
5341
5347
  type: "string",
5342
5348
  title: "System Prompt",
@@ -5376,19 +5382,19 @@ var ToolCallingInputSchema = {
5376
5382
  var ToolCallingOutputSchema = {
5377
5383
  type: "object",
5378
5384
  properties: {
5379
- text: {
5385
+ text: TypeSingleOrArray({
5380
5386
  type: "string",
5381
5387
  title: "Text",
5382
5388
  description: "Any text content generated by the model",
5383
5389
  "x-stream": "append"
5384
- },
5385
- toolCalls: {
5390
+ }),
5391
+ toolCalls: TypeSingleOrArray({
5386
5392
  type: "object",
5387
5393
  title: "Tool Calls",
5388
5394
  description: "Tool invocations requested by the model, keyed by call id",
5389
5395
  additionalProperties: true,
5390
5396
  "x-stream": "object"
5391
- }
5397
+ })
5392
5398
  },
5393
5399
  required: ["text", "toolCalls"],
5394
5400
  additionalProperties: false
@@ -5414,20 +5420,20 @@ Workflow38.prototype.toolCalling = CreateWorkflow38(ToolCallingTask);
5414
5420
  // src/task/TextTranslationTask.ts
5415
5421
  import { CreateWorkflow as CreateWorkflow39, Workflow as Workflow39 } from "@workglow/task-graph";
5416
5422
  var modelSchema28 = TypeModel("model:TextTranslationTask");
5417
- var translationTextSchema = {
5423
+ var translationTextSchema = TypeSingleOrArray({
5418
5424
  type: "string",
5419
5425
  title: "Text",
5420
5426
  description: "The translated text",
5421
5427
  "x-stream": "replace"
5422
- };
5428
+ });
5423
5429
  var TextTranslationInputSchema = {
5424
5430
  type: "object",
5425
5431
  properties: {
5426
- text: {
5432
+ text: TypeSingleOrArray({
5427
5433
  type: "string",
5428
5434
  title: "Text",
5429
5435
  description: "The text to translate"
5430
- },
5436
+ }),
5431
5437
  source_lang: TypeLanguage({
5432
5438
  title: "Source Language",
5433
5439
  description: "The source language",
@@ -6315,4 +6321,4 @@ export {
6315
6321
  AiJob
6316
6322
  };
6317
6323
 
6318
- //# debugId=3E9B53C5A8871E4264756E2164756E21
6324
+ //# debugId=57980351B01F6FC664756E2164756E21