@workglow/ai 0.0.109 → 0.0.111
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 +141 -123
- package/dist/browser.js.map +22 -22
- package/dist/bun.js +141 -123
- package/dist/bun.js.map +22 -22
- package/dist/node.js +141 -123
- package/dist/node.js.map +22 -22
- 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 +132 -53
- package/dist/task/ToolCallingTask.d.ts.map +1 -1
- package/dist/task/base/AiTask.d.ts.map +1 -1
- package/dist/task/index.d.ts +1 -1
- package/dist/task/index.d.ts.map +1 -1
- package/package.json +13 -11
package/dist/node.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
|
|
324
|
+
limiter: new ConcurrencyLimiter(concurrency)
|
|
325
325
|
});
|
|
326
326
|
const client = new JobQueueClient({
|
|
327
327
|
storage,
|
|
@@ -419,7 +419,7 @@ class AiProvider {
|
|
|
419
419
|
}
|
|
420
420
|
}
|
|
421
421
|
// src/task/index.ts
|
|
422
|
-
import { TaskRegistry
|
|
422
|
+
import { TaskRegistry } from "@workglow/task-graph";
|
|
423
423
|
|
|
424
424
|
// src/task/BackgroundRemovalTask.ts
|
|
425
425
|
import { CreateWorkflow, Workflow } from "@workglow/task-graph";
|
|
@@ -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
|
|
@@ -5254,8 +5260,78 @@ var textRewriter = (input, config) => {
|
|
|
5254
5260
|
};
|
|
5255
5261
|
Workflow37.prototype.textRewriter = CreateWorkflow37(TextRewriterTask);
|
|
5256
5262
|
|
|
5263
|
+
// src/task/TextTranslationTask.ts
|
|
5264
|
+
import { CreateWorkflow as CreateWorkflow38, Workflow as Workflow38 } from "@workglow/task-graph";
|
|
5265
|
+
var modelSchema27 = TypeModel("model:TextTranslationTask");
|
|
5266
|
+
var translationTextSchema = TypeSingleOrArray({
|
|
5267
|
+
type: "string",
|
|
5268
|
+
title: "Text",
|
|
5269
|
+
description: "The translated text",
|
|
5270
|
+
"x-stream": "replace"
|
|
5271
|
+
});
|
|
5272
|
+
var TextTranslationInputSchema = {
|
|
5273
|
+
type: "object",
|
|
5274
|
+
properties: {
|
|
5275
|
+
text: TypeSingleOrArray({
|
|
5276
|
+
type: "string",
|
|
5277
|
+
title: "Text",
|
|
5278
|
+
description: "The text to translate"
|
|
5279
|
+
}),
|
|
5280
|
+
source_lang: TypeLanguage({
|
|
5281
|
+
title: "Source Language",
|
|
5282
|
+
description: "The source language",
|
|
5283
|
+
minLength: 2,
|
|
5284
|
+
maxLength: 2
|
|
5285
|
+
}),
|
|
5286
|
+
target_lang: TypeLanguage({
|
|
5287
|
+
title: "Target Language",
|
|
5288
|
+
description: "The target language",
|
|
5289
|
+
minLength: 2,
|
|
5290
|
+
maxLength: 2
|
|
5291
|
+
}),
|
|
5292
|
+
model: modelSchema27
|
|
5293
|
+
},
|
|
5294
|
+
required: ["text", "source_lang", "target_lang", "model"],
|
|
5295
|
+
additionalProperties: false
|
|
5296
|
+
};
|
|
5297
|
+
var TextTranslationOutputSchema = {
|
|
5298
|
+
type: "object",
|
|
5299
|
+
properties: {
|
|
5300
|
+
text: translationTextSchema,
|
|
5301
|
+
target_lang: TypeLanguage({
|
|
5302
|
+
title: "Output Language",
|
|
5303
|
+
description: "The output language",
|
|
5304
|
+
minLength: 2,
|
|
5305
|
+
maxLength: 2
|
|
5306
|
+
})
|
|
5307
|
+
},
|
|
5308
|
+
required: ["text", "target_lang"],
|
|
5309
|
+
additionalProperties: false
|
|
5310
|
+
};
|
|
5311
|
+
|
|
5312
|
+
class TextTranslationTask extends StreamingAiTask {
|
|
5313
|
+
static type = "TextTranslationTask";
|
|
5314
|
+
static category = "AI Text Model";
|
|
5315
|
+
static title = "Text Translation";
|
|
5316
|
+
static description = "Translates text from one language to another using language models";
|
|
5317
|
+
static inputSchema() {
|
|
5318
|
+
return TextTranslationInputSchema;
|
|
5319
|
+
}
|
|
5320
|
+
static outputSchema() {
|
|
5321
|
+
return TextTranslationOutputSchema;
|
|
5322
|
+
}
|
|
5323
|
+
}
|
|
5324
|
+
var textTranslation = (input, config) => {
|
|
5325
|
+
return new TextTranslationTask({}, config).run(input);
|
|
5326
|
+
};
|
|
5327
|
+
Workflow38.prototype.textTranslation = CreateWorkflow38(TextTranslationTask);
|
|
5328
|
+
|
|
5257
5329
|
// src/task/ToolCallingTask.ts
|
|
5258
|
-
import {
|
|
5330
|
+
import {
|
|
5331
|
+
CreateWorkflow as CreateWorkflow39,
|
|
5332
|
+
getTaskConstructors,
|
|
5333
|
+
Workflow as Workflow39
|
|
5334
|
+
} from "@workglow/task-graph";
|
|
5259
5335
|
import { getLogger } from "@workglow/util";
|
|
5260
5336
|
function buildToolDescription(tool) {
|
|
5261
5337
|
let desc = tool.description;
|
|
@@ -5284,11 +5360,12 @@ function filterValidToolCalls(toolCalls, allowedTools) {
|
|
|
5284
5360
|
}
|
|
5285
5361
|
return filtered;
|
|
5286
5362
|
}
|
|
5287
|
-
function taskTypesToTools(taskNames) {
|
|
5363
|
+
function taskTypesToTools(taskNames, registry) {
|
|
5364
|
+
const constructors = getTaskConstructors(registry);
|
|
5288
5365
|
return taskNames.map((name) => {
|
|
5289
|
-
const ctor =
|
|
5366
|
+
const ctor = constructors.get(name);
|
|
5290
5367
|
if (!ctor) {
|
|
5291
|
-
throw new Error(`taskTypesToTools: Unknown task type "${name}" — not found in
|
|
5368
|
+
throw new Error(`taskTypesToTools: Unknown task type "${name}" — not found in task constructors registry (ServiceRegistry: ${registry ? "custom" : "default"})`);
|
|
5292
5369
|
}
|
|
5293
5370
|
return {
|
|
5294
5371
|
name: ctor.type,
|
|
@@ -5327,16 +5404,16 @@ var ToolDefinitionSchema = {
|
|
|
5327
5404
|
required: ["name", "description", "inputSchema"],
|
|
5328
5405
|
additionalProperties: false
|
|
5329
5406
|
};
|
|
5330
|
-
var
|
|
5407
|
+
var modelSchema28 = TypeModel("model:ToolCallingTask");
|
|
5331
5408
|
var ToolCallingInputSchema = {
|
|
5332
5409
|
type: "object",
|
|
5333
5410
|
properties: {
|
|
5334
|
-
model:
|
|
5335
|
-
prompt: {
|
|
5411
|
+
model: modelSchema28,
|
|
5412
|
+
prompt: TypeSingleOrArray({
|
|
5336
5413
|
type: "string",
|
|
5337
5414
|
title: "Prompt",
|
|
5338
5415
|
description: "The prompt to send to the model"
|
|
5339
|
-
},
|
|
5416
|
+
}),
|
|
5340
5417
|
systemPrompt: {
|
|
5341
5418
|
type: "string",
|
|
5342
5419
|
title: "System Prompt",
|
|
@@ -5344,9 +5421,15 @@ var ToolCallingInputSchema = {
|
|
|
5344
5421
|
},
|
|
5345
5422
|
tools: {
|
|
5346
5423
|
type: "array",
|
|
5424
|
+
format: "tasks",
|
|
5347
5425
|
title: "Tools",
|
|
5348
5426
|
description: "Tool definitions available for the model to call",
|
|
5349
|
-
items:
|
|
5427
|
+
items: {
|
|
5428
|
+
oneOf: [
|
|
5429
|
+
{ type: "string", format: "tasks", description: "Task type name" },
|
|
5430
|
+
ToolDefinitionSchema
|
|
5431
|
+
]
|
|
5432
|
+
}
|
|
5350
5433
|
},
|
|
5351
5434
|
toolChoice: {
|
|
5352
5435
|
type: "string",
|
|
@@ -5376,19 +5459,19 @@ var ToolCallingInputSchema = {
|
|
|
5376
5459
|
var ToolCallingOutputSchema = {
|
|
5377
5460
|
type: "object",
|
|
5378
5461
|
properties: {
|
|
5379
|
-
text: {
|
|
5462
|
+
text: TypeSingleOrArray({
|
|
5380
5463
|
type: "string",
|
|
5381
5464
|
title: "Text",
|
|
5382
5465
|
description: "Any text content generated by the model",
|
|
5383
5466
|
"x-stream": "append"
|
|
5384
|
-
},
|
|
5385
|
-
toolCalls: {
|
|
5467
|
+
}),
|
|
5468
|
+
toolCalls: TypeSingleOrArray({
|
|
5386
5469
|
type: "object",
|
|
5387
5470
|
title: "Tool Calls",
|
|
5388
5471
|
description: "Tool invocations requested by the model, keyed by call id",
|
|
5389
5472
|
additionalProperties: true,
|
|
5390
5473
|
"x-stream": "object"
|
|
5391
|
-
}
|
|
5474
|
+
})
|
|
5392
5475
|
},
|
|
5393
5476
|
required: ["text", "toolCalls"],
|
|
5394
5477
|
additionalProperties: false
|
|
@@ -5409,73 +5492,7 @@ class ToolCallingTask extends StreamingAiTask {
|
|
|
5409
5492
|
var toolCalling = (input, config) => {
|
|
5410
5493
|
return new ToolCallingTask({}, config).run(input);
|
|
5411
5494
|
};
|
|
5412
|
-
|
|
5413
|
-
|
|
5414
|
-
// src/task/TextTranslationTask.ts
|
|
5415
|
-
import { CreateWorkflow as CreateWorkflow39, Workflow as Workflow39 } from "@workglow/task-graph";
|
|
5416
|
-
var modelSchema28 = TypeModel("model:TextTranslationTask");
|
|
5417
|
-
var translationTextSchema = {
|
|
5418
|
-
type: "string",
|
|
5419
|
-
title: "Text",
|
|
5420
|
-
description: "The translated text",
|
|
5421
|
-
"x-stream": "replace"
|
|
5422
|
-
};
|
|
5423
|
-
var TextTranslationInputSchema = {
|
|
5424
|
-
type: "object",
|
|
5425
|
-
properties: {
|
|
5426
|
-
text: {
|
|
5427
|
-
type: "string",
|
|
5428
|
-
title: "Text",
|
|
5429
|
-
description: "The text to translate"
|
|
5430
|
-
},
|
|
5431
|
-
source_lang: TypeLanguage({
|
|
5432
|
-
title: "Source Language",
|
|
5433
|
-
description: "The source language",
|
|
5434
|
-
minLength: 2,
|
|
5435
|
-
maxLength: 2
|
|
5436
|
-
}),
|
|
5437
|
-
target_lang: TypeLanguage({
|
|
5438
|
-
title: "Target Language",
|
|
5439
|
-
description: "The target language",
|
|
5440
|
-
minLength: 2,
|
|
5441
|
-
maxLength: 2
|
|
5442
|
-
}),
|
|
5443
|
-
model: modelSchema28
|
|
5444
|
-
},
|
|
5445
|
-
required: ["text", "source_lang", "target_lang", "model"],
|
|
5446
|
-
additionalProperties: false
|
|
5447
|
-
};
|
|
5448
|
-
var TextTranslationOutputSchema = {
|
|
5449
|
-
type: "object",
|
|
5450
|
-
properties: {
|
|
5451
|
-
text: translationTextSchema,
|
|
5452
|
-
target_lang: TypeLanguage({
|
|
5453
|
-
title: "Output Language",
|
|
5454
|
-
description: "The output language",
|
|
5455
|
-
minLength: 2,
|
|
5456
|
-
maxLength: 2
|
|
5457
|
-
})
|
|
5458
|
-
},
|
|
5459
|
-
required: ["text", "target_lang"],
|
|
5460
|
-
additionalProperties: false
|
|
5461
|
-
};
|
|
5462
|
-
|
|
5463
|
-
class TextTranslationTask extends StreamingAiTask {
|
|
5464
|
-
static type = "TextTranslationTask";
|
|
5465
|
-
static category = "AI Text Model";
|
|
5466
|
-
static title = "Text Translation";
|
|
5467
|
-
static description = "Translates text from one language to another using language models";
|
|
5468
|
-
static inputSchema() {
|
|
5469
|
-
return TextTranslationInputSchema;
|
|
5470
|
-
}
|
|
5471
|
-
static outputSchema() {
|
|
5472
|
-
return TextTranslationOutputSchema;
|
|
5473
|
-
}
|
|
5474
|
-
}
|
|
5475
|
-
var textTranslation = (input, config) => {
|
|
5476
|
-
return new TextTranslationTask({}, config).run(input);
|
|
5477
|
-
};
|
|
5478
|
-
Workflow39.prototype.textTranslation = CreateWorkflow39(TextTranslationTask);
|
|
5495
|
+
Workflow39.prototype.toolCalling = CreateWorkflow39(ToolCallingTask);
|
|
5479
5496
|
|
|
5480
5497
|
// src/task/TopicSegmenterTask.ts
|
|
5481
5498
|
import {
|
|
@@ -6141,7 +6158,7 @@ var registerAiTasks = () => {
|
|
|
6141
6158
|
VectorQuantizeTask,
|
|
6142
6159
|
VectorSimilarityTask
|
|
6143
6160
|
];
|
|
6144
|
-
tasks.map(
|
|
6161
|
+
tasks.map(TaskRegistry.registerTask);
|
|
6145
6162
|
return tasks;
|
|
6146
6163
|
};
|
|
6147
6164
|
export {
|
|
@@ -6210,6 +6227,7 @@ export {
|
|
|
6210
6227
|
TypeBoundingBox,
|
|
6211
6228
|
TypeAudioInput,
|
|
6212
6229
|
TopicSegmenterTask,
|
|
6230
|
+
ToolDefinitionSchema,
|
|
6213
6231
|
ToolCallingTask,
|
|
6214
6232
|
ToolCallingOutputSchema,
|
|
6215
6233
|
ToolCallingInputSchema,
|
|
@@ -6315,4 +6333,4 @@ export {
|
|
|
6315
6333
|
AiJob
|
|
6316
6334
|
};
|
|
6317
6335
|
|
|
6318
|
-
//# debugId=
|
|
6336
|
+
//# debugId=A89B37CE8541AB3764756E2164756E21
|