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