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