@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.
Files changed (67) hide show
  1. package/LICENSE +201 -0
  2. package/README.md +531 -0
  3. package/dist/browser.js +1371 -0
  4. package/dist/browser.js.map +30 -0
  5. package/dist/bun.js +1398 -0
  6. package/dist/bun.js.map +32 -0
  7. package/dist/common.d.ts +15 -0
  8. package/dist/common.d.ts.map +1 -0
  9. package/dist/job/AiJob.d.ts +28 -0
  10. package/dist/job/AiJob.d.ts.map +1 -0
  11. package/dist/model/Model.d.ts +26 -0
  12. package/dist/model/Model.d.ts.map +1 -0
  13. package/dist/model/ModelRegistry.d.ts +9 -0
  14. package/dist/model/ModelRegistry.d.ts.map +1 -0
  15. package/dist/model/ModelRepository.d.ts +146 -0
  16. package/dist/model/ModelRepository.d.ts.map +1 -0
  17. package/dist/model/storage/InMemoryModelRepository.d.ts +18 -0
  18. package/dist/model/storage/InMemoryModelRepository.d.ts.map +1 -0
  19. package/dist/model/storage/IndexedDbModelRepository.d.ts +18 -0
  20. package/dist/model/storage/IndexedDbModelRepository.d.ts.map +1 -0
  21. package/dist/model/storage/PostgresModelRepository.d.ts +19 -0
  22. package/dist/model/storage/PostgresModelRepository.d.ts.map +1 -0
  23. package/dist/model/storage/SqliteModelRepository.d.ts +18 -0
  24. package/dist/model/storage/SqliteModelRepository.d.ts.map +1 -0
  25. package/dist/node.js +1397 -0
  26. package/dist/node.js.map +32 -0
  27. package/dist/provider/AiProviderRegistry.d.ts +35 -0
  28. package/dist/provider/AiProviderRegistry.d.ts.map +1 -0
  29. package/dist/source/Document.d.ts +56 -0
  30. package/dist/source/Document.d.ts.map +1 -0
  31. package/dist/source/DocumentConverter.d.ts +15 -0
  32. package/dist/source/DocumentConverter.d.ts.map +1 -0
  33. package/dist/source/DocumentConverterMarkdown.d.ts +13 -0
  34. package/dist/source/DocumentConverterMarkdown.d.ts.map +1 -0
  35. package/dist/source/DocumentConverterText.d.ts +13 -0
  36. package/dist/source/DocumentConverterText.d.ts.map +1 -0
  37. package/dist/source/MasterDocument.d.ts +27 -0
  38. package/dist/source/MasterDocument.d.ts.map +1 -0
  39. package/dist/source/index.d.ts +10 -0
  40. package/dist/source/index.d.ts.map +1 -0
  41. package/dist/task/DocumentSplitterTask.d.ts +58 -0
  42. package/dist/task/DocumentSplitterTask.d.ts.map +1 -0
  43. package/dist/task/DownloadModelTask.d.ts +118 -0
  44. package/dist/task/DownloadModelTask.d.ts.map +1 -0
  45. package/dist/task/TextEmbeddingTask.d.ts +268 -0
  46. package/dist/task/TextEmbeddingTask.d.ts.map +1 -0
  47. package/dist/task/TextGenerationTask.d.ts +140 -0
  48. package/dist/task/TextGenerationTask.d.ts.map +1 -0
  49. package/dist/task/TextQuestionAnswerTask.d.ts +124 -0
  50. package/dist/task/TextQuestionAnswerTask.d.ts.map +1 -0
  51. package/dist/task/TextRewriterTask.d.ts +113 -0
  52. package/dist/task/TextRewriterTask.d.ts.map +1 -0
  53. package/dist/task/TextSummaryTask.d.ts +95 -0
  54. package/dist/task/TextSummaryTask.d.ts.map +1 -0
  55. package/dist/task/TextTranslationTask.d.ts +158 -0
  56. package/dist/task/TextTranslationTask.d.ts.map +1 -0
  57. package/dist/task/VectorSimilarityTask.d.ts +334 -0
  58. package/dist/task/VectorSimilarityTask.d.ts.map +1 -0
  59. package/dist/task/base/AiTask.d.ts +47 -0
  60. package/dist/task/base/AiTask.d.ts.map +1 -0
  61. package/dist/task/base/AiTaskSchemas.d.ts +156 -0
  62. package/dist/task/base/AiTaskSchemas.d.ts.map +1 -0
  63. package/dist/task/index.d.ts +17 -0
  64. package/dist/task/index.d.ts.map +1 -0
  65. package/dist/types.d.ts +11 -0
  66. package/dist/types.d.ts.map +1 -0
  67. package/package.json +67 -0
@@ -0,0 +1,118 @@
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
+ import { DeReplicateFromSchema } from "./base/AiTaskSchemas";
10
+ declare const DownloadModelInputSchema: {
11
+ readonly type: "object";
12
+ readonly properties: {
13
+ readonly model: {
14
+ readonly "x-replicate": true;
15
+ readonly format?: string | undefined;
16
+ readonly oneOf: readonly [{
17
+ readonly title: "Model";
18
+ readonly description: `The model ${string}`;
19
+ } & {
20
+ readonly format: "model";
21
+ readonly type: "string";
22
+ }, {
23
+ readonly type: "array";
24
+ readonly items: {
25
+ readonly title: "Model";
26
+ readonly description: `The model ${string}`;
27
+ } & {
28
+ readonly format: "model";
29
+ readonly type: "string";
30
+ };
31
+ }];
32
+ readonly title: string | undefined;
33
+ readonly description: string | undefined;
34
+ };
35
+ };
36
+ readonly required: readonly ["model"];
37
+ readonly additionalProperties: false;
38
+ };
39
+ declare const DownloadModelOutputSchema: {
40
+ readonly type: "object";
41
+ readonly properties: {
42
+ readonly model: {
43
+ readonly "x-replicate": true;
44
+ readonly format?: string | undefined;
45
+ readonly oneOf: readonly [{
46
+ readonly title: "Model";
47
+ readonly description: `The model ${string}`;
48
+ } & {
49
+ readonly format: "model";
50
+ readonly type: "string";
51
+ }, {
52
+ readonly type: "array";
53
+ readonly items: {
54
+ readonly title: "Model";
55
+ readonly description: `The model ${string}`;
56
+ } & {
57
+ readonly format: "model";
58
+ readonly type: "string";
59
+ };
60
+ }];
61
+ readonly title: string | undefined;
62
+ readonly description: string | undefined;
63
+ };
64
+ };
65
+ readonly required: readonly ["model"];
66
+ readonly additionalProperties: false;
67
+ };
68
+ export type DownloadModelTaskRunInput = FromSchema<typeof DownloadModelInputSchema>;
69
+ export type DownloadModelTaskRunOutput = FromSchema<typeof DownloadModelOutputSchema>;
70
+ export type DownloadModelTaskExecuteInput = DeReplicateFromSchema<typeof DownloadModelInputSchema>;
71
+ export type DownloadModelTaskExecuteOutput = DeReplicateFromSchema<typeof DownloadModelOutputSchema>;
72
+ /**
73
+ * Download a model from a remote source and cache it locally.
74
+ *
75
+ * @remarks
76
+ * This task has a side effect of downloading the model and caching it locally outside of the task system
77
+ */
78
+ export declare class DownloadModelTask extends AiTask<DownloadModelTaskRunInput, DownloadModelTaskRunOutput, JobQueueTaskConfig> {
79
+ static type: string;
80
+ static category: string;
81
+ static title: string;
82
+ static description: string;
83
+ static inputSchema(): DataPortSchema;
84
+ static outputSchema(): DataPortSchema;
85
+ static cacheable: boolean;
86
+ files: {
87
+ file: string;
88
+ progress: number;
89
+ }[];
90
+ constructor(input: Partial<DownloadModelTaskRunInput>, config?: JobQueueTaskConfig);
91
+ /**
92
+ * Handles progress updates for the download task
93
+ * @param progress - The progress value (0-100)
94
+ * @param message - The message to display
95
+ * @param details - Additional details about the progress
96
+ */
97
+ processProgress(progress: number, message?: string, details?: {
98
+ file?: string;
99
+ progress: number;
100
+ text?: number;
101
+ }): void;
102
+ }
103
+ /**
104
+ * Download a model from a remote source and cache it locally.
105
+ *
106
+ * @param input - Input containing model(s) to download
107
+ * @returns Promise resolving to the downloaded model(s)
108
+ */
109
+ export declare const DownloadModel: (input: DownloadModelTaskRunInput, config?: JobQueueTaskConfig) => Promise<{
110
+ model: string | string[];
111
+ }>;
112
+ declare module "@workglow/task-graph" {
113
+ interface Workflow {
114
+ DownloadModel: CreateWorkflow<DownloadModelTaskRunInput, DownloadModelTaskRunOutput, JobQueueTaskConfig>;
115
+ }
116
+ }
117
+ export {};
118
+ //# sourceMappingURL=DownloadModelTask.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"DownloadModelTask.d.ts","sourceRoot":"","sources":["../../src/task/DownloadModelTask.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;AACvC,OAAO,EAAE,qBAAqB,EAAiC,MAAM,sBAAsB,CAAC;AAI5F,QAAA,MAAM,wBAAwB;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAOK,CAAC;AAEpC,QAAA,MAAM,yBAAyB;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAOI,CAAC;AAEpC,MAAM,MAAM,yBAAyB,GAAG,UAAU,CAAC,OAAO,wBAAwB,CAAC,CAAC;AACpF,MAAM,MAAM,0BAA0B,GAAG,UAAU,CAAC,OAAO,yBAAyB,CAAC,CAAC;AACtF,MAAM,MAAM,6BAA6B,GAAG,qBAAqB,CAAC,OAAO,wBAAwB,CAAC,CAAC;AACnG,MAAM,MAAM,8BAA8B,GAAG,qBAAqB,CAChE,OAAO,yBAAyB,CACjC,CAAC;AAEF;;;;;GAKG;AACH,qBAAa,iBAAkB,SAAQ,MAAM,CAC3C,yBAAyB,EACzB,0BAA0B,EAC1B,kBAAkB,CACnB;IACC,OAAc,IAAI,SAAuB;IACzC,OAAc,QAAQ,SAAmB;IACzC,OAAc,KAAK,SAAoB;IACvC,OAAc,WAAW,SAAmE;WAC9E,WAAW,IAAI,cAAc;WAG7B,YAAY,IAAI,cAAc;IAG5C,OAAc,SAAS,UAAS;IAEzB,KAAK,EAAE;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,QAAQ,EAAE,MAAM,CAAA;KAAE,EAAE,CAAM;gBAE5C,KAAK,EAAE,OAAO,CAAC,yBAAyB,CAAC,EAAE,MAAM,GAAE,kBAAuB;IAQtF;;;;;OAKG;IACH,eAAe,CACb,QAAQ,EAAE,MAAM,EAChB,OAAO,GAAE,MAAW,EACpB,OAAO,CAAC,EAAE;QAAE,IAAI,CAAC,EAAE,MAAM,CAAC;QAAC,QAAQ,EAAE,MAAM,CAAC;QAAC,IAAI,CAAC,EAAE,MAAM,CAAA;KAAE,GAC3D,IAAI;CAaR;AAID;;;;;GAKG;AACH,eAAO,MAAM,aAAa,GAAI,OAAO,yBAAyB,EAAE,SAAS,kBAAkB;;EAE1F,CAAC;AAEF,OAAO,QAAQ,sBAAsB,CAAC;IACpC,UAAU,QAAQ;QAChB,aAAa,EAAE,cAAc,CAC3B,yBAAyB,EACzB,0BAA0B,EAC1B,kBAAkB,CACnB,CAAC;KACH;CACF"}
@@ -0,0 +1,268 @@
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
+ import { TypedArraySchemaOptions } from "./base/AiTaskSchemas";
10
+ export declare const TextEmbeddingInputSchema: {
11
+ readonly type: "object";
12
+ readonly properties: {
13
+ readonly text: {
14
+ readonly "x-replicate": true;
15
+ readonly format?: string | undefined;
16
+ readonly oneOf: readonly [{
17
+ type: "string";
18
+ title: string;
19
+ description: string;
20
+ }, {
21
+ readonly type: "array";
22
+ readonly items: {
23
+ type: "string";
24
+ title: string;
25
+ description: string;
26
+ };
27
+ }];
28
+ readonly title: string | undefined;
29
+ readonly description: string | undefined;
30
+ };
31
+ readonly model: {
32
+ readonly "x-replicate": true;
33
+ readonly format?: string | undefined;
34
+ readonly oneOf: readonly [{
35
+ readonly title: "Model";
36
+ readonly description: `The model ${string}`;
37
+ } & {
38
+ readonly format: "model:TextEmbeddingTask";
39
+ readonly type: "string";
40
+ }, {
41
+ readonly type: "array";
42
+ readonly items: {
43
+ readonly title: "Model";
44
+ readonly description: `The model ${string}`;
45
+ } & {
46
+ readonly format: "model:TextEmbeddingTask";
47
+ readonly type: "string";
48
+ };
49
+ }];
50
+ readonly title: string | undefined;
51
+ readonly description: string | undefined;
52
+ };
53
+ };
54
+ readonly required: readonly ["text", "model"];
55
+ readonly additionalProperties: false;
56
+ };
57
+ export declare const TextEmbeddingOutputSchema: {
58
+ readonly type: "object";
59
+ readonly properties: {
60
+ readonly vector: {
61
+ readonly "x-replicate": true;
62
+ readonly format?: string | undefined;
63
+ readonly oneOf: readonly [{
64
+ readonly oneOf: readonly [{
65
+ readonly type: "array";
66
+ readonly items: {
67
+ readonly type: "number";
68
+ readonly format: "Float64";
69
+ };
70
+ readonly title: "Float64Array";
71
+ readonly description: "A 64-bit floating point array";
72
+ readonly format: "Float64Array";
73
+ }, {
74
+ readonly type: "array";
75
+ readonly items: {
76
+ readonly type: "number";
77
+ readonly format: "Float32";
78
+ };
79
+ readonly title: "Float32Array";
80
+ readonly description: "A 32-bit floating point array";
81
+ readonly format: "Float32Array";
82
+ }, {
83
+ readonly type: "array";
84
+ readonly items: {
85
+ readonly type: "number";
86
+ readonly format: "Int32";
87
+ };
88
+ readonly title: "Int32Array";
89
+ readonly description: "A 32-bit integer array";
90
+ readonly format: "Int32Array";
91
+ }, {
92
+ readonly type: "array";
93
+ readonly items: {
94
+ readonly type: "number";
95
+ readonly format: "Int16";
96
+ };
97
+ readonly title: "Int16Array";
98
+ readonly description: "A 16-bit integer array";
99
+ readonly format: "Int16Array";
100
+ }, {
101
+ readonly type: "array";
102
+ readonly items: {
103
+ readonly type: "number";
104
+ readonly format: "Int8";
105
+ };
106
+ readonly title: "Int8Array";
107
+ }, {
108
+ readonly type: "array";
109
+ readonly items: {
110
+ readonly type: "number";
111
+ readonly format: "Uint8";
112
+ };
113
+ readonly title: "Uint8Array";
114
+ readonly description: "A 8-bit unsigned integer array";
115
+ readonly format: "Uint8Array";
116
+ }, {
117
+ readonly type: "array";
118
+ readonly items: {
119
+ readonly type: "number";
120
+ readonly format: "Uint16";
121
+ };
122
+ readonly title: "Uint16Array";
123
+ readonly description: "A 16-bit unsigned integer array";
124
+ readonly format: "Uint16Array";
125
+ }, {
126
+ readonly type: "array";
127
+ readonly items: {
128
+ readonly type: "number";
129
+ readonly format: "Uint32";
130
+ };
131
+ readonly title: "Uint32Array";
132
+ readonly description: "A 32-bit unsigned integer array";
133
+ readonly format: "Uint32Array";
134
+ }, {
135
+ readonly type: "array";
136
+ readonly items: {
137
+ readonly type: "number";
138
+ readonly format: "Uint8Clamped";
139
+ };
140
+ readonly title: "Uint8ClampedArray";
141
+ readonly description: "A 8-bit unsigned integer array with values clamped to 0-255";
142
+ readonly format: "Uint8ClampedArray";
143
+ }];
144
+ readonly format: "TypedArray";
145
+ }, {
146
+ readonly type: "array";
147
+ readonly items: {
148
+ readonly oneOf: readonly [{
149
+ readonly type: "array";
150
+ readonly items: {
151
+ readonly type: "number";
152
+ readonly format: "Float64";
153
+ };
154
+ readonly title: "Float64Array";
155
+ readonly description: "A 64-bit floating point array";
156
+ readonly format: "Float64Array";
157
+ }, {
158
+ readonly type: "array";
159
+ readonly items: {
160
+ readonly type: "number";
161
+ readonly format: "Float32";
162
+ };
163
+ readonly title: "Float32Array";
164
+ readonly description: "A 32-bit floating point array";
165
+ readonly format: "Float32Array";
166
+ }, {
167
+ readonly type: "array";
168
+ readonly items: {
169
+ readonly type: "number";
170
+ readonly format: "Int32";
171
+ };
172
+ readonly title: "Int32Array";
173
+ readonly description: "A 32-bit integer array";
174
+ readonly format: "Int32Array";
175
+ }, {
176
+ readonly type: "array";
177
+ readonly items: {
178
+ readonly type: "number";
179
+ readonly format: "Int16";
180
+ };
181
+ readonly title: "Int16Array";
182
+ readonly description: "A 16-bit integer array";
183
+ readonly format: "Int16Array";
184
+ }, {
185
+ readonly type: "array";
186
+ readonly items: {
187
+ readonly type: "number";
188
+ readonly format: "Int8";
189
+ };
190
+ readonly title: "Int8Array";
191
+ }, {
192
+ readonly type: "array";
193
+ readonly items: {
194
+ readonly type: "number";
195
+ readonly format: "Uint8";
196
+ };
197
+ readonly title: "Uint8Array";
198
+ readonly description: "A 8-bit unsigned integer array";
199
+ readonly format: "Uint8Array";
200
+ }, {
201
+ readonly type: "array";
202
+ readonly items: {
203
+ readonly type: "number";
204
+ readonly format: "Uint16";
205
+ };
206
+ readonly title: "Uint16Array";
207
+ readonly description: "A 16-bit unsigned integer array";
208
+ readonly format: "Uint16Array";
209
+ }, {
210
+ readonly type: "array";
211
+ readonly items: {
212
+ readonly type: "number";
213
+ readonly format: "Uint32";
214
+ };
215
+ readonly title: "Uint32Array";
216
+ readonly description: "A 32-bit unsigned integer array";
217
+ readonly format: "Uint32Array";
218
+ }, {
219
+ readonly type: "array";
220
+ readonly items: {
221
+ readonly type: "number";
222
+ readonly format: "Uint8Clamped";
223
+ };
224
+ readonly title: "Uint8ClampedArray";
225
+ readonly description: "A 8-bit unsigned integer array with values clamped to 0-255";
226
+ readonly format: "Uint8ClampedArray";
227
+ }];
228
+ readonly format: "TypedArray";
229
+ };
230
+ }];
231
+ readonly title: string | undefined;
232
+ readonly description: string | undefined;
233
+ };
234
+ };
235
+ readonly required: readonly ["vector"];
236
+ readonly additionalProperties: false;
237
+ };
238
+ export type TextEmbeddingTaskInput = FromSchema<typeof TextEmbeddingInputSchema, TypedArraySchemaOptions>;
239
+ export type TextEmbeddingTaskOutput = FromSchema<typeof TextEmbeddingOutputSchema, TypedArraySchemaOptions>;
240
+ /**
241
+ * A task that generates vector embeddings for text using a specified embedding model.
242
+ * Embeddings are numerical representations of text that capture semantic meaning,
243
+ * useful for similarity comparisons and semantic search.
244
+ *
245
+ * @extends AiTask
246
+ */
247
+ export declare class TextEmbeddingTask extends AiTask<TextEmbeddingTaskInput, TextEmbeddingTaskOutput> {
248
+ static type: string;
249
+ static category: string;
250
+ static title: string;
251
+ static description: string;
252
+ static inputSchema(): DataPortSchema;
253
+ static outputSchema(): DataPortSchema;
254
+ }
255
+ /**
256
+ * Convenience function to create and run a text embedding task.
257
+ * @param input - Input containing text(s) and model(s) for embedding
258
+ * @returns Promise resolving to the generated embeddings
259
+ */
260
+ export declare const TextEmbedding: (input: TextEmbeddingTaskInput, config?: JobQueueTaskConfig) => Promise<{
261
+ vector: import(".").TypedArray | import(".").TypedArray[];
262
+ }>;
263
+ declare module "@workglow/task-graph" {
264
+ interface Workflow {
265
+ TextEmbedding: CreateWorkflow<TextEmbeddingTaskInput, TextEmbeddingTaskOutput, JobQueueTaskConfig>;
266
+ }
267
+ }
268
+ //# sourceMappingURL=TextEmbeddingTask.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"TextEmbeddingTask.d.ts","sourceRoot":"","sources":["../../src/task/TextEmbeddingTask.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;AACvC,OAAO,EAEH,uBAAuB,EAG1B,MAAM,sBAAsB,CAAC;AAI9B,eAAO,MAAM,wBAAwB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAYF,CAAC;AAEpC,eAAO,MAAM,yBAAyB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAYH,CAAC;AAEpC,MAAM,MAAM,sBAAsB,GAAG,UAAU,CAC7C,OAAO,wBAAwB,EAC/B,uBAAuB,CACxB,CAAC;AACF,MAAM,MAAM,uBAAuB,GAAG,UAAU,CAC9C,OAAO,yBAAyB,EAChC,uBAAuB,CACxB,CAAC;AAEF;;;;;;GAMG;AACH,qBAAa,iBAAkB,SAAQ,MAAM,CAAC,sBAAsB,EAAE,uBAAuB,CAAC;IAC5F,OAAc,IAAI,SAAuB;IACzC,OAAc,QAAQ,SAAmB;IACzC,OAAc,KAAK,SAAoB;IACvC,OAAc,WAAW,SAAsE;WACjF,WAAW,IAAI,cAAc;WAG7B,YAAY,IAAI,cAAc;CAG7C;AAID;;;;GAIG;AACH,eAAO,MAAM,aAAa,GAAU,OAAO,sBAAsB,EAAE,SAAS,kBAAkB;;EAE7F,CAAC;AAEF,OAAO,QAAQ,sBAAsB,CAAC;IACpC,UAAU,QAAQ;QAChB,aAAa,EAAE,cAAc,CAC3B,sBAAsB,EACtB,uBAAuB,EACvB,kBAAkB,CACnB,CAAC;KACH;CACF"}
@@ -0,0 +1,140 @@
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 TextGenerationInputSchema: {
10
+ readonly type: "object";
11
+ readonly properties: {
12
+ readonly model: {
13
+ readonly "x-replicate": true;
14
+ readonly format?: string | undefined;
15
+ readonly oneOf: readonly [{
16
+ readonly title: "Model";
17
+ readonly description: `The model ${string}`;
18
+ } & {
19
+ readonly format: "model:TextGenerationTask";
20
+ readonly type: "string";
21
+ }, {
22
+ readonly type: "array";
23
+ readonly items: {
24
+ readonly title: "Model";
25
+ readonly description: `The model ${string}`;
26
+ } & {
27
+ readonly format: "model:TextGenerationTask";
28
+ readonly type: "string";
29
+ };
30
+ }];
31
+ readonly title: string | undefined;
32
+ readonly description: string | undefined;
33
+ };
34
+ readonly prompt: {
35
+ readonly "x-replicate": true;
36
+ readonly format?: string | undefined;
37
+ readonly oneOf: readonly [{
38
+ type: "string";
39
+ title: string;
40
+ description: string;
41
+ }, {
42
+ readonly type: "array";
43
+ readonly items: {
44
+ type: "string";
45
+ title: string;
46
+ description: string;
47
+ };
48
+ }];
49
+ readonly title: string | undefined;
50
+ readonly description: string | undefined;
51
+ };
52
+ readonly maxTokens: {
53
+ readonly type: "number";
54
+ readonly title: "Max Tokens";
55
+ readonly description: "The maximum number of tokens to generate";
56
+ readonly minimum: 1;
57
+ readonly maximum: 4096;
58
+ readonly "x-ui-group": "Configuration";
59
+ };
60
+ readonly temperature: {
61
+ readonly type: "number";
62
+ readonly title: "Temperature";
63
+ readonly description: "The temperature to use for sampling";
64
+ readonly minimum: 0;
65
+ readonly maximum: 2;
66
+ readonly "x-ui-group": "Configuration";
67
+ };
68
+ readonly topP: {
69
+ readonly type: "number";
70
+ readonly title: "Top-p";
71
+ readonly description: "The top-p value to use for sampling";
72
+ readonly minimum: 0;
73
+ readonly maximum: 1;
74
+ readonly "x-ui-group": "Configuration";
75
+ };
76
+ readonly frequencyPenalty: {
77
+ readonly type: "number";
78
+ readonly title: "Frequency Penalty";
79
+ readonly description: "The frequency penalty to use";
80
+ readonly minimum: -2;
81
+ readonly maximum: 2;
82
+ readonly "x-ui-group": "Configuration";
83
+ };
84
+ readonly presencePenalty: {
85
+ readonly type: "number";
86
+ readonly title: "Presence Penalty";
87
+ readonly description: "The presence penalty to use";
88
+ readonly minimum: -2;
89
+ readonly maximum: 2;
90
+ readonly "x-ui-group": "Configuration";
91
+ };
92
+ };
93
+ readonly required: readonly ["model", "prompt"];
94
+ readonly additionalProperties: false;
95
+ };
96
+ export declare const TextGenerationOutputSchema: {
97
+ readonly type: "object";
98
+ readonly properties: {
99
+ readonly text: {
100
+ readonly oneOf: readonly [{
101
+ readonly type: "string";
102
+ readonly title: "Text";
103
+ readonly description: "The generated text";
104
+ }, {
105
+ readonly type: "array";
106
+ readonly items: {
107
+ readonly type: "string";
108
+ readonly title: "Text";
109
+ readonly description: "The generated text";
110
+ };
111
+ }];
112
+ readonly title: "Text";
113
+ readonly description: "The generated text";
114
+ };
115
+ };
116
+ readonly required: readonly ["text"];
117
+ readonly additionalProperties: false;
118
+ };
119
+ export type TextGenerationTaskInput = FromSchema<typeof TextGenerationInputSchema>;
120
+ export type TextGenerationTaskOutput = FromSchema<typeof TextGenerationOutputSchema>;
121
+ export declare class TextGenerationTask extends AiTask<TextGenerationTaskInput, TextGenerationTaskOutput, JobQueueTaskConfig> {
122
+ static type: string;
123
+ static category: string;
124
+ static title: string;
125
+ static description: string;
126
+ static inputSchema(): DataPortSchema;
127
+ static outputSchema(): DataPortSchema;
128
+ }
129
+ /**
130
+ * Task for generating text using a language model
131
+ */
132
+ export declare const TextGeneration: (input: TextGenerationTaskInput, config?: JobQueueTaskConfig) => Promise<{
133
+ text: string | string[];
134
+ }>;
135
+ declare module "@workglow/task-graph" {
136
+ interface Workflow {
137
+ TextGeneration: CreateWorkflow<TextGenerationTaskInput, TextGenerationTaskOutput, JobQueueTaskConfig>;
138
+ }
139
+ }
140
+ //# sourceMappingURL=TextGenerationTask.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"TextGenerationTask.d.ts","sourceRoot":"","sources":["../../src/task/TextGenerationTask.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,yBAAyB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAoDH,CAAC;AAEpC,eAAO,MAAM,0BAA0B;;;;;;;;;;;;;;;;;;;;;;CAWJ,CAAC;AAEpC,MAAM,MAAM,uBAAuB,GAAG,UAAU,CAAC,OAAO,yBAAyB,CAAC,CAAC;AACnF,MAAM,MAAM,wBAAwB,GAAG,UAAU,CAAC,OAAO,0BAA0B,CAAC,CAAC;AAErF,qBAAa,kBAAmB,SAAQ,MAAM,CAC5C,uBAAuB,EACvB,wBAAwB,EACxB,kBAAkB,CACnB;IACC,OAAc,IAAI,SAAwB;IAC1C,OAAc,QAAQ,SAAmB;IACzC,OAAc,KAAK,SAAqB;IACxC,OAAc,WAAW,SAC2D;WACtE,WAAW,IAAI,cAAc;WAG7B,YAAY,IAAI,cAAc;CAG7C;AAGD;;GAEG;AACH,eAAO,MAAM,cAAc,GAAI,OAAO,uBAAuB,EAAE,SAAS,kBAAkB;;EAEzF,CAAC;AAEF,OAAO,QAAQ,sBAAsB,CAAC;IACpC,UAAU,QAAQ;QAChB,cAAc,EAAE,cAAc,CAC5B,uBAAuB,EACvB,wBAAwB,EACxB,kBAAkB,CACnB,CAAC;KACH;CACF"}
@@ -0,0 +1,124 @@
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 TextQuestionAnswerInputSchema: {
10
+ readonly type: "object";
11
+ readonly properties: {
12
+ readonly context: {
13
+ readonly "x-replicate": true;
14
+ readonly format?: string | undefined;
15
+ readonly oneOf: readonly [{
16
+ readonly type: "string";
17
+ readonly title: "Context";
18
+ readonly description: "The context of the question";
19
+ }, {
20
+ readonly type: "array";
21
+ readonly items: {
22
+ readonly type: "string";
23
+ readonly title: "Context";
24
+ readonly description: "The context of the question";
25
+ };
26
+ }];
27
+ readonly title: string | undefined;
28
+ readonly description: string | undefined;
29
+ };
30
+ readonly question: {
31
+ readonly "x-replicate": true;
32
+ readonly format?: string | undefined;
33
+ readonly oneOf: readonly [{
34
+ readonly type: "string";
35
+ readonly title: "Question";
36
+ readonly description: "The question to answer";
37
+ }, {
38
+ readonly type: "array";
39
+ readonly items: {
40
+ readonly type: "string";
41
+ readonly title: "Question";
42
+ readonly description: "The question to answer";
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:TextQuestionAnswerTask";
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:TextQuestionAnswerTask";
64
+ readonly type: "string";
65
+ };
66
+ }];
67
+ readonly title: string | undefined;
68
+ readonly description: string | undefined;
69
+ };
70
+ };
71
+ readonly required: readonly ["context", "question", "model"];
72
+ readonly additionalProperties: false;
73
+ };
74
+ export declare const TextQuestionAnswerOutputSchema: {
75
+ readonly type: "object";
76
+ readonly properties: {
77
+ readonly text: {
78
+ readonly oneOf: readonly [{
79
+ readonly type: "string";
80
+ readonly title: "Text";
81
+ readonly description: "The generated text";
82
+ }, {
83
+ readonly type: "array";
84
+ readonly items: {
85
+ readonly type: "string";
86
+ readonly title: "Text";
87
+ readonly description: "The generated text";
88
+ };
89
+ }];
90
+ readonly title: "Text";
91
+ readonly description: "The generated text";
92
+ };
93
+ };
94
+ readonly required: readonly ["text"];
95
+ readonly additionalProperties: false;
96
+ };
97
+ export type TextQuestionAnswerTaskInput = FromSchema<typeof TextQuestionAnswerInputSchema>;
98
+ export type TextQuestionAnswerTaskOutput = FromSchema<typeof TextQuestionAnswerOutputSchema>;
99
+ /**
100
+ * This is a special case of text generation that takes a context and a question
101
+ */
102
+ export declare class TextQuestionAnswerTask extends AiTask<TextQuestionAnswerTaskInput, TextQuestionAnswerTaskOutput, JobQueueTaskConfig> {
103
+ static type: string;
104
+ static category: string;
105
+ static title: string;
106
+ static description: string;
107
+ static inputSchema(): DataPortSchema;
108
+ static outputSchema(): DataPortSchema;
109
+ }
110
+ /**
111
+ * Convenience function to run text question answer tasks.
112
+ * Creates and executes a TextQuestionAnswerCompoundTask with the provided input.
113
+ * @param input The input parameters for text question answer (context, question, and model)
114
+ * @returns Promise resolving to the generated answer(s)
115
+ */
116
+ export declare const TextQuestionAnswer: (input: TextQuestionAnswerTaskInput, config?: JobQueueTaskConfig) => Promise<{
117
+ text: string | string[];
118
+ }>;
119
+ declare module "@workglow/task-graph" {
120
+ interface Workflow {
121
+ TextQuestionAnswer: CreateWorkflow<TextQuestionAnswerTaskInput, TextQuestionAnswerTaskOutput, JobQueueTaskConfig>;
122
+ }
123
+ }
124
+ //# sourceMappingURL=TextQuestionAnswerTask.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"TextQuestionAnswerTask.d.ts","sourceRoot":"","sources":["../../src/task/TextQuestionAnswerTask.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;AAuBvC,eAAO,MAAM,6BAA6B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CASP,CAAC;AAEpC,eAAO,MAAM,8BAA8B;;;;;;;;;;;;;;;;;;;;;;CAWR,CAAC;AAEpC,MAAM,MAAM,2BAA2B,GAAG,UAAU,CAAC,OAAO,6BAA6B,CAAC,CAAC;AAC3F,MAAM,MAAM,4BAA4B,GAAG,UAAU,CAAC,OAAO,8BAA8B,CAAC,CAAC;AAE7F;;GAEG;AACH,qBAAa,sBAAuB,SAAQ,MAAM,CAChD,2BAA2B,EAC3B,4BAA4B,EAC5B,kBAAkB,CACnB;IACC,OAAc,IAAI,SAA4B;IAC9C,OAAc,QAAQ,SAAmB;IACzC,OAAc,KAAK,SAA0B;IAC7C,OAAc,WAAW,SAAuE;WAClF,WAAW,IAAI,cAAc;WAG7B,YAAY,IAAI,cAAc;CAG7C;AAID;;;;;GAKG;AACH,eAAO,MAAM,kBAAkB,GAC7B,OAAO,2BAA2B,EAClC,SAAS,kBAAkB;;EAG5B,CAAC;AAEF,OAAO,QAAQ,sBAAsB,CAAC;IACpC,UAAU,QAAQ;QAChB,kBAAkB,EAAE,cAAc,CAChC,2BAA2B,EAC3B,4BAA4B,EAC5B,kBAAkB,CACnB,CAAC;KACH;CACF"}