@workglow/ai 0.0.71 → 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 (31) hide show
  1. package/dist/browser.js +779 -218
  2. package/dist/browser.js.map +15 -8
  3. package/dist/bun.js +779 -218
  4. package/dist/bun.js.map +15 -8
  5. package/dist/node.js +779 -218
  6. package/dist/node.js.map +15 -8
  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} +23 -12
  20. package/dist/task/TextClassificationTask.d.ts.map +1 -0
  21. package/dist/task/TextFillMaskTask.d.ts.map +1 -1
  22. package/dist/task/TextNamedEntityRecognitionTask.d.ts.map +1 -1
  23. package/dist/task/base/AiTask.d.ts.map +1 -1
  24. package/dist/task/base/AiTaskSchemas.d.ts +153 -0
  25. package/dist/task/base/AiTaskSchemas.d.ts.map +1 -1
  26. package/dist/task/base/AiVisionTask.d.ts +33 -0
  27. package/dist/task/base/AiVisionTask.d.ts.map +1 -0
  28. package/dist/task/index.d.ts +7 -1
  29. package/dist/task/index.d.ts.map +1 -1
  30. package/package.json +9 -9
  31. package/dist/task/TextClassifierTask.d.ts.map +0 -1
@@ -0,0 +1,476 @@
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 ObjectDetectionInputSchema: {
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
+ readonly labels: {
292
+ readonly type: "array";
293
+ readonly items: {
294
+ readonly type: "string";
295
+ };
296
+ readonly title: "Labels";
297
+ readonly description: "List of object labels to detect (optional, if provided uses zero-shot detection)";
298
+ readonly "x-ui-group": "Configuration";
299
+ };
300
+ readonly threshold: {
301
+ readonly type: "number";
302
+ readonly title: "Threshold";
303
+ readonly description: "The threshold for filtering detections by score";
304
+ readonly minimum: 0;
305
+ readonly maximum: 1;
306
+ readonly default: 0.5;
307
+ readonly "x-ui-group": "Configuration";
308
+ };
309
+ };
310
+ readonly required: readonly ["image", "model"];
311
+ readonly additionalProperties: false;
312
+ };
313
+ export declare const ObjectDetectionOutputSchema: {
314
+ readonly type: "object";
315
+ readonly properties: {
316
+ readonly detections: {
317
+ readonly oneOf: readonly [{
318
+ readonly type: "array";
319
+ readonly items: {
320
+ readonly type: "object";
321
+ readonly properties: {
322
+ readonly label: {
323
+ readonly type: "string";
324
+ readonly title: "Label";
325
+ readonly description: "The label of the detected object";
326
+ };
327
+ readonly score: {
328
+ readonly type: "number";
329
+ readonly title: "Confidence Score";
330
+ readonly description: "The confidence score for this detection";
331
+ readonly minimum: 0;
332
+ readonly maximum: 1;
333
+ };
334
+ readonly box: {
335
+ readonly type: "object";
336
+ readonly properties: {
337
+ readonly x: {
338
+ readonly type: "number";
339
+ readonly title: "X coordinate";
340
+ readonly description: "Left edge of the bounding box";
341
+ };
342
+ readonly y: {
343
+ readonly type: "number";
344
+ readonly title: "Y coordinate";
345
+ readonly description: "Top edge of the bounding box";
346
+ };
347
+ readonly width: {
348
+ readonly type: "number";
349
+ readonly title: "Width";
350
+ readonly description: "Width of the bounding box";
351
+ };
352
+ readonly height: {
353
+ readonly type: "number";
354
+ readonly title: "Height";
355
+ readonly description: "Height of the bounding box";
356
+ };
357
+ };
358
+ readonly required: readonly ["x", "y", "width", "height"];
359
+ readonly additionalProperties: false;
360
+ readonly title: "Bounding Box";
361
+ readonly description: "Bounding box coordinates";
362
+ };
363
+ };
364
+ readonly required: readonly ["label", "score", "box"];
365
+ readonly additionalProperties: false;
366
+ };
367
+ }, {
368
+ readonly type: "array";
369
+ readonly items: {
370
+ readonly type: "array";
371
+ readonly items: {
372
+ readonly type: "object";
373
+ readonly properties: {
374
+ readonly label: {
375
+ readonly type: "string";
376
+ readonly title: "Label";
377
+ readonly description: "The label of the detected object";
378
+ };
379
+ readonly score: {
380
+ readonly type: "number";
381
+ readonly title: "Confidence Score";
382
+ readonly description: "The confidence score for this detection";
383
+ readonly minimum: 0;
384
+ readonly maximum: 1;
385
+ };
386
+ readonly box: {
387
+ readonly type: "object";
388
+ readonly properties: {
389
+ readonly x: {
390
+ readonly type: "number";
391
+ readonly title: "X coordinate";
392
+ readonly description: "Left edge of the bounding box";
393
+ };
394
+ readonly y: {
395
+ readonly type: "number";
396
+ readonly title: "Y coordinate";
397
+ readonly description: "Top edge of the bounding box";
398
+ };
399
+ readonly width: {
400
+ readonly type: "number";
401
+ readonly title: "Width";
402
+ readonly description: "Width of the bounding box";
403
+ };
404
+ readonly height: {
405
+ readonly type: "number";
406
+ readonly title: "Height";
407
+ readonly description: "Height of the bounding box";
408
+ };
409
+ };
410
+ readonly required: readonly ["x", "y", "width", "height"];
411
+ readonly additionalProperties: false;
412
+ readonly title: "Bounding Box";
413
+ readonly description: "Bounding box coordinates";
414
+ };
415
+ };
416
+ readonly required: readonly ["label", "score", "box"];
417
+ readonly additionalProperties: false;
418
+ };
419
+ };
420
+ }];
421
+ readonly title: "Detections";
422
+ readonly description: "The detected objects with their labels, scores, and bounding boxes";
423
+ };
424
+ };
425
+ readonly required: readonly ["detections"];
426
+ readonly additionalProperties: false;
427
+ };
428
+ export type ObjectDetectionTaskInput = FromSchema<typeof ObjectDetectionInputSchema>;
429
+ export type ObjectDetectionTaskOutput = FromSchema<typeof ObjectDetectionOutputSchema>;
430
+ export type ObjectDetectionTaskExecuteInput = DeReplicateFromSchema<typeof ObjectDetectionInputSchema>;
431
+ export type ObjectDetectionTaskExecuteOutput = DeReplicateFromSchema<typeof ObjectDetectionOutputSchema>;
432
+ /**
433
+ * Detects objects in images using vision models.
434
+ * Automatically selects between regular and zero-shot detection based on whether labels are provided.
435
+ */
436
+ export declare class ObjectDetectionTask extends AiVisionTask<ObjectDetectionTaskInput, ObjectDetectionTaskOutput, JobQueueTaskConfig> {
437
+ static type: string;
438
+ static category: string;
439
+ static title: string;
440
+ static description: string;
441
+ static inputSchema(): DataPortSchema;
442
+ static outputSchema(): DataPortSchema;
443
+ }
444
+ /**
445
+ * Convenience function to run object detection tasks.
446
+ * Creates and executes an ObjectDetectionTask with the provided input.
447
+ * @param input The input parameters for object detection (image, model, and optional labels)
448
+ * @returns Promise resolving to the detected objects with labels, scores, and bounding boxes
449
+ */
450
+ export declare const ObjectDetection: (input: ObjectDetectionTaskInput, config?: JobQueueTaskConfig) => Promise<{
451
+ detections: {
452
+ score: number;
453
+ label: string;
454
+ box: {
455
+ width: number;
456
+ height: number;
457
+ x: number;
458
+ y: number;
459
+ };
460
+ }[] | {
461
+ score: number;
462
+ label: string;
463
+ box: {
464
+ width: number;
465
+ height: number;
466
+ x: number;
467
+ y: number;
468
+ };
469
+ }[][];
470
+ }>;
471
+ declare module "@workglow/task-graph" {
472
+ interface Workflow {
473
+ ObjectDetection: CreateWorkflow<ObjectDetectionTaskInput, ObjectDetectionTaskOutput, JobQueueTaskConfig>;
474
+ }
475
+ }
476
+ //# sourceMappingURL=ObjectDetectionTask.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ObjectDetectionTask.d.ts","sourceRoot":"","sources":["../../src/task/ObjectDetectionTask.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;AAyBnD,eAAO,MAAM,0BAA0B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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+7,7 @@ import { CreateWorkflow, JobQueueTaskConfig } from "@workglow/task-graph";
7
7
  import { DataPortSchema, FromSchema } from "@workglow/util";
8
8
  import { AiTask } from "./base/AiTask";
9
9
  import { DeReplicateFromSchema } from "./base/AiTaskSchemas";
10
- export declare const TextClassifierInputSchema: {
10
+ export declare const TextClassificationInputSchema: {
11
11
  readonly type: "object";
12
12
  readonly properties: {
13
13
  readonly text: {
@@ -28,6 +28,15 @@ export declare const TextClassifierInputSchema: {
28
28
  readonly title: string | undefined;
29
29
  readonly description: string | undefined;
30
30
  };
31
+ readonly candidateLabels: {
32
+ readonly type: "array";
33
+ readonly items: {
34
+ readonly type: "string";
35
+ };
36
+ readonly title: "Candidate Labels";
37
+ readonly description: "List of candidate labels (optional, if provided uses zero-shot classification)";
38
+ readonly "x-ui-group": "Configuration";
39
+ };
31
40
  readonly maxCategories: {
32
41
  readonly type: "number";
33
42
  readonly minimum: 1;
@@ -35,6 +44,7 @@ export declare const TextClassifierInputSchema: {
35
44
  readonly default: 5;
36
45
  readonly title: "Max Categories";
37
46
  readonly description: "The maximum number of categories to return";
47
+ readonly "x-ui-group": "Configuration";
38
48
  };
39
49
  readonly model: {
40
50
  readonly "x-replicate": true;
@@ -140,7 +150,7 @@ export declare const TextClassifierInputSchema: {
140
150
  readonly required: readonly ["text", "model"];
141
151
  readonly additionalProperties: false;
142
152
  };
143
- export declare const TextClassifierOutputSchema: {
153
+ export declare const TextClassificationOutputSchema: {
144
154
  readonly type: "object";
145
155
  readonly properties: {
146
156
  readonly categories: {
@@ -169,14 +179,15 @@ export declare const TextClassifierOutputSchema: {
169
179
  readonly required: readonly ["categories"];
170
180
  readonly additionalProperties: false;
171
181
  };
172
- export type TextClassifierTaskInput = FromSchema<typeof TextClassifierInputSchema>;
173
- export type TextClassifierTaskOutput = FromSchema<typeof TextClassifierOutputSchema>;
174
- export type TextClassifierTaskExecuteInput = DeReplicateFromSchema<typeof TextClassifierInputSchema>;
175
- export type TextClassifierTaskExecuteOutput = DeReplicateFromSchema<typeof TextClassifierOutputSchema>;
182
+ export type TextClassificationTaskInput = FromSchema<typeof TextClassificationInputSchema>;
183
+ export type TextClassificationTaskOutput = FromSchema<typeof TextClassificationOutputSchema>;
184
+ export type TextClassificationTaskExecuteInput = DeReplicateFromSchema<typeof TextClassificationInputSchema>;
185
+ export type TextClassificationTaskExecuteOutput = DeReplicateFromSchema<typeof TextClassificationOutputSchema>;
176
186
  /**
177
- * Classifies text into predefined categories using language models
187
+ * Classifies text into categories using language models.
188
+ * Automatically selects between regular and zero-shot classification based on whether candidate labels are provided.
178
189
  */
179
- export declare class TextClassifierTask extends AiTask<TextClassifierTaskInput, TextClassifierTaskOutput> {
190
+ export declare class TextClassificationTask extends AiTask<TextClassificationTaskInput, TextClassificationTaskOutput> {
180
191
  static type: string;
181
192
  static category: string;
182
193
  static title: string;
@@ -186,11 +197,11 @@ export declare class TextClassifierTask extends AiTask<TextClassifierTaskInput,
186
197
  }
187
198
  /**
188
199
  * Convenience function to run text classifier tasks.
189
- * Creates and executes a TextClassifierTask with the provided input.
200
+ * Creates and executes a TextClassificationTask with the provided input.
190
201
  * @param input The input parameters for text classification (text and model)
191
202
  * @returns Promise resolving to the classification categories with scores
192
203
  */
193
- export declare const TextClassifier: (input: TextClassifierTaskInput, config?: JobQueueTaskConfig) => Promise<{
204
+ export declare const TextClassification: (input: TextClassificationTaskInput, config?: JobQueueTaskConfig) => Promise<{
194
205
  categories: {
195
206
  score: number;
196
207
  label: string;
@@ -198,7 +209,7 @@ export declare const TextClassifier: (input: TextClassifierTaskInput, config?: J
198
209
  }>;
199
210
  declare module "@workglow/task-graph" {
200
211
  interface Workflow {
201
- TextClassifier: CreateWorkflow<TextClassifierTaskInput, TextClassifierTaskOutput, JobQueueTaskConfig>;
212
+ TextClassification: CreateWorkflow<TextClassificationTaskInput, TextClassificationTaskOutput, JobQueueTaskConfig>;
202
213
  }
203
214
  }
204
- //# sourceMappingURL=TextClassifierTask.d.ts.map
215
+ //# sourceMappingURL=TextClassificationTask.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"TextClassificationTask.d.ts","sourceRoot":"","sources":["../../src/task/TextClassificationTask.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,eAAO,MAAM,6BAA6B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA8BP,CAAC;AAEpC,eAAO,MAAM,8BAA8B;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA4BR,CAAC;AAEpC,MAAM,MAAM,2BAA2B,GAAG,UAAU,CAAC,OAAO,6BAA6B,CAAC,CAAC;AAC3F,MAAM,MAAM,4BAA4B,GAAG,UAAU,CAAC,OAAO,8BAA8B,CAAC,CAAC;AAC7F,MAAM,MAAM,kCAAkC,GAAG,qBAAqB,CACpE,OAAO,6BAA6B,CACrC,CAAC;AACF,MAAM,MAAM,mCAAmC,GAAG,qBAAqB,CACrE,OAAO,8BAA8B,CACtC,CAAC;AAEF;;;GAGG;AACH,qBAAa,sBAAuB,SAAQ,MAAM,CAChD,2BAA2B,EAC3B,4BAA4B,CAC7B;IACC,OAAc,IAAI,SAA4B;IAC9C,OAAc,QAAQ,SAAmB;IACzC,OAAc,KAAK,SAAqB;IACxC,OAAc,WAAW,SACwG;WACnH,WAAW,IAAI,cAAc;WAG7B,YAAY,IAAI,cAAc;CAG7C;AAID;;;;;GAKG;AACH,eAAO,MAAM,kBA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