@workglow/ai 0.0.70 → 0.0.72

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 (35) hide show
  1. package/dist/browser.js +987 -284
  2. package/dist/browser.js.map +16 -7
  3. package/dist/bun.js +987 -284
  4. package/dist/bun.js.map +16 -7
  5. package/dist/node.js +987 -284
  6. package/dist/node.js.map +16 -7
  7. package/dist/task/BackgroundRemovalTask.d.ts +351 -0
  8. package/dist/task/BackgroundRemovalTask.d.ts.map +1 -0
  9. package/dist/task/ImageClassificationTask.d.ts +410 -0
  10. package/dist/task/ImageClassificationTask.d.ts.map +1 -0
  11. package/dist/task/ImageEmbeddingTask.d.ts +503 -0
  12. package/dist/task/ImageEmbeddingTask.d.ts.map +1 -0
  13. package/dist/task/ImageSegmentationTask.d.ts +423 -0
  14. package/dist/task/ImageSegmentationTask.d.ts.map +1 -0
  15. package/dist/task/ImageToTextTask.d.ts +355 -0
  16. package/dist/task/ImageToTextTask.d.ts.map +1 -0
  17. package/dist/task/ObjectDetectionTask.d.ts +476 -0
  18. package/dist/task/ObjectDetectionTask.d.ts.map +1 -0
  19. package/dist/task/{TextClassifierTask.d.ts → TextClassificationTask.d.ts} +27 -19
  20. package/dist/task/TextClassificationTask.d.ts.map +1 -0
  21. package/dist/task/TextFillMaskTask.d.ts +202 -0
  22. package/dist/task/TextFillMaskTask.d.ts.map +1 -0
  23. package/dist/task/TextLanguageDetectionTask.d.ts +4 -7
  24. package/dist/task/TextLanguageDetectionTask.d.ts.map +1 -1
  25. package/dist/task/TextNamedEntityRecognitionTask.d.ts +212 -0
  26. package/dist/task/TextNamedEntityRecognitionTask.d.ts.map +1 -0
  27. package/dist/task/base/AiTask.d.ts.map +1 -1
  28. package/dist/task/base/AiTaskSchemas.d.ts +153 -0
  29. package/dist/task/base/AiTaskSchemas.d.ts.map +1 -1
  30. package/dist/task/base/AiVisionTask.d.ts +33 -0
  31. package/dist/task/base/AiVisionTask.d.ts.map +1 -0
  32. package/dist/task/index.d.ts +9 -1
  33. package/dist/task/index.d.ts.map +1 -1
  34. package/package.json +9 -9
  35. package/dist/task/TextClassifierTask.d.ts.map +0 -1
@@ -0,0 +1,503 @@
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 { DeReplicateFromSchema } from "./base/AiTaskSchemas";
9
+ import { AiVisionTask } from "./base/AiVisionTask";
10
+ export declare const ImageEmbeddingInputSchema: {
11
+ readonly type: "object";
12
+ readonly properties: {
13
+ readonly image: {
14
+ readonly "x-replicate": true;
15
+ readonly format?: string | undefined;
16
+ readonly oneOf: readonly [{
17
+ readonly oneOf: readonly [{
18
+ readonly type: "string";
19
+ readonly title: "Image Data";
20
+ readonly description: "Image as data-uri";
21
+ }, {
22
+ readonly type: "object";
23
+ readonly additionalProperties: false;
24
+ readonly properties: {
25
+ readonly data: {
26
+ readonly oneOf: readonly [{
27
+ readonly type: "object";
28
+ readonly format: "image:ImageBitmap";
29
+ readonly title: "ImageBitmap";
30
+ }, {
31
+ readonly type: "object";
32
+ readonly format: "image:OffscreenCanvas";
33
+ readonly title: "OffscreenCanvas";
34
+ }, {
35
+ readonly type: "object";
36
+ readonly format: "image:VideoFrame";
37
+ readonly title: "VideoFrame";
38
+ }, {
39
+ readonly type: "object";
40
+ readonly properties: {
41
+ readonly data: {
42
+ readonly type: "array";
43
+ readonly items: {
44
+ readonly type: "number";
45
+ readonly format: "Uint8Clamped";
46
+ };
47
+ readonly format: "Uint8ClampedArray";
48
+ readonly title: "Data";
49
+ readonly description: "Data of the image";
50
+ };
51
+ readonly width: {
52
+ readonly type: "number";
53
+ readonly title: "Width";
54
+ readonly description: "Width of the image";
55
+ };
56
+ readonly height: {
57
+ readonly type: "number";
58
+ readonly title: "Height";
59
+ readonly description: "Height of the image";
60
+ };
61
+ readonly channels: {
62
+ readonly type: "number";
63
+ readonly title: "Channels";
64
+ readonly description: "Channels of the image";
65
+ };
66
+ readonly rawChannels: {
67
+ readonly type: "number";
68
+ readonly title: "Raw Channels";
69
+ readonly description: "Raw channels of the image";
70
+ };
71
+ };
72
+ readonly additionalProperties: false;
73
+ readonly required: readonly ["data", "width", "height", "channels"];
74
+ readonly format: "image:ImageBinary";
75
+ readonly title: "ImageBinary";
76
+ }];
77
+ };
78
+ readonly width: {
79
+ readonly type: "number";
80
+ readonly title: "Width";
81
+ readonly description: "Width of the image";
82
+ };
83
+ readonly height: {
84
+ readonly type: "number";
85
+ readonly title: "Height";
86
+ readonly description: "Height of the image";
87
+ };
88
+ readonly channels: {
89
+ readonly type: "number";
90
+ readonly title: "Channels";
91
+ readonly description: "Channels of the image";
92
+ readonly minimum: 1;
93
+ readonly maximum: 4;
94
+ };
95
+ };
96
+ readonly required: readonly ["data", "width", "height", "channels"];
97
+ }];
98
+ readonly title: "Image";
99
+ readonly description: "Image as URL or base64-encoded data";
100
+ }, {
101
+ readonly type: "array";
102
+ readonly items: {
103
+ readonly oneOf: readonly [{
104
+ readonly type: "string";
105
+ readonly title: "Image Data";
106
+ readonly description: "Image as data-uri";
107
+ }, {
108
+ readonly type: "object";
109
+ readonly additionalProperties: false;
110
+ readonly properties: {
111
+ readonly data: {
112
+ readonly oneOf: readonly [{
113
+ readonly type: "object";
114
+ readonly format: "image:ImageBitmap";
115
+ readonly title: "ImageBitmap";
116
+ }, {
117
+ readonly type: "object";
118
+ readonly format: "image:OffscreenCanvas";
119
+ readonly title: "OffscreenCanvas";
120
+ }, {
121
+ readonly type: "object";
122
+ readonly format: "image:VideoFrame";
123
+ readonly title: "VideoFrame";
124
+ }, {
125
+ readonly type: "object";
126
+ readonly properties: {
127
+ readonly data: {
128
+ readonly type: "array";
129
+ readonly items: {
130
+ readonly type: "number";
131
+ readonly format: "Uint8Clamped";
132
+ };
133
+ readonly format: "Uint8ClampedArray";
134
+ readonly title: "Data";
135
+ readonly description: "Data of the image";
136
+ };
137
+ readonly width: {
138
+ readonly type: "number";
139
+ readonly title: "Width";
140
+ readonly description: "Width of the image";
141
+ };
142
+ readonly height: {
143
+ readonly type: "number";
144
+ readonly title: "Height";
145
+ readonly description: "Height of the image";
146
+ };
147
+ readonly channels: {
148
+ readonly type: "number";
149
+ readonly title: "Channels";
150
+ readonly description: "Channels of the image";
151
+ };
152
+ readonly rawChannels: {
153
+ readonly type: "number";
154
+ readonly title: "Raw Channels";
155
+ readonly description: "Raw channels of the image";
156
+ };
157
+ };
158
+ readonly additionalProperties: false;
159
+ readonly required: readonly ["data", "width", "height", "channels"];
160
+ readonly format: "image:ImageBinary";
161
+ readonly title: "ImageBinary";
162
+ }];
163
+ };
164
+ readonly width: {
165
+ readonly type: "number";
166
+ readonly title: "Width";
167
+ readonly description: "Width of the image";
168
+ };
169
+ readonly height: {
170
+ readonly type: "number";
171
+ readonly title: "Height";
172
+ readonly description: "Height of the image";
173
+ };
174
+ readonly channels: {
175
+ readonly type: "number";
176
+ readonly title: "Channels";
177
+ readonly description: "Channels of the image";
178
+ readonly minimum: 1;
179
+ readonly maximum: 4;
180
+ };
181
+ };
182
+ readonly required: readonly ["data", "width", "height", "channels"];
183
+ }];
184
+ readonly title: "Image";
185
+ readonly description: "Image as URL or base64-encoded data";
186
+ };
187
+ }];
188
+ readonly title: string | undefined;
189
+ readonly description: string | undefined;
190
+ };
191
+ readonly model: {
192
+ readonly "x-replicate": true;
193
+ readonly format?: string | undefined;
194
+ readonly oneOf: readonly [{
195
+ readonly oneOf: readonly [{
196
+ readonly title: "Model";
197
+ readonly description: `The model ${string}`;
198
+ } & {
199
+ readonly format: import(".").TypeModelSemantic;
200
+ readonly type: "string";
201
+ }, {
202
+ readonly type: "object";
203
+ readonly properties: {
204
+ readonly model_id: {
205
+ readonly type: "string";
206
+ };
207
+ readonly tasks: {
208
+ readonly type: "array";
209
+ readonly items: {
210
+ readonly type: "string";
211
+ };
212
+ };
213
+ readonly title: {
214
+ readonly type: "string";
215
+ };
216
+ readonly description: {
217
+ readonly type: "string";
218
+ };
219
+ readonly provider: {
220
+ readonly type: "string";
221
+ };
222
+ readonly providerConfig: {
223
+ readonly type: "object";
224
+ readonly default: {};
225
+ };
226
+ readonly metadata: {
227
+ readonly type: "object";
228
+ readonly default: {};
229
+ };
230
+ };
231
+ readonly required: readonly ["model_id", "tasks", "provider", "title", "description", "providerConfig", "metadata"];
232
+ readonly format: "model";
233
+ readonly additionalProperties: false;
234
+ } & {
235
+ readonly format: import(".").TypeModelSemantic;
236
+ }];
237
+ } & {
238
+ readonly format: import(".").TypeModelSemantic;
239
+ }, {
240
+ readonly type: "array";
241
+ readonly items: {
242
+ readonly oneOf: readonly [{
243
+ readonly title: "Model";
244
+ readonly description: `The model ${string}`;
245
+ } & {
246
+ readonly format: import(".").TypeModelSemantic;
247
+ readonly type: "string";
248
+ }, {
249
+ readonly type: "object";
250
+ readonly properties: {
251
+ readonly model_id: {
252
+ readonly type: "string";
253
+ };
254
+ readonly tasks: {
255
+ readonly type: "array";
256
+ readonly items: {
257
+ readonly type: "string";
258
+ };
259
+ };
260
+ readonly title: {
261
+ readonly type: "string";
262
+ };
263
+ readonly description: {
264
+ readonly type: "string";
265
+ };
266
+ readonly provider: {
267
+ readonly type: "string";
268
+ };
269
+ readonly providerConfig: {
270
+ readonly type: "object";
271
+ readonly default: {};
272
+ };
273
+ readonly metadata: {
274
+ readonly type: "object";
275
+ readonly default: {};
276
+ };
277
+ };
278
+ readonly required: readonly ["model_id", "tasks", "provider", "title", "description", "providerConfig", "metadata"];
279
+ readonly format: "model";
280
+ readonly additionalProperties: false;
281
+ } & {
282
+ readonly format: import(".").TypeModelSemantic;
283
+ }];
284
+ } & {
285
+ readonly format: import(".").TypeModelSemantic;
286
+ };
287
+ }];
288
+ readonly title: string | undefined;
289
+ readonly description: string | undefined;
290
+ };
291
+ };
292
+ readonly required: readonly ["image", "model"];
293
+ readonly additionalProperties: false;
294
+ };
295
+ export declare const ImageEmbeddingOutputSchema: {
296
+ readonly type: "object";
297
+ readonly properties: {
298
+ readonly vector: {
299
+ readonly oneOf: readonly [{
300
+ readonly oneOf: readonly [{
301
+ readonly type: "array";
302
+ readonly items: {
303
+ readonly type: "number";
304
+ readonly format: "Float64";
305
+ };
306
+ readonly title: "Float64Array";
307
+ readonly description: "A 64-bit floating point array";
308
+ readonly format: "Float64Array";
309
+ }, {
310
+ readonly type: "array";
311
+ readonly items: {
312
+ readonly type: "number";
313
+ readonly format: "Float32";
314
+ };
315
+ readonly title: "Float32Array";
316
+ readonly description: "A 32-bit floating point array";
317
+ readonly format: "Float32Array";
318
+ }, {
319
+ readonly type: "array";
320
+ readonly items: {
321
+ readonly type: "number";
322
+ readonly format: "Int32";
323
+ };
324
+ readonly title: "Int32Array";
325
+ readonly description: "A 32-bit integer array";
326
+ readonly format: "Int32Array";
327
+ }, {
328
+ readonly type: "array";
329
+ readonly items: {
330
+ readonly type: "number";
331
+ readonly format: "Int16";
332
+ };
333
+ readonly title: "Int16Array";
334
+ readonly description: "A 16-bit integer array";
335
+ readonly format: "Int16Array";
336
+ }, {
337
+ readonly type: "array";
338
+ readonly items: {
339
+ readonly type: "number";
340
+ readonly format: "Int8";
341
+ };
342
+ readonly title: "Int8Array";
343
+ }, {
344
+ readonly type: "array";
345
+ readonly items: {
346
+ readonly type: "number";
347
+ readonly format: "Uint8";
348
+ };
349
+ readonly title: "Uint8Array";
350
+ readonly description: "A 8-bit unsigned integer array";
351
+ readonly format: "Uint8Array";
352
+ }, {
353
+ readonly type: "array";
354
+ readonly items: {
355
+ readonly type: "number";
356
+ readonly format: "Uint16";
357
+ };
358
+ readonly title: "Uint16Array";
359
+ readonly description: "A 16-bit unsigned integer array";
360
+ readonly format: "Uint16Array";
361
+ }, {
362
+ readonly type: "array";
363
+ readonly items: {
364
+ readonly type: "number";
365
+ readonly format: "Uint32";
366
+ };
367
+ readonly title: "Uint32Array";
368
+ readonly description: "A 32-bit unsigned integer array";
369
+ readonly format: "Uint32Array";
370
+ }, {
371
+ readonly type: "array";
372
+ readonly items: {
373
+ readonly type: "number";
374
+ readonly format: "Uint8Clamped";
375
+ };
376
+ readonly title: "Uint8ClampedArray";
377
+ readonly description: "A 8-bit unsigned integer array with values clamped to 0-255";
378
+ readonly format: "Uint8ClampedArray";
379
+ }];
380
+ readonly format: "TypedArray";
381
+ }, {
382
+ readonly type: "array";
383
+ readonly items: {
384
+ readonly oneOf: readonly [{
385
+ readonly type: "array";
386
+ readonly items: {
387
+ readonly type: "number";
388
+ readonly format: "Float64";
389
+ };
390
+ readonly title: "Float64Array";
391
+ readonly description: "A 64-bit floating point array";
392
+ readonly format: "Float64Array";
393
+ }, {
394
+ readonly type: "array";
395
+ readonly items: {
396
+ readonly type: "number";
397
+ readonly format: "Float32";
398
+ };
399
+ readonly title: "Float32Array";
400
+ readonly description: "A 32-bit floating point array";
401
+ readonly format: "Float32Array";
402
+ }, {
403
+ readonly type: "array";
404
+ readonly items: {
405
+ readonly type: "number";
406
+ readonly format: "Int32";
407
+ };
408
+ readonly title: "Int32Array";
409
+ readonly description: "A 32-bit integer array";
410
+ readonly format: "Int32Array";
411
+ }, {
412
+ readonly type: "array";
413
+ readonly items: {
414
+ readonly type: "number";
415
+ readonly format: "Int16";
416
+ };
417
+ readonly title: "Int16Array";
418
+ readonly description: "A 16-bit integer array";
419
+ readonly format: "Int16Array";
420
+ }, {
421
+ readonly type: "array";
422
+ readonly items: {
423
+ readonly type: "number";
424
+ readonly format: "Int8";
425
+ };
426
+ readonly title: "Int8Array";
427
+ }, {
428
+ readonly type: "array";
429
+ readonly items: {
430
+ readonly type: "number";
431
+ readonly format: "Uint8";
432
+ };
433
+ readonly title: "Uint8Array";
434
+ readonly description: "A 8-bit unsigned integer array";
435
+ readonly format: "Uint8Array";
436
+ }, {
437
+ readonly type: "array";
438
+ readonly items: {
439
+ readonly type: "number";
440
+ readonly format: "Uint16";
441
+ };
442
+ readonly title: "Uint16Array";
443
+ readonly description: "A 16-bit unsigned integer array";
444
+ readonly format: "Uint16Array";
445
+ }, {
446
+ readonly type: "array";
447
+ readonly items: {
448
+ readonly type: "number";
449
+ readonly format: "Uint32";
450
+ };
451
+ readonly title: "Uint32Array";
452
+ readonly description: "A 32-bit unsigned integer array";
453
+ readonly format: "Uint32Array";
454
+ }, {
455
+ readonly type: "array";
456
+ readonly items: {
457
+ readonly type: "number";
458
+ readonly format: "Uint8Clamped";
459
+ };
460
+ readonly title: "Uint8ClampedArray";
461
+ readonly description: "A 8-bit unsigned integer array with values clamped to 0-255";
462
+ readonly format: "Uint8ClampedArray";
463
+ }];
464
+ readonly format: "TypedArray";
465
+ };
466
+ }];
467
+ readonly title: "Embedding";
468
+ readonly description: "The image embedding vector";
469
+ };
470
+ };
471
+ readonly required: readonly ["vector"];
472
+ readonly additionalProperties: false;
473
+ };
474
+ export type ImageEmbeddingTaskInput = FromSchema<typeof ImageEmbeddingInputSchema>;
475
+ export type ImageEmbeddingTaskOutput = FromSchema<typeof ImageEmbeddingOutputSchema>;
476
+ export type ImageEmbeddingTaskExecuteInput = DeReplicateFromSchema<typeof ImageEmbeddingInputSchema>;
477
+ export type ImageEmbeddingTaskExecuteOutput = DeReplicateFromSchema<typeof ImageEmbeddingOutputSchema>;
478
+ /**
479
+ * Generates embeddings from images using vision models
480
+ */
481
+ export declare class ImageEmbeddingTask extends AiVisionTask<ImageEmbeddingTaskInput, ImageEmbeddingTaskOutput, JobQueueTaskConfig> {
482
+ static type: string;
483
+ static category: string;
484
+ static title: string;
485
+ static description: string;
486
+ static inputSchema(): DataPortSchema;
487
+ static outputSchema(): DataPortSchema;
488
+ }
489
+ /**
490
+ * Convenience function to run image embedding tasks.
491
+ * Creates and executes an ImageEmbeddingTask with the provided input.
492
+ * @param input The input parameters for image embedding (image and model)
493
+ * @returns Promise resolving to the image embedding vector
494
+ */
495
+ export declare const ImageEmbedding: (input: ImageEmbeddingTaskInput, config?: JobQueueTaskConfig) => Promise<{
496
+ vector: number[] | number[][];
497
+ }>;
498
+ declare module "@workglow/task-graph" {
499
+ interface Workflow {
500
+ ImageEmbedding: CreateWorkflow<ImageEmbeddingTaskInput, ImageEmbeddingTaskOutput, JobQueueTaskConfig>;
501
+ }
502
+ }
503
+ //# sourceMappingURL=ImageEmbeddingTask.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ImageEmbeddingTask.d.ts","sourceRoot":"","sources":["../../src/task/ImageEmbeddingTask.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,EACL,qBAAqB,EAKtB,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AASnD,eAAO,MAAM,yBAAyB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAQH,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;AACrF,MAAM,MAAM,8BAA8B,GAAG,qBAAqB,CAChE,OAAO,yBAAyB,CACjC,CAAC;AACF,MAAM,MAAM,+BAA+B,GAAG,qBAAqB,CACjE,OAAO,0BAA0B,CAClC,CAAC;AAEF;;GAEG;AACH,qBAAa,kBAAmB,SAAQ,YAAY,CAClD,uBAAuB,EACvB,wBAAwB,EACxB,kBAAkB,CACnB;IACC,OAAc,IAAI,SAAwB;IAC1C,OAAc,QAAQ,SAAqB;IAC3C,OAAc,KAAK,SAAqB;IACxC,OAAc,WAAW,SAA0D;WACrE,WAAW,IAAI,cAAc;WAG7B,YAAY,IAAI,cAAc;CAG7C;AAID;;;;;GAKG;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"}