@workglow/ai 0.0.52
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/LICENSE +201 -0
- package/README.md +531 -0
- package/dist/browser.js +1371 -0
- package/dist/browser.js.map +30 -0
- package/dist/bun.js +1398 -0
- package/dist/bun.js.map +32 -0
- package/dist/common.d.ts +15 -0
- package/dist/common.d.ts.map +1 -0
- package/dist/job/AiJob.d.ts +28 -0
- package/dist/job/AiJob.d.ts.map +1 -0
- package/dist/model/Model.d.ts +26 -0
- package/dist/model/Model.d.ts.map +1 -0
- package/dist/model/ModelRegistry.d.ts +9 -0
- package/dist/model/ModelRegistry.d.ts.map +1 -0
- package/dist/model/ModelRepository.d.ts +146 -0
- package/dist/model/ModelRepository.d.ts.map +1 -0
- package/dist/model/storage/InMemoryModelRepository.d.ts +18 -0
- package/dist/model/storage/InMemoryModelRepository.d.ts.map +1 -0
- package/dist/model/storage/IndexedDbModelRepository.d.ts +18 -0
- package/dist/model/storage/IndexedDbModelRepository.d.ts.map +1 -0
- package/dist/model/storage/PostgresModelRepository.d.ts +19 -0
- package/dist/model/storage/PostgresModelRepository.d.ts.map +1 -0
- package/dist/model/storage/SqliteModelRepository.d.ts +18 -0
- package/dist/model/storage/SqliteModelRepository.d.ts.map +1 -0
- package/dist/node.js +1397 -0
- package/dist/node.js.map +32 -0
- package/dist/provider/AiProviderRegistry.d.ts +35 -0
- package/dist/provider/AiProviderRegistry.d.ts.map +1 -0
- package/dist/source/Document.d.ts +56 -0
- package/dist/source/Document.d.ts.map +1 -0
- package/dist/source/DocumentConverter.d.ts +15 -0
- package/dist/source/DocumentConverter.d.ts.map +1 -0
- package/dist/source/DocumentConverterMarkdown.d.ts +13 -0
- package/dist/source/DocumentConverterMarkdown.d.ts.map +1 -0
- package/dist/source/DocumentConverterText.d.ts +13 -0
- package/dist/source/DocumentConverterText.d.ts.map +1 -0
- package/dist/source/MasterDocument.d.ts +27 -0
- package/dist/source/MasterDocument.d.ts.map +1 -0
- package/dist/source/index.d.ts +10 -0
- package/dist/source/index.d.ts.map +1 -0
- package/dist/task/DocumentSplitterTask.d.ts +58 -0
- package/dist/task/DocumentSplitterTask.d.ts.map +1 -0
- package/dist/task/DownloadModelTask.d.ts +118 -0
- package/dist/task/DownloadModelTask.d.ts.map +1 -0
- package/dist/task/TextEmbeddingTask.d.ts +268 -0
- package/dist/task/TextEmbeddingTask.d.ts.map +1 -0
- package/dist/task/TextGenerationTask.d.ts +140 -0
- package/dist/task/TextGenerationTask.d.ts.map +1 -0
- package/dist/task/TextQuestionAnswerTask.d.ts +124 -0
- package/dist/task/TextQuestionAnswerTask.d.ts.map +1 -0
- package/dist/task/TextRewriterTask.d.ts +113 -0
- package/dist/task/TextRewriterTask.d.ts.map +1 -0
- package/dist/task/TextSummaryTask.d.ts +95 -0
- package/dist/task/TextSummaryTask.d.ts.map +1 -0
- package/dist/task/TextTranslationTask.d.ts +158 -0
- package/dist/task/TextTranslationTask.d.ts.map +1 -0
- package/dist/task/VectorSimilarityTask.d.ts +334 -0
- package/dist/task/VectorSimilarityTask.d.ts.map +1 -0
- package/dist/task/base/AiTask.d.ts +47 -0
- package/dist/task/base/AiTask.d.ts.map +1 -0
- package/dist/task/base/AiTaskSchemas.d.ts +156 -0
- package/dist/task/base/AiTaskSchemas.d.ts.map +1 -0
- package/dist/task/index.d.ts +17 -0
- package/dist/task/index.d.ts.map +1 -0
- package/dist/types.d.ts +11 -0
- package/dist/types.d.ts.map +1 -0
- package/package.json +67 -0
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright 2025 Steven Roussey <sroussey@gmail.com>
|
|
4
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
5
|
+
*/
|
|
6
|
+
import { CreateWorkflow, JobQueueTaskConfig } from "@workglow/task-graph";
|
|
7
|
+
import { DataPortSchema, FromSchema } from "@workglow/util";
|
|
8
|
+
import { AiTask } from "./base/AiTask";
|
|
9
|
+
export declare const TextRewriterInputSchema: {
|
|
10
|
+
readonly type: "object";
|
|
11
|
+
readonly properties: {
|
|
12
|
+
readonly text: {
|
|
13
|
+
readonly "x-replicate": true;
|
|
14
|
+
readonly format?: string | undefined;
|
|
15
|
+
readonly oneOf: readonly [{
|
|
16
|
+
type: "string";
|
|
17
|
+
title: string;
|
|
18
|
+
description: string;
|
|
19
|
+
}, {
|
|
20
|
+
readonly type: "array";
|
|
21
|
+
readonly items: {
|
|
22
|
+
type: "string";
|
|
23
|
+
title: string;
|
|
24
|
+
description: string;
|
|
25
|
+
};
|
|
26
|
+
}];
|
|
27
|
+
readonly title: string | undefined;
|
|
28
|
+
readonly description: string | undefined;
|
|
29
|
+
};
|
|
30
|
+
readonly prompt: {
|
|
31
|
+
readonly "x-replicate": true;
|
|
32
|
+
readonly format?: string | undefined;
|
|
33
|
+
readonly oneOf: readonly [{
|
|
34
|
+
type: "string";
|
|
35
|
+
title: string;
|
|
36
|
+
description: string;
|
|
37
|
+
}, {
|
|
38
|
+
readonly type: "array";
|
|
39
|
+
readonly items: {
|
|
40
|
+
type: "string";
|
|
41
|
+
title: string;
|
|
42
|
+
description: string;
|
|
43
|
+
};
|
|
44
|
+
}];
|
|
45
|
+
readonly title: string | undefined;
|
|
46
|
+
readonly description: string | undefined;
|
|
47
|
+
};
|
|
48
|
+
readonly model: {
|
|
49
|
+
readonly "x-replicate": true;
|
|
50
|
+
readonly format?: string | undefined;
|
|
51
|
+
readonly oneOf: readonly [{
|
|
52
|
+
readonly title: "Model";
|
|
53
|
+
readonly description: `The model ${string}`;
|
|
54
|
+
} & {
|
|
55
|
+
readonly format: "model:TextRewriterTask";
|
|
56
|
+
readonly type: "string";
|
|
57
|
+
}, {
|
|
58
|
+
readonly type: "array";
|
|
59
|
+
readonly items: {
|
|
60
|
+
readonly title: "Model";
|
|
61
|
+
readonly description: `The model ${string}`;
|
|
62
|
+
} & {
|
|
63
|
+
readonly format: "model:TextRewriterTask";
|
|
64
|
+
readonly type: "string";
|
|
65
|
+
};
|
|
66
|
+
}];
|
|
67
|
+
readonly title: string | undefined;
|
|
68
|
+
readonly description: string | undefined;
|
|
69
|
+
};
|
|
70
|
+
};
|
|
71
|
+
readonly required: readonly ["text", "prompt", "model"];
|
|
72
|
+
readonly additionalProperties: false;
|
|
73
|
+
};
|
|
74
|
+
export declare const TextRewriterOutputSchema: {
|
|
75
|
+
readonly type: "object";
|
|
76
|
+
readonly properties: {
|
|
77
|
+
readonly text: {
|
|
78
|
+
readonly type: "string";
|
|
79
|
+
readonly title: "Text";
|
|
80
|
+
readonly description: "The rewritten text";
|
|
81
|
+
};
|
|
82
|
+
};
|
|
83
|
+
readonly required: readonly ["text"];
|
|
84
|
+
readonly additionalProperties: false;
|
|
85
|
+
};
|
|
86
|
+
export type TextRewriterTaskInput = FromSchema<typeof TextRewriterInputSchema>;
|
|
87
|
+
export type TextRewriterTaskOutput = FromSchema<typeof TextRewriterOutputSchema>;
|
|
88
|
+
/**
|
|
89
|
+
* This is a special case of text generation that takes a prompt and text to rewrite
|
|
90
|
+
*/
|
|
91
|
+
export declare class TextRewriterTask extends AiTask<TextRewriterTaskInput, TextRewriterTaskOutput> {
|
|
92
|
+
static type: string;
|
|
93
|
+
static category: string;
|
|
94
|
+
static title: string;
|
|
95
|
+
static description: string;
|
|
96
|
+
static inputSchema(): DataPortSchema;
|
|
97
|
+
static outputSchema(): DataPortSchema;
|
|
98
|
+
}
|
|
99
|
+
/**
|
|
100
|
+
* Convenience function to run text rewriter tasks.
|
|
101
|
+
* Creates and executes a TextRewriterCompoundTask with the provided input.
|
|
102
|
+
* @param input The input parameters for text rewriting (text, prompt, and model)
|
|
103
|
+
* @returns Promise resolving to the rewritten text output(s)
|
|
104
|
+
*/
|
|
105
|
+
export declare const TextRewriter: (input: TextRewriterTaskInput, config?: JobQueueTaskConfig) => Promise<{
|
|
106
|
+
text: string;
|
|
107
|
+
}>;
|
|
108
|
+
declare module "@workglow/task-graph" {
|
|
109
|
+
interface Workflow {
|
|
110
|
+
TextRewriter: CreateWorkflow<TextRewriterTaskInput, TextRewriterTaskOutput, JobQueueTaskConfig>;
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
//# sourceMappingURL=TextRewriterTask.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"TextRewriterTask.d.ts","sourceRoot":"","sources":["../../src/task/TextRewriterTask.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,cAAc,EAAE,kBAAkB,EAA0B,MAAM,sBAAsB,CAAC;AAClG,OAAO,EAAE,cAAc,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AAC5D,OAAO,EAAE,MAAM,EAAE,MAAM,eAAe,CAAC;AAKvC,eAAO,MAAM,uBAAuB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAiBD,CAAC;AAEpC,eAAO,MAAM,wBAAwB;;;;;;;;;;;CAWF,CAAC;AAEpC,MAAM,MAAM,qBAAqB,GAAG,UAAU,CAAC,OAAO,uBAAuB,CAAC,CAAC;AAC/E,MAAM,MAAM,sBAAsB,GAAG,UAAU,CAAC,OAAO,wBAAwB,CAAC,CAAC;AAEjF;;GAEG;AACH,qBAAa,gBAAiB,SAAQ,MAAM,CAAC,qBAAqB,EAAE,sBAAsB,CAAC;IACzF,OAAc,IAAI,SAAsB;IACxC,OAAc,QAAQ,SAAmB;IACzC,OAAc,KAAK,SAAmB;IACtC,OAAc,WAAW,SAAqE;WAChF,WAAW,IAAI,cAAc;WAG7B,YAAY,IAAI,cAAc;CAG7C;AAID;;;;;GAKG;AACH,eAAO,MAAM,YAAY,GAAI,OAAO,qBAAqB,EAAE,SAAS,kBAAkB;;EAErF,CAAC;AAEF,OAAO,QAAQ,sBAAsB,CAAC;IACpC,UAAU,QAAQ;QAChB,YAAY,EAAE,cAAc,CAAC,qBAAqB,EAAE,sBAAsB,EAAE,kBAAkB,CAAC,CAAC;KACjG;CACF"}
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright 2025 Steven Roussey <sroussey@gmail.com>
|
|
4
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
5
|
+
*/
|
|
6
|
+
import { CreateWorkflow, JobQueueTaskConfig } from "@workglow/task-graph";
|
|
7
|
+
import { DataPortSchema, FromSchema } from "@workglow/util";
|
|
8
|
+
import { AiTask } from "./base/AiTask";
|
|
9
|
+
export declare const TextSummaryInputSchema: {
|
|
10
|
+
readonly type: "object";
|
|
11
|
+
readonly properties: {
|
|
12
|
+
readonly text: {
|
|
13
|
+
readonly "x-replicate": true;
|
|
14
|
+
readonly format?: string | undefined;
|
|
15
|
+
readonly oneOf: readonly [{
|
|
16
|
+
type: "string";
|
|
17
|
+
title: string;
|
|
18
|
+
description: string;
|
|
19
|
+
}, {
|
|
20
|
+
readonly type: "array";
|
|
21
|
+
readonly items: {
|
|
22
|
+
type: "string";
|
|
23
|
+
title: string;
|
|
24
|
+
description: string;
|
|
25
|
+
};
|
|
26
|
+
}];
|
|
27
|
+
readonly title: string | undefined;
|
|
28
|
+
readonly description: string | undefined;
|
|
29
|
+
};
|
|
30
|
+
readonly model: {
|
|
31
|
+
readonly "x-replicate": true;
|
|
32
|
+
readonly format?: string | undefined;
|
|
33
|
+
readonly oneOf: readonly [{
|
|
34
|
+
readonly title: "Model";
|
|
35
|
+
readonly description: `The model ${string}`;
|
|
36
|
+
} & {
|
|
37
|
+
readonly format: "model:TextSummaryTask";
|
|
38
|
+
readonly type: "string";
|
|
39
|
+
}, {
|
|
40
|
+
readonly type: "array";
|
|
41
|
+
readonly items: {
|
|
42
|
+
readonly title: "Model";
|
|
43
|
+
readonly description: `The model ${string}`;
|
|
44
|
+
} & {
|
|
45
|
+
readonly format: "model:TextSummaryTask";
|
|
46
|
+
readonly type: "string";
|
|
47
|
+
};
|
|
48
|
+
}];
|
|
49
|
+
readonly title: string | undefined;
|
|
50
|
+
readonly description: string | undefined;
|
|
51
|
+
};
|
|
52
|
+
};
|
|
53
|
+
readonly required: readonly ["text", "model"];
|
|
54
|
+
readonly additionalProperties: false;
|
|
55
|
+
};
|
|
56
|
+
export declare const TextSummaryOutputSchema: {
|
|
57
|
+
readonly type: "object";
|
|
58
|
+
readonly properties: {
|
|
59
|
+
readonly text: {
|
|
60
|
+
readonly type: "string";
|
|
61
|
+
readonly title: "Text";
|
|
62
|
+
readonly description: "The summarized text";
|
|
63
|
+
};
|
|
64
|
+
};
|
|
65
|
+
readonly required: readonly ["text"];
|
|
66
|
+
readonly additionalProperties: false;
|
|
67
|
+
};
|
|
68
|
+
export type TextSummaryTaskInput = FromSchema<typeof TextSummaryInputSchema>;
|
|
69
|
+
export type TextSummaryTaskOutput = FromSchema<typeof TextSummaryOutputSchema>;
|
|
70
|
+
/**
|
|
71
|
+
* This summarizes a piece of text
|
|
72
|
+
*/
|
|
73
|
+
export declare class TextSummaryTask extends AiTask<TextSummaryTaskInput, TextSummaryTaskOutput> {
|
|
74
|
+
static type: string;
|
|
75
|
+
static category: string;
|
|
76
|
+
static title: string;
|
|
77
|
+
static description: string;
|
|
78
|
+
static inputSchema(): DataPortSchema;
|
|
79
|
+
static outputSchema(): DataPortSchema;
|
|
80
|
+
}
|
|
81
|
+
/**
|
|
82
|
+
* Convenience function to run text summary tasks.
|
|
83
|
+
* Creates and executes a text summary task with the provided input.
|
|
84
|
+
* @param input The input parameters for text summary (text and model)
|
|
85
|
+
* @returns Promise resolving to the summarized text output(s)
|
|
86
|
+
*/
|
|
87
|
+
export declare const TextSummary: (input: TextSummaryTaskInput, config?: JobQueueTaskConfig) => Promise<{
|
|
88
|
+
text: string;
|
|
89
|
+
}>;
|
|
90
|
+
declare module "@workglow/task-graph" {
|
|
91
|
+
interface Workflow {
|
|
92
|
+
TextSummary: CreateWorkflow<TextSummaryTaskInput, TextSummaryTaskOutput, JobQueueTaskConfig>;
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
//# sourceMappingURL=TextSummaryTask.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"TextSummaryTask.d.ts","sourceRoot":"","sources":["../../src/task/TextSummaryTask.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,cAAc,EAAE,kBAAkB,EAA0B,MAAM,sBAAsB,CAAC;AAClG,OAAO,EAAE,cAAc,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AAC5D,OAAO,EAAE,MAAM,EAAE,MAAM,eAAe,CAAC;AAKvC,eAAO,MAAM,sBAAsB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAYA,CAAC;AAEpC,eAAO,MAAM,uBAAuB;;;;;;;;;;;CAWD,CAAC;AAEpC,MAAM,MAAM,oBAAoB,GAAG,UAAU,CAAC,OAAO,sBAAsB,CAAC,CAAC;AAC7E,MAAM,MAAM,qBAAqB,GAAG,UAAU,CAAC,OAAO,uBAAuB,CAAC,CAAC;AAE/E;;GAEG;AAEH,qBAAa,eAAgB,SAAQ,MAAM,CAAC,oBAAoB,EAAE,qBAAqB,CAAC;IACtF,OAAc,IAAI,SAAqB;IACvC,OAAc,QAAQ,SAAmB;IACzC,OAAc,KAAK,SAAkB;IACrC,OAAc,WAAW,SACgD;WAC3D,WAAW,IAAI,cAAc;WAG7B,YAAY,IAAI,cAAc;CAG7C;AAID;;;;;GAKG;AACH,eAAO,MAAM,WAAW,GAAU,OAAO,oBAAoB,EAAE,SAAS,kBAAkB;;EAEzF,CAAC;AAEF,OAAO,QAAQ,sBAAsB,CAAC;IACpC,UAAU,QAAQ;QAChB,WAAW,EAAE,cAAc,CAAC,oBAAoB,EAAE,qBAAqB,EAAE,kBAAkB,CAAC,CAAC;KAC9F;CACF"}
|
|
@@ -0,0 +1,158 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright 2025 Steven Roussey <sroussey@gmail.com>
|
|
4
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
5
|
+
*/
|
|
6
|
+
import { CreateWorkflow, JobQueueTaskConfig } from "@workglow/task-graph";
|
|
7
|
+
import { DataPortSchema, FromSchema } from "@workglow/util";
|
|
8
|
+
import { AiTask } from "./base/AiTask";
|
|
9
|
+
export declare const TextTranslationInputSchema: {
|
|
10
|
+
readonly type: "object";
|
|
11
|
+
readonly properties: {
|
|
12
|
+
readonly text: {
|
|
13
|
+
readonly "x-replicate": true;
|
|
14
|
+
readonly format?: string | undefined;
|
|
15
|
+
readonly oneOf: readonly [{
|
|
16
|
+
type: "string";
|
|
17
|
+
title: string;
|
|
18
|
+
description: string;
|
|
19
|
+
}, {
|
|
20
|
+
readonly type: "array";
|
|
21
|
+
readonly items: {
|
|
22
|
+
type: "string";
|
|
23
|
+
title: string;
|
|
24
|
+
description: string;
|
|
25
|
+
};
|
|
26
|
+
}];
|
|
27
|
+
readonly title: string | undefined;
|
|
28
|
+
readonly description: string | undefined;
|
|
29
|
+
};
|
|
30
|
+
readonly source_lang: {
|
|
31
|
+
readonly "x-replicate": true;
|
|
32
|
+
readonly format?: string | undefined;
|
|
33
|
+
readonly oneOf: readonly [{
|
|
34
|
+
readonly type: "string";
|
|
35
|
+
readonly title: "Language";
|
|
36
|
+
readonly description: "The language to use";
|
|
37
|
+
readonly maxLength: 2;
|
|
38
|
+
readonly minLength: 2;
|
|
39
|
+
}, {
|
|
40
|
+
readonly type: "array";
|
|
41
|
+
readonly items: {
|
|
42
|
+
readonly type: "string";
|
|
43
|
+
readonly title: "Language";
|
|
44
|
+
readonly description: "The language to use";
|
|
45
|
+
readonly maxLength: 2;
|
|
46
|
+
readonly minLength: 2;
|
|
47
|
+
};
|
|
48
|
+
}];
|
|
49
|
+
readonly title: string | undefined;
|
|
50
|
+
readonly description: string | undefined;
|
|
51
|
+
};
|
|
52
|
+
readonly target_lang: {
|
|
53
|
+
readonly "x-replicate": true;
|
|
54
|
+
readonly format?: string | undefined;
|
|
55
|
+
readonly oneOf: readonly [{
|
|
56
|
+
readonly type: "string";
|
|
57
|
+
readonly title: "Language";
|
|
58
|
+
readonly description: "The language to use";
|
|
59
|
+
readonly maxLength: 2;
|
|
60
|
+
readonly minLength: 2;
|
|
61
|
+
}, {
|
|
62
|
+
readonly type: "array";
|
|
63
|
+
readonly items: {
|
|
64
|
+
readonly type: "string";
|
|
65
|
+
readonly title: "Language";
|
|
66
|
+
readonly description: "The language to use";
|
|
67
|
+
readonly maxLength: 2;
|
|
68
|
+
readonly minLength: 2;
|
|
69
|
+
};
|
|
70
|
+
}];
|
|
71
|
+
readonly title: string | undefined;
|
|
72
|
+
readonly description: string | undefined;
|
|
73
|
+
};
|
|
74
|
+
readonly model: {
|
|
75
|
+
readonly "x-replicate": true;
|
|
76
|
+
readonly format?: string | undefined;
|
|
77
|
+
readonly oneOf: readonly [{
|
|
78
|
+
readonly title: "Model";
|
|
79
|
+
readonly description: `The model ${string}`;
|
|
80
|
+
} & {
|
|
81
|
+
readonly format: "model:TextTranslationTask";
|
|
82
|
+
readonly type: "string";
|
|
83
|
+
}, {
|
|
84
|
+
readonly type: "array";
|
|
85
|
+
readonly items: {
|
|
86
|
+
readonly title: "Model";
|
|
87
|
+
readonly description: `The model ${string}`;
|
|
88
|
+
} & {
|
|
89
|
+
readonly format: "model:TextTranslationTask";
|
|
90
|
+
readonly type: "string";
|
|
91
|
+
};
|
|
92
|
+
}];
|
|
93
|
+
readonly title: string | undefined;
|
|
94
|
+
readonly description: string | undefined;
|
|
95
|
+
};
|
|
96
|
+
};
|
|
97
|
+
readonly required: readonly ["text", "source_lang", "target_lang", "model"];
|
|
98
|
+
readonly additionalProperties: false;
|
|
99
|
+
};
|
|
100
|
+
export declare const TextTranslationOutputSchema: {
|
|
101
|
+
readonly type: "object";
|
|
102
|
+
readonly properties: {
|
|
103
|
+
readonly text: {
|
|
104
|
+
readonly oneOf: readonly [{
|
|
105
|
+
readonly type: "string";
|
|
106
|
+
readonly title: "Text";
|
|
107
|
+
readonly description: "The translated text";
|
|
108
|
+
}, {
|
|
109
|
+
readonly type: "array";
|
|
110
|
+
readonly items: {
|
|
111
|
+
readonly type: "string";
|
|
112
|
+
readonly title: "Text";
|
|
113
|
+
readonly description: "The translated text";
|
|
114
|
+
};
|
|
115
|
+
}];
|
|
116
|
+
readonly title: "Text";
|
|
117
|
+
readonly description: "The translated text";
|
|
118
|
+
};
|
|
119
|
+
readonly target_lang: {
|
|
120
|
+
readonly type: "string";
|
|
121
|
+
readonly title: "Language";
|
|
122
|
+
readonly description: "The language to use";
|
|
123
|
+
readonly maxLength: 2;
|
|
124
|
+
readonly minLength: 2;
|
|
125
|
+
};
|
|
126
|
+
};
|
|
127
|
+
readonly required: readonly ["text", "target_lang"];
|
|
128
|
+
readonly additionalProperties: false;
|
|
129
|
+
};
|
|
130
|
+
export type TextTranslationTaskInput = FromSchema<typeof TextTranslationInputSchema>;
|
|
131
|
+
export type TextTranslationTaskOutput = FromSchema<typeof TextTranslationOutputSchema>;
|
|
132
|
+
/**
|
|
133
|
+
* This translates text from one language to another
|
|
134
|
+
*/
|
|
135
|
+
export declare class TextTranslationTask extends AiTask<TextTranslationTaskInput, TextTranslationTaskOutput> {
|
|
136
|
+
static type: string;
|
|
137
|
+
static category: string;
|
|
138
|
+
static title: string;
|
|
139
|
+
static description: string;
|
|
140
|
+
static inputSchema(): DataPortSchema;
|
|
141
|
+
static outputSchema(): DataPortSchema;
|
|
142
|
+
}
|
|
143
|
+
/**
|
|
144
|
+
* Convenience function to run text translation tasks.
|
|
145
|
+
* Creates and executes a TextTranslationCompoundTask with the provided input.
|
|
146
|
+
* @param input The input parameters for text translation (text, model, source_lang, and target_lang)
|
|
147
|
+
* @returns Promise resolving to the translated text output(s)
|
|
148
|
+
*/
|
|
149
|
+
export declare const TextTranslation: (input: TextTranslationTaskInput, config?: JobQueueTaskConfig) => Promise<{
|
|
150
|
+
text: string | string[];
|
|
151
|
+
target_lang: string;
|
|
152
|
+
}>;
|
|
153
|
+
declare module "@workglow/task-graph" {
|
|
154
|
+
interface Workflow {
|
|
155
|
+
TextTranslation: CreateWorkflow<TextTranslationTaskInput, TextTranslationTaskOutput, JobQueueTaskConfig>;
|
|
156
|
+
}
|
|
157
|
+
}
|
|
158
|
+
//# sourceMappingURL=TextTranslationTask.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"TextTranslationTask.d.ts","sourceRoot":"","sources":["../../src/task/TextTranslationTask.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,cAAc,EAAE,kBAAkB,EAA0B,MAAM,sBAAsB,CAAC;AAClG,OAAO,EAAE,cAAc,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AAC5D,OAAO,EAAE,MAAM,EAAE,MAAM,eAAe,CAAC;AAWvC,eAAO,MAAM,0BAA0B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAwBJ,CAAC;AAEpC,eAAO,MAAM,2BAA2B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAeL,CAAC;AAEpC,MAAM,MAAM,wBAAwB,GAAG,UAAU,CAAC,OAAO,0BAA0B,CAAC,CAAC;AACrF,MAAM,MAAM,yBAAyB,GAAG,UAAU,CAAC,OAAO,2BAA2B,CAAC,CAAC;AAEvF;;GAEG;AACH,qBAAa,mBAAoB,SAAQ,MAAM,CAC7C,wBAAwB,EACxB,yBAAyB,CAC1B;IACC,OAAc,IAAI,SAAyB;IAC3C,OAAc,QAAQ,SAAmB;IACzC,OAAc,KAAK,SAAsB;IACzC,OAAc,WAAW,SAAwE;WACnF,WAAW,IAAI,cAAc;WAG7B,YAAY,IAAI,cAAc;CAG7C;AAID;;;;;GAKG;AACH,eAAO,MAAM,eAAe,GAAI,OAAO,wBAAwB,EAAE,SAAS,kBAAkB;;;EAE3F,CAAC;AAEF,OAAO,QAAQ,sBAAsB,CAAC;IACpC,UAAU,QAAQ;QAChB,eAAe,EAAE,cAAc,CAC7B,wBAAwB,EACxB,yBAAyB,EACzB,kBAAkB,CACnB,CAAC;KACH;CACF"}
|