@workglow/ai 0.0.84 → 0.0.86

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 (114) hide show
  1. package/README.md +166 -35
  2. package/dist/browser.js +3947 -1449
  3. package/dist/browser.js.map +49 -38
  4. package/dist/bun.js +3947 -1449
  5. package/dist/bun.js.map +49 -38
  6. package/dist/common.d.ts +0 -3
  7. package/dist/common.d.ts.map +1 -1
  8. package/dist/model/ModelRegistry.d.ts +2 -2
  9. package/dist/model/ModelRegistry.d.ts.map +1 -1
  10. package/dist/model/ModelRepository.d.ts +3 -3
  11. package/dist/model/ModelRepository.d.ts.map +1 -1
  12. package/dist/node.js +3947 -1449
  13. package/dist/node.js.map +49 -38
  14. package/dist/task/BackgroundRemovalTask.d.ts +121 -289
  15. package/dist/task/BackgroundRemovalTask.d.ts.map +1 -1
  16. package/dist/task/ChunkRetrievalTask.d.ts +243 -0
  17. package/dist/task/ChunkRetrievalTask.d.ts.map +1 -0
  18. package/dist/task/ChunkToVectorTask.d.ts +183 -0
  19. package/dist/task/ChunkToVectorTask.d.ts.map +1 -0
  20. package/dist/task/ChunkVectorHybridSearchTask.d.ts +160 -0
  21. package/dist/task/ChunkVectorHybridSearchTask.d.ts.map +1 -0
  22. package/dist/task/ChunkVectorSearchTask.d.ts +137 -0
  23. package/dist/task/ChunkVectorSearchTask.d.ts.map +1 -0
  24. package/dist/task/ChunkVectorUpsertTask.d.ts +120 -0
  25. package/dist/task/ChunkVectorUpsertTask.d.ts.map +1 -0
  26. package/dist/task/ContextBuilderTask.d.ts +131 -0
  27. package/dist/task/ContextBuilderTask.d.ts.map +1 -0
  28. package/dist/task/DocumentEnricherTask.d.ts +232 -0
  29. package/dist/task/DocumentEnricherTask.d.ts.map +1 -0
  30. package/dist/task/DownloadModelTask.d.ts +79 -208
  31. package/dist/task/DownloadModelTask.d.ts.map +1 -1
  32. package/dist/task/FaceDetectorTask.d.ts +117 -272
  33. package/dist/task/FaceDetectorTask.d.ts.map +1 -1
  34. package/dist/task/FaceLandmarkerTask.d.ts +117 -272
  35. package/dist/task/FaceLandmarkerTask.d.ts.map +1 -1
  36. package/dist/task/GestureRecognizerTask.d.ts +129 -284
  37. package/dist/task/GestureRecognizerTask.d.ts.map +1 -1
  38. package/dist/task/HandLandmarkerTask.d.ts +125 -280
  39. package/dist/task/HandLandmarkerTask.d.ts.map +1 -1
  40. package/dist/task/HierarchicalChunkerTask.d.ts +212 -0
  41. package/dist/task/HierarchicalChunkerTask.d.ts.map +1 -0
  42. package/dist/task/HierarchyJoinTask.d.ts +318 -0
  43. package/dist/task/HierarchyJoinTask.d.ts.map +1 -0
  44. package/dist/task/ImageClassificationTask.d.ts +117 -272
  45. package/dist/task/ImageClassificationTask.d.ts.map +1 -1
  46. package/dist/task/ImageEmbeddingTask.d.ts +125 -446
  47. package/dist/task/ImageEmbeddingTask.d.ts.map +1 -1
  48. package/dist/task/ImageSegmentationTask.d.ts +117 -272
  49. package/dist/task/ImageSegmentationTask.d.ts.map +1 -1
  50. package/dist/task/ImageToTextTask.d.ts +117 -272
  51. package/dist/task/ImageToTextTask.d.ts.map +1 -1
  52. package/dist/task/ObjectDetectionTask.d.ts +119 -274
  53. package/dist/task/ObjectDetectionTask.d.ts.map +1 -1
  54. package/dist/task/PoseLandmarkerTask.d.ts +117 -272
  55. package/dist/task/PoseLandmarkerTask.d.ts.map +1 -1
  56. package/dist/task/QueryExpanderTask.d.ts +129 -0
  57. package/dist/task/QueryExpanderTask.d.ts.map +1 -0
  58. package/dist/task/RerankerTask.d.ts +209 -0
  59. package/dist/task/RerankerTask.d.ts.map +1 -0
  60. package/dist/task/StructuralParserTask.d.ts +91 -0
  61. package/dist/task/StructuralParserTask.d.ts.map +1 -0
  62. package/dist/task/TextChunkerTask.d.ts +129 -0
  63. package/dist/task/TextChunkerTask.d.ts.map +1 -0
  64. package/dist/task/TextClassificationTask.d.ts +42 -115
  65. package/dist/task/TextClassificationTask.d.ts.map +1 -1
  66. package/dist/task/TextEmbeddingTask.d.ts +55 -277
  67. package/dist/task/TextEmbeddingTask.d.ts.map +1 -1
  68. package/dist/task/TextFillMaskTask.d.ts +42 -115
  69. package/dist/task/TextFillMaskTask.d.ts.map +1 -1
  70. package/dist/task/TextGenerationTask.d.ts +44 -128
  71. package/dist/task/TextGenerationTask.d.ts.map +1 -1
  72. package/dist/task/TextLanguageDetectionTask.d.ts +42 -115
  73. package/dist/task/TextLanguageDetectionTask.d.ts.map +1 -1
  74. package/dist/task/TextNamedEntityRecognitionTask.d.ts +42 -115
  75. package/dist/task/TextNamedEntityRecognitionTask.d.ts.map +1 -1
  76. package/dist/task/TextQuestionAnswerTask.d.ts +47 -144
  77. package/dist/task/TextQuestionAnswerTask.d.ts.map +1 -1
  78. package/dist/task/TextRewriterTask.d.ts +45 -131
  79. package/dist/task/TextRewriterTask.d.ts.map +1 -1
  80. package/dist/task/TextSummaryTask.d.ts +42 -115
  81. package/dist/task/TextSummaryTask.d.ts.map +1 -1
  82. package/dist/task/TextTranslationTask.d.ts +54 -168
  83. package/dist/task/TextTranslationTask.d.ts.map +1 -1
  84. package/dist/task/TopicSegmenterTask.d.ts +148 -0
  85. package/dist/task/TopicSegmenterTask.d.ts.map +1 -0
  86. package/dist/task/UnloadModelTask.d.ts +79 -208
  87. package/dist/task/UnloadModelTask.d.ts.map +1 -1
  88. package/dist/task/VectorQuantizeTask.d.ts +120 -0
  89. package/dist/task/VectorQuantizeTask.d.ts.map +1 -0
  90. package/dist/task/VectorSimilarityTask.d.ts +18 -253
  91. package/dist/task/VectorSimilarityTask.d.ts.map +1 -1
  92. package/dist/task/base/AiTask.d.ts +24 -22
  93. package/dist/task/base/AiTask.d.ts.map +1 -1
  94. package/dist/task/base/AiTaskSchemas.d.ts +3 -127
  95. package/dist/task/base/AiTaskSchemas.d.ts.map +1 -1
  96. package/dist/task/base/AiVisionTask.d.ts +1 -4
  97. package/dist/task/base/AiVisionTask.d.ts.map +1 -1
  98. package/dist/task/index.d.ts +54 -1
  99. package/dist/task/index.d.ts.map +1 -1
  100. package/package.json +14 -9
  101. package/dist/source/Document.d.ts +0 -56
  102. package/dist/source/Document.d.ts.map +0 -1
  103. package/dist/source/DocumentConverter.d.ts +0 -15
  104. package/dist/source/DocumentConverter.d.ts.map +0 -1
  105. package/dist/source/DocumentConverterMarkdown.d.ts +0 -13
  106. package/dist/source/DocumentConverterMarkdown.d.ts.map +0 -1
  107. package/dist/source/DocumentConverterText.d.ts +0 -13
  108. package/dist/source/DocumentConverterText.d.ts.map +0 -1
  109. package/dist/source/MasterDocument.d.ts +0 -27
  110. package/dist/source/MasterDocument.d.ts.map +0 -1
  111. package/dist/source/index.d.ts +0 -10
  112. package/dist/source/index.d.ts.map +0 -1
  113. package/dist/task/DocumentSplitterTask.d.ts +0 -58
  114. package/dist/task/DocumentSplitterTask.d.ts.map +0 -1
@@ -6,115 +6,57 @@
6
6
  import { CreateWorkflow, JobQueueTaskConfig } from "@workglow/task-graph";
7
7
  import { DataPortSchema, FromSchema } from "@workglow/util";
8
8
  import { AiTask } from "./base/AiTask";
9
- import { DeReplicateFromSchema } from "./base/AiTaskSchemas";
10
9
  declare const UnloadModelInputSchema: {
11
10
  readonly type: "object";
12
11
  readonly properties: {
13
12
  readonly model: {
14
- readonly "x-replicate": true;
15
- readonly format?: string | undefined;
16
13
  readonly oneOf: readonly [{
17
- readonly oneOf: readonly [{
18
- readonly title: "Model";
19
- readonly description: `The model ${string}`;
20
- } & {
21
- readonly format: import("./base/AiTaskSchemas").TypeModelSemantic;
22
- readonly type: "string";
23
- }, {
24
- readonly type: "object";
25
- readonly properties: {
26
- readonly model_id: {
27
- readonly type: "string";
28
- };
29
- readonly tasks: {
30
- readonly type: "array";
31
- readonly items: {
32
- readonly type: "string";
33
- };
34
- readonly "x-ui-editor": "multiselect";
35
- };
36
- readonly title: {
37
- readonly type: "string";
38
- };
39
- readonly description: {
40
- readonly type: "string";
41
- readonly "x-ui-editor": "textarea";
42
- };
43
- readonly provider: {
44
- readonly type: "string";
45
- };
46
- readonly provider_config: {
47
- readonly type: "object";
48
- readonly default: {};
49
- };
50
- readonly metadata: {
51
- readonly type: "object";
52
- readonly default: {};
53
- readonly "x-ui-hidden": true;
54
- };
55
- };
56
- readonly required: readonly ["provider", "provider_config"];
57
- readonly format: "model";
58
- readonly additionalProperties: false;
59
- } & {
60
- readonly format: import("./base/AiTaskSchemas").TypeModelSemantic;
61
- }];
14
+ readonly title: "Model";
15
+ readonly description: `The model ${string}`;
62
16
  } & {
63
17
  readonly format: import("./base/AiTaskSchemas").TypeModelSemantic;
18
+ readonly type: "string";
64
19
  }, {
65
- readonly type: "array";
66
- readonly items: {
67
- readonly oneOf: readonly [{
68
- readonly title: "Model";
69
- readonly description: `The model ${string}`;
70
- } & {
71
- readonly format: import("./base/AiTaskSchemas").TypeModelSemantic;
20
+ readonly type: "object";
21
+ readonly properties: {
22
+ readonly model_id: {
72
23
  readonly type: "string";
73
- }, {
74
- readonly type: "object";
75
- readonly properties: {
76
- readonly model_id: {
77
- readonly type: "string";
78
- };
79
- readonly tasks: {
80
- readonly type: "array";
81
- readonly items: {
82
- readonly type: "string";
83
- };
84
- readonly "x-ui-editor": "multiselect";
85
- };
86
- readonly title: {
87
- readonly type: "string";
88
- };
89
- readonly description: {
90
- readonly type: "string";
91
- readonly "x-ui-editor": "textarea";
92
- };
93
- readonly provider: {
94
- readonly type: "string";
95
- };
96
- readonly provider_config: {
97
- readonly type: "object";
98
- readonly default: {};
99
- };
100
- readonly metadata: {
101
- readonly type: "object";
102
- readonly default: {};
103
- readonly "x-ui-hidden": true;
104
- };
24
+ };
25
+ readonly tasks: {
26
+ readonly type: "array";
27
+ readonly items: {
28
+ readonly type: "string";
105
29
  };
106
- readonly required: readonly ["provider", "provider_config"];
107
- readonly format: "model";
108
- readonly additionalProperties: false;
109
- } & {
110
- readonly format: import("./base/AiTaskSchemas").TypeModelSemantic;
111
- }];
112
- } & {
113
- readonly format: import("./base/AiTaskSchemas").TypeModelSemantic;
30
+ readonly "x-ui-editor": "multiselect";
31
+ };
32
+ readonly title: {
33
+ readonly type: "string";
34
+ };
35
+ readonly description: {
36
+ readonly type: "string";
37
+ readonly "x-ui-editor": "textarea";
38
+ };
39
+ readonly provider: {
40
+ readonly type: "string";
41
+ };
42
+ readonly provider_config: {
43
+ readonly type: "object";
44
+ readonly default: {};
45
+ };
46
+ readonly metadata: {
47
+ readonly type: "object";
48
+ readonly default: {};
49
+ readonly "x-ui-hidden": true;
50
+ };
114
51
  };
52
+ readonly required: readonly ["provider", "provider_config"];
53
+ readonly format: "model";
54
+ readonly additionalProperties: false;
55
+ } & {
56
+ readonly format: import("./base/AiTaskSchemas").TypeModelSemantic;
115
57
  }];
116
- readonly title: string | undefined;
117
- readonly description: string | undefined;
58
+ } & {
59
+ readonly format: import("./base/AiTaskSchemas").TypeModelSemantic;
118
60
  };
119
61
  };
120
62
  readonly required: readonly ["model"];
@@ -124,110 +66,53 @@ declare const UnloadModelOutputSchema: {
124
66
  readonly type: "object";
125
67
  readonly properties: {
126
68
  readonly model: {
127
- readonly "x-replicate": true;
128
- readonly format?: string | undefined;
129
69
  readonly oneOf: readonly [{
130
- readonly oneOf: readonly [{
131
- readonly title: "Model";
132
- readonly description: `The model ${string}`;
133
- } & {
134
- readonly format: import("./base/AiTaskSchemas").TypeModelSemantic;
135
- readonly type: "string";
136
- }, {
137
- readonly type: "object";
138
- readonly properties: {
139
- readonly model_id: {
140
- readonly type: "string";
141
- };
142
- readonly tasks: {
143
- readonly type: "array";
144
- readonly items: {
145
- readonly type: "string";
146
- };
147
- readonly "x-ui-editor": "multiselect";
148
- };
149
- readonly title: {
150
- readonly type: "string";
151
- };
152
- readonly description: {
153
- readonly type: "string";
154
- readonly "x-ui-editor": "textarea";
155
- };
156
- readonly provider: {
157
- readonly type: "string";
158
- };
159
- readonly provider_config: {
160
- readonly type: "object";
161
- readonly default: {};
162
- };
163
- readonly metadata: {
164
- readonly type: "object";
165
- readonly default: {};
166
- readonly "x-ui-hidden": true;
167
- };
168
- };
169
- readonly required: readonly ["provider", "provider_config"];
170
- readonly format: "model";
171
- readonly additionalProperties: false;
172
- } & {
173
- readonly format: import("./base/AiTaskSchemas").TypeModelSemantic;
174
- }];
70
+ readonly title: "Model";
71
+ readonly description: `The model ${string}`;
175
72
  } & {
176
73
  readonly format: import("./base/AiTaskSchemas").TypeModelSemantic;
74
+ readonly type: "string";
177
75
  }, {
178
- readonly type: "array";
179
- readonly items: {
180
- readonly oneOf: readonly [{
181
- readonly title: "Model";
182
- readonly description: `The model ${string}`;
183
- } & {
184
- readonly format: import("./base/AiTaskSchemas").TypeModelSemantic;
76
+ readonly type: "object";
77
+ readonly properties: {
78
+ readonly model_id: {
185
79
  readonly type: "string";
186
- }, {
187
- readonly type: "object";
188
- readonly properties: {
189
- readonly model_id: {
190
- readonly type: "string";
191
- };
192
- readonly tasks: {
193
- readonly type: "array";
194
- readonly items: {
195
- readonly type: "string";
196
- };
197
- readonly "x-ui-editor": "multiselect";
198
- };
199
- readonly title: {
200
- readonly type: "string";
201
- };
202
- readonly description: {
203
- readonly type: "string";
204
- readonly "x-ui-editor": "textarea";
205
- };
206
- readonly provider: {
207
- readonly type: "string";
208
- };
209
- readonly provider_config: {
210
- readonly type: "object";
211
- readonly default: {};
212
- };
213
- readonly metadata: {
214
- readonly type: "object";
215
- readonly default: {};
216
- readonly "x-ui-hidden": true;
217
- };
80
+ };
81
+ readonly tasks: {
82
+ readonly type: "array";
83
+ readonly items: {
84
+ readonly type: "string";
218
85
  };
219
- readonly required: readonly ["provider", "provider_config"];
220
- readonly format: "model";
221
- readonly additionalProperties: false;
222
- } & {
223
- readonly format: import("./base/AiTaskSchemas").TypeModelSemantic;
224
- }];
225
- } & {
226
- readonly format: import("./base/AiTaskSchemas").TypeModelSemantic;
86
+ readonly "x-ui-editor": "multiselect";
87
+ };
88
+ readonly title: {
89
+ readonly type: "string";
90
+ };
91
+ readonly description: {
92
+ readonly type: "string";
93
+ readonly "x-ui-editor": "textarea";
94
+ };
95
+ readonly provider: {
96
+ readonly type: "string";
97
+ };
98
+ readonly provider_config: {
99
+ readonly type: "object";
100
+ readonly default: {};
101
+ };
102
+ readonly metadata: {
103
+ readonly type: "object";
104
+ readonly default: {};
105
+ readonly "x-ui-hidden": true;
106
+ };
227
107
  };
108
+ readonly required: readonly ["provider", "provider_config"];
109
+ readonly format: "model";
110
+ readonly additionalProperties: false;
111
+ } & {
112
+ readonly format: import("./base/AiTaskSchemas").TypeModelSemantic;
228
113
  }];
229
- readonly title: string | undefined;
230
- readonly description: string | undefined;
114
+ } & {
115
+ readonly format: import("./base/AiTaskSchemas").TypeModelSemantic;
231
116
  };
232
117
  };
233
118
  readonly required: readonly ["model"];
@@ -235,8 +120,6 @@ declare const UnloadModelOutputSchema: {
235
120
  };
236
121
  export type UnloadModelTaskRunInput = FromSchema<typeof UnloadModelInputSchema>;
237
122
  export type UnloadModelTaskRunOutput = FromSchema<typeof UnloadModelOutputSchema>;
238
- export type UnloadModelTaskExecuteInput = DeReplicateFromSchema<typeof UnloadModelInputSchema>;
239
- export type UnloadModelTaskExecuteOutput = DeReplicateFromSchema<typeof UnloadModelOutputSchema>;
240
123
  /**
241
124
  * Unload a model from memory and clear its cache.
242
125
  *
@@ -271,19 +154,7 @@ export declare const unloadModel: (input: UnloadModelTaskRunInput, config?: JobQ
271
154
  provider_config: {
272
155
  [x: string]: unknown;
273
156
  };
274
- } | (string | {
275
- title?: string | undefined;
276
- description?: string | undefined;
277
- model_id?: string | undefined;
278
- tasks?: string[] | undefined;
279
- metadata?: {
280
- [x: string]: unknown;
281
- } | undefined;
282
- provider: string;
283
- provider_config: {
284
- [x: string]: unknown;
285
- };
286
- })[];
157
+ };
287
158
  }>;
288
159
  declare module "@workglow/task-graph" {
289
160
  interface Workflow {
@@ -1 +1 @@
1
- {"version":3,"file":"UnloadModelTask.d.ts","sourceRoot":"","sources":["../../src/task/UnloadModelTask.ts"],"names":[],"mappings":"AAAA;;;;GAIG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B,CAAC;IACpC,UAAU,QAAQ;QAChB,WAAW,EAAE,cAAc,CACzB,uBAAuB,EACvB,wBAAwB,EACxB,kBAAkB,CACnB,CAAC;KACH;CACF"}
@@ -0,0 +1,120 @@
1
+ /**
2
+ * @license
3
+ * Copyright 2025 Steven Roussey <sroussey@gmail.com>
4
+ * SPDX-License-Identifier: Apache-2.0
5
+ */
6
+ import { CreateWorkflow, JobQueueTaskConfig, Task } from "@workglow/task-graph";
7
+ import { DataPortSchema, FromSchema, TypedArray, TypedArraySchemaOptions } from "@workglow/util";
8
+ declare const inputSchema: {
9
+ readonly type: "object";
10
+ readonly properties: {
11
+ readonly vector: {
12
+ readonly anyOf: readonly [{
13
+ readonly type: "array";
14
+ readonly format: "TypedArray";
15
+ readonly title: "Typed Array";
16
+ readonly description: "A typed array (Float32Array, Int8Array, etc.)";
17
+ }, {
18
+ readonly type: "array";
19
+ readonly items: {
20
+ readonly type: "array";
21
+ readonly format: "TypedArray";
22
+ readonly title: "Typed Array";
23
+ readonly description: "A typed array (Float32Array, Int8Array, etc.)";
24
+ };
25
+ }];
26
+ readonly title: "Input Vector(s)";
27
+ readonly description: "Vector or array of vectors to quantize";
28
+ };
29
+ readonly targetType: {
30
+ readonly type: "string";
31
+ readonly enum: ("float16" | "float32" | "float64" | "int8" | "uint8" | "int16" | "uint16")[];
32
+ readonly title: "Target Type";
33
+ readonly description: "Target quantization type";
34
+ readonly default: "int8";
35
+ };
36
+ readonly normalize: {
37
+ readonly type: "boolean";
38
+ readonly title: "Normalize";
39
+ readonly description: "Normalize vector before quantization";
40
+ readonly default: true;
41
+ };
42
+ };
43
+ readonly required: readonly ["vector", "targetType"];
44
+ readonly additionalProperties: false;
45
+ };
46
+ declare const outputSchema: {
47
+ readonly type: "object";
48
+ readonly properties: {
49
+ readonly vector: {
50
+ readonly anyOf: readonly [{
51
+ readonly type: "array";
52
+ readonly format: "TypedArray";
53
+ readonly title: "Typed Array";
54
+ readonly description: "A typed array (Float32Array, Int8Array, etc.)";
55
+ }, {
56
+ readonly type: "array";
57
+ readonly items: {
58
+ readonly type: "array";
59
+ readonly format: "TypedArray";
60
+ readonly title: "Typed Array";
61
+ readonly description: "A typed array (Float32Array, Int8Array, etc.)";
62
+ };
63
+ }];
64
+ readonly title: "Output Vector(s)";
65
+ readonly description: "Quantized vector or array of vectors";
66
+ };
67
+ readonly originalType: {
68
+ readonly type: "string";
69
+ readonly enum: ("float16" | "float32" | "float64" | "int8" | "uint8" | "int16" | "uint16")[];
70
+ readonly title: "Original Type";
71
+ readonly description: "Original vector type";
72
+ };
73
+ readonly targetType: {
74
+ readonly type: "string";
75
+ readonly enum: ("float16" | "float32" | "float64" | "int8" | "uint8" | "int16" | "uint16")[];
76
+ readonly title: "Target Type";
77
+ readonly description: "Target quantization type";
78
+ };
79
+ };
80
+ readonly required: readonly ["vector", "originalType", "targetType"];
81
+ readonly additionalProperties: false;
82
+ };
83
+ export type VectorQuantizeTaskInput = FromSchema<typeof inputSchema, TypedArraySchemaOptions>;
84
+ export type VectorQuantizeTaskOutput = FromSchema<typeof outputSchema, TypedArraySchemaOptions>;
85
+ /**
86
+ * Task for quantizing vectors to reduce storage and improve performance.
87
+ * Supports various quantization types including binary, int8, uint8, int16, uint16.
88
+ */
89
+ export declare class VectorQuantizeTask extends Task<VectorQuantizeTaskInput, VectorQuantizeTaskOutput, JobQueueTaskConfig> {
90
+ static type: string;
91
+ static category: string;
92
+ static title: string;
93
+ static description: string;
94
+ static cacheable: boolean;
95
+ static inputSchema(): DataPortSchema;
96
+ static outputSchema(): DataPortSchema;
97
+ executeReactive(input: VectorQuantizeTaskInput): Promise<VectorQuantizeTaskOutput>;
98
+ private getVectorType;
99
+ private vectorQuantize;
100
+ /**
101
+ * Find min and max values in a single pass for better performance
102
+ */
103
+ private findMinMax;
104
+ private quantizeToInt8;
105
+ private quantizeToUint8;
106
+ private quantizeToInt16;
107
+ private quantizeToUint16;
108
+ }
109
+ export declare const vectorQuantize: (input: VectorQuantizeTaskInput, config?: JobQueueTaskConfig) => Promise<{
110
+ vector: TypedArray | TypedArray[];
111
+ targetType: "float16" | "float32" | "float64" | "int8" | "uint8" | "int16" | "uint16";
112
+ originalType: "float16" | "float32" | "float64" | "int8" | "uint8" | "int16" | "uint16";
113
+ }>;
114
+ declare module "@workglow/task-graph" {
115
+ interface Workflow {
116
+ vectorQuantize: CreateWorkflow<VectorQuantizeTaskInput, VectorQuantizeTaskOutput, JobQueueTaskConfig>;
117
+ }
118
+ }
119
+ export {};
120
+ //# sourceMappingURL=VectorQuantizeTask.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"VectorQuantizeTask.d.ts","sourceRoot":"","sources":["../../src/task/VectorQuantizeTask.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,cAAc,EAAE,kBAAkB,EAAE,IAAI,EAAY,MAAM,sBAAsB,CAAC;AAC1F,OAAO,EACL,cAAc,EACd,UAAU,EAGV,UAAU,EAEV,uBAAuB,EACxB,MAAM,gBAAgB,CAAC;AAExB,QAAA,MAAM,WAAW;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAoCkB,CAAC;AAEpC,QAAA,MAAM,YAAY;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAmCiB,CAAC;AAEpC,MAAM,MAAM,uBAAuB,GAAG,UAAU,CAAC,OAAO,WAAW,EAAE,uBAAuB,CAAC,CAAC;AAC9F,MAAM,MAAM,wBAAwB,GAAG,UAAU,CAAC,OAAO,YAAY,EAAE,uBAAuB,CAAC,CAAC;AAEhG;;;GAGG;AACH,qBAAa,kBAAmB,SAAQ,IAAI,CAC1C,uBAAuB,EACvB,wBAAwB,EACxB,kBAAkB,CACnB;IACC,OAAc,IAAI,SAAwB;IAC1C,OAAc,QAAQ,SAAuB;IAC7C,OAAc,KAAK,SAAqB;IACxC,OAAc,WAAW,SAAgE;IACzF,OAAc,SAAS,UAAQ;WAEjB,WAAW,IAAI,cAAc;WAI7B,YA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