@workglow/ai 0.0.110 → 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 +89 -77
- package/dist/browser.js.map +5 -5
- package/dist/bun.js +89 -77
- package/dist/bun.js.map +5 -5
- package/dist/node.js +89 -77
- package/dist/node.js.map +5 -5
- package/dist/task/ToolCallingTask.d.ts +87 -40
- package/dist/task/ToolCallingTask.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 +5 -5
package/dist/node.js
CHANGED
|
@@ -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";
|
|
@@ -5260,8 +5260,78 @@ var textRewriter = (input, config) => {
|
|
|
5260
5260
|
};
|
|
5261
5261
|
Workflow37.prototype.textRewriter = CreateWorkflow37(TextRewriterTask);
|
|
5262
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
|
+
|
|
5263
5329
|
// src/task/ToolCallingTask.ts
|
|
5264
|
-
import {
|
|
5330
|
+
import {
|
|
5331
|
+
CreateWorkflow as CreateWorkflow39,
|
|
5332
|
+
getTaskConstructors,
|
|
5333
|
+
Workflow as Workflow39
|
|
5334
|
+
} from "@workglow/task-graph";
|
|
5265
5335
|
import { getLogger } from "@workglow/util";
|
|
5266
5336
|
function buildToolDescription(tool) {
|
|
5267
5337
|
let desc = tool.description;
|
|
@@ -5290,11 +5360,12 @@ function filterValidToolCalls(toolCalls, allowedTools) {
|
|
|
5290
5360
|
}
|
|
5291
5361
|
return filtered;
|
|
5292
5362
|
}
|
|
5293
|
-
function taskTypesToTools(taskNames) {
|
|
5363
|
+
function taskTypesToTools(taskNames, registry) {
|
|
5364
|
+
const constructors = getTaskConstructors(registry);
|
|
5294
5365
|
return taskNames.map((name) => {
|
|
5295
|
-
const ctor =
|
|
5366
|
+
const ctor = constructors.get(name);
|
|
5296
5367
|
if (!ctor) {
|
|
5297
|
-
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"})`);
|
|
5298
5369
|
}
|
|
5299
5370
|
return {
|
|
5300
5371
|
name: ctor.type,
|
|
@@ -5333,11 +5404,11 @@ var ToolDefinitionSchema = {
|
|
|
5333
5404
|
required: ["name", "description", "inputSchema"],
|
|
5334
5405
|
additionalProperties: false
|
|
5335
5406
|
};
|
|
5336
|
-
var
|
|
5407
|
+
var modelSchema28 = TypeModel("model:ToolCallingTask");
|
|
5337
5408
|
var ToolCallingInputSchema = {
|
|
5338
5409
|
type: "object",
|
|
5339
5410
|
properties: {
|
|
5340
|
-
model:
|
|
5411
|
+
model: modelSchema28,
|
|
5341
5412
|
prompt: TypeSingleOrArray({
|
|
5342
5413
|
type: "string",
|
|
5343
5414
|
title: "Prompt",
|
|
@@ -5350,9 +5421,15 @@ var ToolCallingInputSchema = {
|
|
|
5350
5421
|
},
|
|
5351
5422
|
tools: {
|
|
5352
5423
|
type: "array",
|
|
5424
|
+
format: "tasks",
|
|
5353
5425
|
title: "Tools",
|
|
5354
5426
|
description: "Tool definitions available for the model to call",
|
|
5355
|
-
items:
|
|
5427
|
+
items: {
|
|
5428
|
+
oneOf: [
|
|
5429
|
+
{ type: "string", format: "tasks", description: "Task type name" },
|
|
5430
|
+
ToolDefinitionSchema
|
|
5431
|
+
]
|
|
5432
|
+
}
|
|
5356
5433
|
},
|
|
5357
5434
|
toolChoice: {
|
|
5358
5435
|
type: "string",
|
|
@@ -5415,73 +5492,7 @@ class ToolCallingTask extends StreamingAiTask {
|
|
|
5415
5492
|
var toolCalling = (input, config) => {
|
|
5416
5493
|
return new ToolCallingTask({}, config).run(input);
|
|
5417
5494
|
};
|
|
5418
|
-
|
|
5419
|
-
|
|
5420
|
-
// src/task/TextTranslationTask.ts
|
|
5421
|
-
import { CreateWorkflow as CreateWorkflow39, Workflow as Workflow39 } from "@workglow/task-graph";
|
|
5422
|
-
var modelSchema28 = TypeModel("model:TextTranslationTask");
|
|
5423
|
-
var translationTextSchema = TypeSingleOrArray({
|
|
5424
|
-
type: "string",
|
|
5425
|
-
title: "Text",
|
|
5426
|
-
description: "The translated text",
|
|
5427
|
-
"x-stream": "replace"
|
|
5428
|
-
});
|
|
5429
|
-
var TextTranslationInputSchema = {
|
|
5430
|
-
type: "object",
|
|
5431
|
-
properties: {
|
|
5432
|
-
text: TypeSingleOrArray({
|
|
5433
|
-
type: "string",
|
|
5434
|
-
title: "Text",
|
|
5435
|
-
description: "The text to translate"
|
|
5436
|
-
}),
|
|
5437
|
-
source_lang: TypeLanguage({
|
|
5438
|
-
title: "Source Language",
|
|
5439
|
-
description: "The source language",
|
|
5440
|
-
minLength: 2,
|
|
5441
|
-
maxLength: 2
|
|
5442
|
-
}),
|
|
5443
|
-
target_lang: TypeLanguage({
|
|
5444
|
-
title: "Target Language",
|
|
5445
|
-
description: "The target language",
|
|
5446
|
-
minLength: 2,
|
|
5447
|
-
maxLength: 2
|
|
5448
|
-
}),
|
|
5449
|
-
model: modelSchema28
|
|
5450
|
-
},
|
|
5451
|
-
required: ["text", "source_lang", "target_lang", "model"],
|
|
5452
|
-
additionalProperties: false
|
|
5453
|
-
};
|
|
5454
|
-
var TextTranslationOutputSchema = {
|
|
5455
|
-
type: "object",
|
|
5456
|
-
properties: {
|
|
5457
|
-
text: translationTextSchema,
|
|
5458
|
-
target_lang: TypeLanguage({
|
|
5459
|
-
title: "Output Language",
|
|
5460
|
-
description: "The output language",
|
|
5461
|
-
minLength: 2,
|
|
5462
|
-
maxLength: 2
|
|
5463
|
-
})
|
|
5464
|
-
},
|
|
5465
|
-
required: ["text", "target_lang"],
|
|
5466
|
-
additionalProperties: false
|
|
5467
|
-
};
|
|
5468
|
-
|
|
5469
|
-
class TextTranslationTask extends StreamingAiTask {
|
|
5470
|
-
static type = "TextTranslationTask";
|
|
5471
|
-
static category = "AI Text Model";
|
|
5472
|
-
static title = "Text Translation";
|
|
5473
|
-
static description = "Translates text from one language to another using language models";
|
|
5474
|
-
static inputSchema() {
|
|
5475
|
-
return TextTranslationInputSchema;
|
|
5476
|
-
}
|
|
5477
|
-
static outputSchema() {
|
|
5478
|
-
return TextTranslationOutputSchema;
|
|
5479
|
-
}
|
|
5480
|
-
}
|
|
5481
|
-
var textTranslation = (input, config) => {
|
|
5482
|
-
return new TextTranslationTask({}, config).run(input);
|
|
5483
|
-
};
|
|
5484
|
-
Workflow39.prototype.textTranslation = CreateWorkflow39(TextTranslationTask);
|
|
5495
|
+
Workflow39.prototype.toolCalling = CreateWorkflow39(ToolCallingTask);
|
|
5485
5496
|
|
|
5486
5497
|
// src/task/TopicSegmenterTask.ts
|
|
5487
5498
|
import {
|
|
@@ -6147,7 +6158,7 @@ var registerAiTasks = () => {
|
|
|
6147
6158
|
VectorQuantizeTask,
|
|
6148
6159
|
VectorSimilarityTask
|
|
6149
6160
|
];
|
|
6150
|
-
tasks.map(
|
|
6161
|
+
tasks.map(TaskRegistry.registerTask);
|
|
6151
6162
|
return tasks;
|
|
6152
6163
|
};
|
|
6153
6164
|
export {
|
|
@@ -6216,6 +6227,7 @@ export {
|
|
|
6216
6227
|
TypeBoundingBox,
|
|
6217
6228
|
TypeAudioInput,
|
|
6218
6229
|
TopicSegmenterTask,
|
|
6230
|
+
ToolDefinitionSchema,
|
|
6219
6231
|
ToolCallingTask,
|
|
6220
6232
|
ToolCallingOutputSchema,
|
|
6221
6233
|
ToolCallingInputSchema,
|
|
@@ -6321,4 +6333,4 @@ export {
|
|
|
6321
6333
|
AiJob
|
|
6322
6334
|
};
|
|
6323
6335
|
|
|
6324
|
-
//# debugId=
|
|
6336
|
+
//# debugId=A89B37CE8541AB3764756E2164756E21
|