@workglow/ai-provider 0.0.58 → 0.0.59

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -125,7 +125,7 @@ Supports ONNX models from HuggingFace Hub with the following task types:
125
125
  Models support various quantization options:
126
126
 
127
127
  ```typescript
128
- import { QUANTIZATION_DATA_TYPES } from "@workglow/ai-provider";
128
+ import { QuantizationDataType } from "@workglow/ai-provider";
129
129
 
130
130
  // Quantization options
131
131
  // "auto" - Auto-detect based on environment
@@ -4,15 +4,81 @@
4
4
  * SPDX-License-Identifier: Apache-2.0
5
5
  */
6
6
  export declare const HF_TRANSFORMERS_ONNX = "HF_TRANSFORMERS_ONNX";
7
- export declare enum QUANTIZATION_DATA_TYPES {
8
- auto = "auto",// Auto-detect based on environment
9
- fp32 = "fp32",
10
- fp16 = "fp16",
11
- q8 = "q8",
12
- int8 = "int8",
13
- uint8 = "uint8",
14
- q4 = "q4",
15
- bnb4 = "bnb4",
16
- q4f16 = "q4f16"
17
- }
7
+ export type QuantizationDataType = "auto" | "fp32" | "fp16" | "q8" | "int8" | "uint8" | "q4" | "bnb4" | "q4f16";
8
+ export declare const QuantizationDataType: {
9
+ readonly auto: "auto";
10
+ readonly fp32: "fp32";
11
+ readonly fp16: "fp16";
12
+ readonly q8: "q8";
13
+ readonly int8: "int8";
14
+ readonly uint8: "uint8";
15
+ readonly q4: "q4";
16
+ readonly bnb4: "bnb4";
17
+ readonly q4f16: "q4f16";
18
+ };
19
+ export type TextPipelineUseCase = "fill-mask" | "token-classification" | "text-generation" | "text2text-generation" | "text-classification" | "summarization" | "translation" | "feature-extraction" | "zero-shot-classification" | "question-answering";
20
+ export declare const TextPipelineUseCase: {
21
+ readonly "fill-mask": "fill-mask";
22
+ readonly "token-classification": "token-classification";
23
+ readonly "text-generation": "text-generation";
24
+ readonly "text2text-generation": "text2text-generation";
25
+ readonly "text-classification": "text-classification";
26
+ readonly summarization: "summarization";
27
+ readonly translation: "translation";
28
+ readonly "feature-extraction": "feature-extraction";
29
+ readonly "zero-shot-classification": "zero-shot-classification";
30
+ readonly "question-answering": "question-answering";
31
+ };
32
+ export type VisionPipelineUseCase = "background-removal" | "image-segmentation" | "depth-estimation" | "image-classification" | "image-to-image" | "object-detection" | "image-feature-extraction";
33
+ export declare const VisionPipelineUseCase: {
34
+ readonly "background-removal": "background-removal";
35
+ readonly "image-segmentation": "image-segmentation";
36
+ readonly "depth-estimation": "depth-estimation";
37
+ readonly "image-classification": "image-classification";
38
+ readonly "image-to-image": "image-to-image";
39
+ readonly "object-detection": "object-detection";
40
+ readonly "image-feature-extraction": "image-feature-extraction";
41
+ };
42
+ export type AudioPipelineUseCase = "audio-classification" | "automatic-speech-recognition" | "text-to-speech";
43
+ export declare const AudioPipelineUseCase: {
44
+ readonly "audio-classification": "audio-classification";
45
+ readonly "automatic-speech-recognition": "automatic-speech-recognition";
46
+ readonly "text-to-speech": "text-to-speech";
47
+ };
48
+ export type MultimodalPipelineUseCase = "document-question-answering" | "image-to-text" | "zero-shot-audio-classification" | "zero-shot-image-classification" | "zero-shot-object-detection";
49
+ export declare const MultimodalPipelineUseCase: {
50
+ readonly "document-question-answering": "document-question-answering";
51
+ readonly "image-to-text": "image-to-text";
52
+ readonly "zero-shot-audio-classification": "zero-shot-audio-classification";
53
+ readonly "zero-shot-image-classification": "zero-shot-image-classification";
54
+ readonly "zero-shot-object-detection": "zero-shot-object-detection";
55
+ };
56
+ export type PipelineUseCase = TextPipelineUseCase | VisionPipelineUseCase | AudioPipelineUseCase | MultimodalPipelineUseCase;
57
+ export declare const PipelineUseCase: {
58
+ readonly "document-question-answering": "document-question-answering";
59
+ readonly "image-to-text": "image-to-text";
60
+ readonly "zero-shot-audio-classification": "zero-shot-audio-classification";
61
+ readonly "zero-shot-image-classification": "zero-shot-image-classification";
62
+ readonly "zero-shot-object-detection": "zero-shot-object-detection";
63
+ readonly "audio-classification": "audio-classification";
64
+ readonly "automatic-speech-recognition": "automatic-speech-recognition";
65
+ readonly "text-to-speech": "text-to-speech";
66
+ readonly "background-removal": "background-removal";
67
+ readonly "image-segmentation": "image-segmentation";
68
+ readonly "depth-estimation": "depth-estimation";
69
+ readonly "image-classification": "image-classification";
70
+ readonly "image-to-image": "image-to-image";
71
+ readonly "object-detection": "object-detection";
72
+ readonly "image-feature-extraction": "image-feature-extraction";
73
+ readonly "fill-mask": "fill-mask";
74
+ readonly "token-classification": "token-classification";
75
+ readonly "text-generation": "text-generation";
76
+ readonly "text2text-generation": "text2text-generation";
77
+ readonly "text-classification": "text-classification";
78
+ readonly summarization: "summarization";
79
+ readonly translation: "translation";
80
+ readonly "feature-extraction": "feature-extraction";
81
+ readonly "zero-shot-classification": "zero-shot-classification";
82
+ readonly "question-answering": "question-answering";
83
+ };
18
84
  //# sourceMappingURL=HFT_Constants.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"HFT_Constants.d.ts","sourceRoot":"","sources":["../../../src/hf-transformers/common/HFT_Constants.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,eAAO,MAAM,oBAAoB,yBAAyB,CAAC;AAE3D,oBAAY,uBAAuB;IACjC,IAAI,SAAS,CAAE,mCAAmC;IAClD,IAAI,SAAS;IACb,IAAI,SAAS;IACb,EAAE,OAAO;IACT,IAAI,SAAS;IACb,KAAK,UAAU;IACf,EAAE,OAAO;IACT,IAAI,SAAS;IACb,KAAK,UAAU;CAChB"}
1
+ {"version":3,"file":"HFT_Constants.d.ts","sourceRoot":"","sources":["../../../src/hf-transformers/common/HFT_Constants.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,eAAO,MAAM,oBAAoB,yBAAyB,CAAC;AAE3D,MAAM,MAAM,oBAAoB,GAC5B,MAAM,GACN,MAAM,GACN,MAAM,GACN,IAAI,GACJ,MAAM,GACN,OAAO,GACP,IAAI,GACJ,MAAM,GACN,OAAO,CAAC;AAEZ,eAAO,MAAM,oBAAoB;;;;;;;;;;CAUsC,CAAC;AAExE,MAAM,MAAM,mBAAmB,GAC3B,WAAW,GACX,sBAAsB,GACtB,iBAAiB,GACjB,sBAAsB,GACtB,qBAAqB,GACrB,eAAe,GACf,aAAa,GACb,oBAAoB,GACpB,0BAA0B,GAC1B,oBAAoB,CAAC;AAEzB,eAAO,MAAM,mBAAmB;;;;;;;;;;;CAWqC,CAAC;AAEtE,MAAM,MAAM,qBAAqB,GAC7B,oBAAoB,GACpB,oBAAoB,GACpB,kBAAkB,GAClB,sBAAsB,GACtB,gBAAgB,GAChB,kBAAkB,GAClB,0BAA0B,CAAC;AAE/B,eAAO,MAAM,qBAAqB;;;;;;;;CAQuC,CAAC;AAE1E,MAAM,MAAM,oBAAoB,GAC5B,sBAAsB,GACtB,8BAA8B,GAC9B,gBAAgB,CAAC;AAErB,eAAO,MAAM,oBAAoB;;;;CAIsC,CAAC;AAExE,MAAM,MAAM,yBAAyB,GACjC,6BAA6B,GAC7B,eAAe,GACf,gCAAgC,GAChC,gCAAgC,GAChC,4BAA4B,CAAC;AAEjC,eAAO,MAAM,yBAAyB;;;;;;CAM2C,CAAC;AAElF,MAAM,MAAM,eAAe,GACvB,mBAAmB,GACnB,qBAAqB,GACrB,oBAAoB,GACpB,yBAAyB,CAAC;AAE9B,eAAO,MAAM,eAAe;;;;;;;;;;;;;;;;;;;;;;;;;;CAKiC,CAAC"}
@@ -4,42 +4,40 @@
4
4
  * SPDX-License-Identifier: Apache-2.0
5
5
  */
6
6
  import { AiProviderRunFn, type DeReplicateFromSchema, DownloadModelTaskExecuteInput, TextEmbeddingInputSchema, TextEmbeddingOutputSchema, TextGenerationInputSchema, TextGenerationOutputSchema, TextQuestionAnswerInputSchema, TextQuestionAnswerOutputSchema, TextRewriterInputSchema, TextRewriterOutputSchema, TextSummaryInputSchema, TextSummaryOutputSchema, TextTranslationInputSchema, TextTranslationOutputSchema } from "@workglow/ai";
7
+ import { HfTransformersOnnxModelRecord } from "./HFT_ModelSchema";
7
8
  /**
8
9
  * Core implementation for downloading and caching a Hugging Face Transformers model.
9
10
  * This is shared between inline and worker implementations.
10
11
  */
11
- export declare const HFT_Download: AiProviderRunFn<DownloadModelTaskExecuteInput, DownloadModelTaskExecuteInput>;
12
+ export declare const HFT_Download: AiProviderRunFn<DownloadModelTaskExecuteInput, DownloadModelTaskExecuteInput, HfTransformersOnnxModelRecord>;
12
13
  /**
13
14
  * Core implementation for text embedding using Hugging Face Transformers.
14
15
  * This is shared between inline and worker implementations.
15
16
  */
16
- type TextEmbeddingInput = DeReplicateFromSchema<typeof TextEmbeddingInputSchema>;
17
- type TextEmbeddingOutput = DeReplicateFromSchema<typeof TextEmbeddingOutputSchema>;
18
- export declare const HFT_TextEmbedding: AiProviderRunFn<TextEmbeddingInput, TextEmbeddingOutput>;
17
+ export declare const HFT_TextEmbedding: AiProviderRunFn<DeReplicateFromSchema<typeof TextEmbeddingInputSchema>, DeReplicateFromSchema<typeof TextEmbeddingOutputSchema>, HfTransformersOnnxModelRecord>;
19
18
  /**
20
19
  * Core implementation for text generation using Hugging Face Transformers.
21
20
  * This is shared between inline and worker implementations.
22
21
  */
23
- export declare const HFT_TextGeneration: AiProviderRunFn<DeReplicateFromSchema<typeof TextGenerationInputSchema>, DeReplicateFromSchema<typeof TextGenerationOutputSchema>>;
22
+ export declare const HFT_TextGeneration: AiProviderRunFn<DeReplicateFromSchema<typeof TextGenerationInputSchema>, DeReplicateFromSchema<typeof TextGenerationOutputSchema>, HfTransformersOnnxModelRecord>;
24
23
  /**
25
24
  * Core implementation for text translation using Hugging Face Transformers.
26
25
  * This is shared between inline and worker implementations.
27
26
  */
28
- export declare const HFT_TextTranslation: AiProviderRunFn<DeReplicateFromSchema<typeof TextTranslationInputSchema>, DeReplicateFromSchema<typeof TextTranslationOutputSchema>>;
27
+ export declare const HFT_TextTranslation: AiProviderRunFn<DeReplicateFromSchema<typeof TextTranslationInputSchema>, DeReplicateFromSchema<typeof TextTranslationOutputSchema>, HfTransformersOnnxModelRecord>;
29
28
  /**
30
29
  * Core implementation for text rewriting using Hugging Face Transformers.
31
30
  * This is shared between inline and worker implementations.
32
31
  */
33
- export declare const HFT_TextRewriter: AiProviderRunFn<DeReplicateFromSchema<typeof TextRewriterInputSchema>, DeReplicateFromSchema<typeof TextRewriterOutputSchema>>;
32
+ export declare const HFT_TextRewriter: AiProviderRunFn<DeReplicateFromSchema<typeof TextRewriterInputSchema>, DeReplicateFromSchema<typeof TextRewriterOutputSchema>, HfTransformersOnnxModelRecord>;
34
33
  /**
35
34
  * Core implementation for text summarization using Hugging Face Transformers.
36
35
  * This is shared between inline and worker implementations.
37
36
  */
38
- export declare const HFT_TextSummary: AiProviderRunFn<DeReplicateFromSchema<typeof TextSummaryInputSchema>, DeReplicateFromSchema<typeof TextSummaryOutputSchema>>;
37
+ export declare const HFT_TextSummary: AiProviderRunFn<DeReplicateFromSchema<typeof TextSummaryInputSchema>, DeReplicateFromSchema<typeof TextSummaryOutputSchema>, HfTransformersOnnxModelRecord>;
39
38
  /**
40
39
  * Core implementation for question answering using Hugging Face Transformers.
41
40
  * This is shared between inline and worker implementations.
42
41
  */
43
- export declare const HFT_TextQuestionAnswer: AiProviderRunFn<DeReplicateFromSchema<typeof TextQuestionAnswerInputSchema>, DeReplicateFromSchema<typeof TextQuestionAnswerOutputSchema>>;
44
- export {};
42
+ export declare const HFT_TextQuestionAnswer: AiProviderRunFn<DeReplicateFromSchema<typeof TextQuestionAnswerInputSchema>, DeReplicateFromSchema<typeof TextQuestionAnswerOutputSchema>, HfTransformersOnnxModelRecord>;
45
43
  //# sourceMappingURL=HFT_JobRunFns.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"HFT_JobRunFns.d.ts","sourceRoot":"","sources":["../../../src/hf-transformers/common/HFT_JobRunFns.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAkBH,OAAO,EACL,eAAe,EACf,KAAK,qBAAqB,EAC1B,6BAA6B,EAE7B,wBAAwB,EACxB,yBAAyB,EACzB,yBAAyB,EACzB,0BAA0B,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AAe,CAC3C,qBAAqB,CAAC,OAAO,sBAAsB,CAAC,EACpD,qBAAqB,CAAC,OAAO,uBAAuB,CAAC,EACrD,6BAA6B,CAsB9B,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,sBAAsB,EAAE,eAAe,CAClD,qBAAqB,CAAC,OAAO,6BAA6B,CAAC,EAC3D,qBAAqB,CAAC,OAAO,8BAA8B,CAAC,EAC5D,6BAA6B,CAuB9B,CAAC"}
@@ -0,0 +1,172 @@
1
+ /**
2
+ * @license
3
+ * Copyright 2025 Steven Roussey <sroussey@gmail.com>
4
+ * SPDX-License-Identifier: Apache-2.0
5
+ */
6
+ import { FromSchema } from "@workglow/util";
7
+ export declare const HfTransformersOnnxModelSchema: {
8
+ readonly type: "object";
9
+ readonly properties: {
10
+ readonly provider: {
11
+ readonly const: "HF_TRANSFORMERS_ONNX";
12
+ readonly description: "Discriminator: ONNX runtime backend.";
13
+ };
14
+ readonly providerConfig: {
15
+ readonly type: "object";
16
+ readonly description: "ONNX runtime-specific options.";
17
+ readonly properties: {
18
+ readonly pipeline: {
19
+ readonly type: "string";
20
+ readonly enum: ("fill-mask" | "token-classification" | "text-generation" | "text2text-generation" | "text-classification" | "summarization" | "translation" | "feature-extraction" | "zero-shot-classification" | "question-answering" | "background-removal" | "image-segmentation" | "depth-estimation" | "image-classification" | "image-to-image" | "object-detection" | "image-feature-extraction" | "audio-classification" | "automatic-speech-recognition" | "text-to-speech" | "document-question-answering" | "image-to-text" | "zero-shot-audio-classification" | "zero-shot-image-classification" | "zero-shot-object-detection")[];
21
+ readonly description: "Pipeline type for the ONNX model.";
22
+ readonly default: "text-generation";
23
+ };
24
+ readonly modelPath: {
25
+ readonly type: "string";
26
+ readonly description: "Filesystem path or URI for the ONNX model.";
27
+ };
28
+ readonly dType: {
29
+ readonly type: "string";
30
+ readonly enum: ("auto" | "fp32" | "fp16" | "q8" | "int8" | "uint8" | "q4" | "bnb4" | "q4f16")[];
31
+ readonly description: "Data type for the ONNX model.";
32
+ readonly default: "float32";
33
+ };
34
+ readonly device: {
35
+ readonly type: "string";
36
+ readonly enum: readonly ["cpu", "gpu", "webgpu", "wasm", "metal"];
37
+ readonly description: "High-level device selection.";
38
+ readonly default: "webgpu";
39
+ };
40
+ readonly executionProviders: {
41
+ readonly type: "array";
42
+ readonly items: {
43
+ readonly type: "string";
44
+ };
45
+ readonly description: "Raw ONNX Runtime execution provider identifiers.";
46
+ };
47
+ readonly intraOpNumThreads: {
48
+ readonly type: "integer";
49
+ readonly minimum: 1;
50
+ };
51
+ readonly interOpNumThreads: {
52
+ readonly type: "integer";
53
+ readonly minimum: 1;
54
+ };
55
+ readonly useExternalDataFormat: {
56
+ readonly type: "boolean";
57
+ readonly description: "Whether the model uses external data format.";
58
+ };
59
+ readonly nativeDimensions: {
60
+ readonly type: "integer";
61
+ readonly description: "The native dimensions of the model.";
62
+ };
63
+ readonly normalize: {
64
+ readonly type: "boolean";
65
+ readonly description: "Whether the model uses normalization.";
66
+ };
67
+ readonly languageStyle: {
68
+ readonly type: "string";
69
+ readonly description: "The language style of the model.";
70
+ };
71
+ };
72
+ readonly required: readonly ["modelPath", "pipeline"];
73
+ readonly additionalProperties: false;
74
+ };
75
+ };
76
+ readonly required: readonly ["provider", "providerConfig"];
77
+ readonly additionalProperties: true;
78
+ };
79
+ declare const ExtendedModelSchema: {
80
+ readonly type: "object";
81
+ readonly properties: {
82
+ readonly provider: {
83
+ readonly const: "HF_TRANSFORMERS_ONNX";
84
+ readonly description: "Discriminator: ONNX runtime backend.";
85
+ };
86
+ readonly providerConfig: {
87
+ readonly type: "object";
88
+ readonly description: "ONNX runtime-specific options.";
89
+ readonly properties: {
90
+ readonly pipeline: {
91
+ readonly type: "string";
92
+ readonly enum: ("fill-mask" | "token-classification" | "text-generation" | "text2text-generation" | "text-classification" | "summarization" | "translation" | "feature-extraction" | "zero-shot-classification" | "question-answering" | "background-removal" | "image-segmentation" | "depth-estimation" | "image-classification" | "image-to-image" | "object-detection" | "image-feature-extraction" | "audio-classification" | "automatic-speech-recognition" | "text-to-speech" | "document-question-answering" | "image-to-text" | "zero-shot-audio-classification" | "zero-shot-image-classification" | "zero-shot-object-detection")[];
93
+ readonly description: "Pipeline type for the ONNX model.";
94
+ readonly default: "text-generation";
95
+ };
96
+ readonly modelPath: {
97
+ readonly type: "string";
98
+ readonly description: "Filesystem path or URI for the ONNX model.";
99
+ };
100
+ readonly dType: {
101
+ readonly type: "string";
102
+ readonly enum: ("auto" | "fp32" | "fp16" | "q8" | "int8" | "uint8" | "q4" | "bnb4" | "q4f16")[];
103
+ readonly description: "Data type for the ONNX model.";
104
+ readonly default: "float32";
105
+ };
106
+ readonly device: {
107
+ readonly type: "string";
108
+ readonly enum: readonly ["cpu", "gpu", "webgpu", "wasm", "metal"];
109
+ readonly description: "High-level device selection.";
110
+ readonly default: "webgpu";
111
+ };
112
+ readonly executionProviders: {
113
+ readonly type: "array";
114
+ readonly items: {
115
+ readonly type: "string";
116
+ };
117
+ readonly description: "Raw ONNX Runtime execution provider identifiers.";
118
+ };
119
+ readonly intraOpNumThreads: {
120
+ readonly type: "integer";
121
+ readonly minimum: 1;
122
+ };
123
+ readonly interOpNumThreads: {
124
+ readonly type: "integer";
125
+ readonly minimum: 1;
126
+ };
127
+ readonly useExternalDataFormat: {
128
+ readonly type: "boolean";
129
+ readonly description: "Whether the model uses external data format.";
130
+ };
131
+ readonly nativeDimensions: {
132
+ readonly type: "integer";
133
+ readonly description: "The native dimensions of the model.";
134
+ };
135
+ readonly normalize: {
136
+ readonly type: "boolean";
137
+ readonly description: "Whether the model uses normalization.";
138
+ };
139
+ readonly languageStyle: {
140
+ readonly type: "string";
141
+ readonly description: "The language style of the model.";
142
+ };
143
+ };
144
+ readonly required: readonly ["modelPath", "pipeline"];
145
+ readonly additionalProperties: false;
146
+ };
147
+ readonly model_id: {
148
+ readonly type: "string";
149
+ };
150
+ readonly tasks: {
151
+ readonly type: "array";
152
+ readonly items: {
153
+ readonly type: "string";
154
+ };
155
+ };
156
+ readonly title: {
157
+ readonly type: "string";
158
+ };
159
+ readonly description: {
160
+ readonly type: "string";
161
+ };
162
+ readonly metadata: {
163
+ readonly type: "object";
164
+ readonly default: {};
165
+ };
166
+ };
167
+ readonly required: readonly ["model_id", "tasks", "provider", "title", "description", "providerConfig", "metadata", "provider", "providerConfig"];
168
+ readonly additionalProperties: false;
169
+ };
170
+ export type HfTransformersOnnxModelRecord = FromSchema<typeof ExtendedModelSchema>;
171
+ export {};
172
+ //# sourceMappingURL=HFT_ModelSchema.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"HFT_ModelSchema.d.ts","sourceRoot":"","sources":["../../../src/hf-transformers/common/HFT_ModelSchema.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAGH,OAAO,EAAwB,UAAU,EAAE,MAAM,gBAAgB,CAAC;AAGlE,eAAO,MAAM,6BAA6B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAqED,CAAC;AAE1C,QAAA,MAAM,mBAAmB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAQgB,CAAC;AAE1C,MAAM,MAAM,6BAA6B,GAAG,UAAU,CAAC,OAAO,mBAAmB,CAAC,CAAC"}
@@ -5,6 +5,7 @@
5
5
  */
6
6
  export * from "./common/HFT_Constants";
7
7
  export * from "./common/HFT_JobRunFns";
8
+ export * from "./common/HFT_ModelSchema";
8
9
  export * from "./registry/HFT_Client_RegisterJobFns";
9
10
  export * from "./registry/HFT_Inline_RegisterJobFns";
10
11
  export * from "./registry/HFT_Worker_RegisterJobFns";
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/hf-transformers/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,cAAc,wBAAwB,CAAC;AACvC,cAAc,wBAAwB,CAAC;AACvC,cAAc,sCAAsC,CAAC;AACrD,cAAc,sCAAsC,CAAC;AACrD,cAAc,sCAAsC,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/hf-transformers/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,cAAc,wBAAwB,CAAC;AACvC,cAAc,wBAAwB,CAAC;AACvC,cAAc,0BAA0B,CAAC;AACzC,cAAc,sCAAsC,CAAC;AACrD,cAAc,sCAAsC,CAAC;AACrD,cAAc,sCAAsC,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"HFT_Inline_RegisterJobFns.d.ts","sourceRoot":"","sources":["../../../src/hf-transformers/registry/HFT_Inline_RegisterJobFns.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAGH,OAAO,EAAS,UAAU,EAAyB,MAAM,cAAc,CAAC;AACxE,OAAO,EAAsB,cAAc,EAAkB,MAAM,qBAAqB,CAAC;AAEzF,OAAO,EAAwB,SAAS,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAC;AAYnF;;;;;GAKG;AACH,wBAAsB,yBAAyB,CAC7C,MAAM,CAAC,EAAE,cAAc,CAAC,UAAU,CAAC,SAAS,CAAC,EAAE,UAAU,CAAC,GACzD,OAAO,CAAC,IAAI,CAAC,CAwCf"}
1
+ {"version":3,"file":"HFT_Inline_RegisterJobFns.d.ts","sourceRoot":"","sources":["../../../src/hf-transformers/registry/HFT_Inline_RegisterJobFns.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAGH,OAAO,EAAS,UAAU,EAA0C,MAAM,cAAc,CAAC;AACzF,OAAO,EAAsB,cAAc,EAAkB,MAAM,qBAAqB,CAAC;AAEzF,OAAO,EAAwB,SAAS,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAC;AAYnF;;;;;GAKG;AACH,wBAAsB,yBAAyB,CAC7C,MAAM,CAAC,EAAE,cAAc,CAAC,UAAU,CAAC,SAAS,CAAC,EAAE,UAAU,CAAC,GACzD,OAAO,CAAC,IAAI,CAAC,CAwCf"}
package/dist/index.js CHANGED
@@ -1,17 +1,55 @@
1
1
  // src/hf-transformers/common/HFT_Constants.ts
2
2
  var HF_TRANSFORMERS_ONNX = "HF_TRANSFORMERS_ONNX";
3
- var QUANTIZATION_DATA_TYPES;
4
- ((QUANTIZATION_DATA_TYPES2) => {
5
- QUANTIZATION_DATA_TYPES2["auto"] = "auto";
6
- QUANTIZATION_DATA_TYPES2["fp32"] = "fp32";
7
- QUANTIZATION_DATA_TYPES2["fp16"] = "fp16";
8
- QUANTIZATION_DATA_TYPES2["q8"] = "q8";
9
- QUANTIZATION_DATA_TYPES2["int8"] = "int8";
10
- QUANTIZATION_DATA_TYPES2["uint8"] = "uint8";
11
- QUANTIZATION_DATA_TYPES2["q4"] = "q4";
12
- QUANTIZATION_DATA_TYPES2["bnb4"] = "bnb4";
13
- QUANTIZATION_DATA_TYPES2["q4f16"] = "q4f16";
14
- })(QUANTIZATION_DATA_TYPES ||= {});
3
+ var QuantizationDataType = {
4
+ auto: "auto",
5
+ fp32: "fp32",
6
+ fp16: "fp16",
7
+ q8: "q8",
8
+ int8: "int8",
9
+ uint8: "uint8",
10
+ q4: "q4",
11
+ bnb4: "bnb4",
12
+ q4f16: "q4f16"
13
+ };
14
+ var TextPipelineUseCase = {
15
+ "fill-mask": "fill-mask",
16
+ "token-classification": "token-classification",
17
+ "text-generation": "text-generation",
18
+ "text2text-generation": "text2text-generation",
19
+ "text-classification": "text-classification",
20
+ summarization: "summarization",
21
+ translation: "translation",
22
+ "feature-extraction": "feature-extraction",
23
+ "zero-shot-classification": "zero-shot-classification",
24
+ "question-answering": "question-answering"
25
+ };
26
+ var VisionPipelineUseCase = {
27
+ "background-removal": "background-removal",
28
+ "image-segmentation": "image-segmentation",
29
+ "depth-estimation": "depth-estimation",
30
+ "image-classification": "image-classification",
31
+ "image-to-image": "image-to-image",
32
+ "object-detection": "object-detection",
33
+ "image-feature-extraction": "image-feature-extraction"
34
+ };
35
+ var AudioPipelineUseCase = {
36
+ "audio-classification": "audio-classification",
37
+ "automatic-speech-recognition": "automatic-speech-recognition",
38
+ "text-to-speech": "text-to-speech"
39
+ };
40
+ var MultimodalPipelineUseCase = {
41
+ "document-question-answering": "document-question-answering",
42
+ "image-to-text": "image-to-text",
43
+ "zero-shot-audio-classification": "zero-shot-audio-classification",
44
+ "zero-shot-image-classification": "zero-shot-image-classification",
45
+ "zero-shot-object-detection": "zero-shot-object-detection"
46
+ };
47
+ var PipelineUseCase = {
48
+ ...TextPipelineUseCase,
49
+ ...VisionPipelineUseCase,
50
+ ...AudioPipelineUseCase,
51
+ ...MultimodalPipelineUseCase
52
+ };
15
53
  // src/hf-transformers/common/HFT_JobRunFns.ts
16
54
  import {
17
55
  pipeline,
@@ -20,8 +58,8 @@ import {
20
58
  import { PermanentJobError } from "@workglow/job-queue";
21
59
  var pipelines = new Map;
22
60
  var getPipeline = async (model, onProgress, options = {}) => {
23
- if (pipelines.has(model.name)) {
24
- return pipelines.get(model.name);
61
+ if (pipelines.has(model.model_id)) {
62
+ return pipelines.get(model.model_id);
25
63
  }
26
64
  const progressCallback = (status) => {
27
65
  const progress = status.status === "progress" ? Math.round(status.progress) : 0;
@@ -33,15 +71,15 @@ var getPipeline = async (model, onProgress, options = {}) => {
33
71
  }
34
72
  };
35
73
  const pipelineOptions = {
36
- dtype: model.quantization || "q8",
37
- ...model.use_external_data_format ? { use_external_data_format: model.use_external_data_format } : {},
38
- ...model.device ? { device: model.device } : {},
74
+ dtype: model.providerConfig.dType || "q8",
75
+ ...model.providerConfig.useExternalDataFormat ? { use_external_data_format: model.providerConfig.useExternalDataFormat } : {},
76
+ ...model.providerConfig.device ? { device: model.providerConfig.device } : {},
39
77
  ...options,
40
78
  progress_callback: progressCallback
41
79
  };
42
- const pipelineType = model.pipeline;
43
- const result = await pipeline(pipelineType, model.url, pipelineOptions);
44
- pipelines.set(model.name, result);
80
+ const pipelineType = model.providerConfig.pipeline;
81
+ const result = await pipeline(pipelineType, model.providerConfig.modelPath, pipelineOptions);
82
+ pipelines.set(model.model_id, result);
45
83
  return result;
46
84
  };
47
85
  var HFT_Download = async (input, model, onProgress, signal) => {
@@ -56,12 +94,12 @@ var HFT_TextEmbedding = async (input, model, onProgress, signal) => {
56
94
  });
57
95
  const hfVector = await generateEmbedding(input.text, {
58
96
  pooling: "mean",
59
- normalize: model.normalize,
97
+ normalize: model?.providerConfig.normalize,
60
98
  ...signal ? { abort_signal: signal } : {}
61
99
  });
62
- if (hfVector.size !== model.nativeDimensions) {
63
- console.warn(`HuggingFace Embedding vector length does not match model dimensions v${hfVector.size} != m${model.nativeDimensions}`, input, hfVector);
64
- throw new PermanentJobError(`HuggingFace Embedding vector length does not match model dimensions v${hfVector.size} != m${model.nativeDimensions}`);
100
+ if (hfVector.size !== model?.providerConfig.nativeDimensions) {
101
+ console.warn(`HuggingFace Embedding vector length does not match model dimensions v${hfVector.size} != m${model?.providerConfig.nativeDimensions}`, input, hfVector);
102
+ throw new PermanentJobError(`HuggingFace Embedding vector length does not match model dimensions v${hfVector.size} != m${model?.providerConfig.nativeDimensions}`);
65
103
  }
66
104
  return { vector: hfVector.data };
67
105
  };
@@ -184,6 +222,87 @@ function createTextStreamer(tokenizer, updateProgress, signal) {
184
222
  ...signal ? { abort_signal: signal } : {}
185
223
  });
186
224
  }
225
+ // src/hf-transformers/common/HFT_ModelSchema.ts
226
+ import { ModelSchema } from "@workglow/ai";
227
+ var HfTransformersOnnxModelSchema = {
228
+ type: "object",
229
+ properties: {
230
+ provider: {
231
+ const: HF_TRANSFORMERS_ONNX,
232
+ description: "Discriminator: ONNX runtime backend."
233
+ },
234
+ providerConfig: {
235
+ type: "object",
236
+ description: "ONNX runtime-specific options.",
237
+ properties: {
238
+ pipeline: {
239
+ type: "string",
240
+ enum: Object.values(PipelineUseCase),
241
+ description: "Pipeline type for the ONNX model.",
242
+ default: "text-generation"
243
+ },
244
+ modelPath: {
245
+ type: "string",
246
+ description: "Filesystem path or URI for the ONNX model."
247
+ },
248
+ dType: {
249
+ type: "string",
250
+ enum: Object.values(QuantizationDataType),
251
+ description: "Data type for the ONNX model.",
252
+ default: "float32"
253
+ },
254
+ device: {
255
+ type: "string",
256
+ enum: ["cpu", "gpu", "webgpu", "wasm", "metal"],
257
+ description: "High-level device selection.",
258
+ default: "webgpu"
259
+ },
260
+ executionProviders: {
261
+ type: "array",
262
+ items: { type: "string" },
263
+ description: "Raw ONNX Runtime execution provider identifiers."
264
+ },
265
+ intraOpNumThreads: {
266
+ type: "integer",
267
+ minimum: 1
268
+ },
269
+ interOpNumThreads: {
270
+ type: "integer",
271
+ minimum: 1
272
+ },
273
+ useExternalDataFormat: {
274
+ type: "boolean",
275
+ description: "Whether the model uses external data format."
276
+ },
277
+ nativeDimensions: {
278
+ type: "integer",
279
+ description: "The native dimensions of the model."
280
+ },
281
+ normalize: {
282
+ type: "boolean",
283
+ description: "Whether the model uses normalization."
284
+ },
285
+ languageStyle: {
286
+ type: "string",
287
+ description: "The language style of the model."
288
+ }
289
+ },
290
+ required: ["modelPath", "pipeline"],
291
+ additionalProperties: false
292
+ }
293
+ },
294
+ required: ["provider", "providerConfig"],
295
+ additionalProperties: true
296
+ };
297
+ var ExtendedModelSchema = {
298
+ type: "object",
299
+ properties: {
300
+ ...ModelSchema.properties,
301
+ ...HfTransformersOnnxModelSchema.properties
302
+ },
303
+ required: [...ModelSchema.required, ...HfTransformersOnnxModelSchema.required],
304
+ additionalProperties: false
305
+ };
187
306
  // src/hf-transformers/registry/HFT_Client_RegisterJobFns.ts
188
307
  import { AiJob, getAiProviderRegistry } from "@workglow/ai";
189
308
  import { ConcurrencyLimiter, JobQueueClient, JobQueueServer } from "@workglow/job-queue";
@@ -289,7 +408,7 @@ var TFMP_Download = async (input, model, onProgress, signal) => {
289
408
  const textFiles = await FilesetResolver.forTextTasks("https://cdn.jsdelivr.net/npm/@mediapipe/tasks-text@latest/wasm");
290
409
  const embedder = await TextEmbedder.createFromOptions(textFiles, {
291
410
  baseOptions: {
292
- modelAssetPath: model.url
411
+ modelAssetPath: model.providerConfig.modelPath
293
412
  }
294
413
  });
295
414
  return {
@@ -301,7 +420,7 @@ var TFMP_TextEmbedding = async (input, model, onProgress, signal) => {
301
420
  onProgress(0.1, "Model loaded");
302
421
  const embedder = await TextEmbedder.createFromOptions(textFiles, {
303
422
  baseOptions: {
304
- modelAssetPath: model.url
423
+ modelAssetPath: model.providerConfig.modelPath
305
424
  }
306
425
  });
307
426
  if (signal.aborted) {
@@ -317,6 +436,40 @@ var TFMP_TextEmbedding = async (input, model, onProgress, signal) => {
317
436
  vector: embedding
318
437
  };
319
438
  };
439
+ // src/tf-mediapipe/common/TFMP_ModelSchema.ts
440
+ import { ModelSchema as ModelSchema2 } from "@workglow/ai";
441
+ var TFMPModelSchema = {
442
+ type: "object",
443
+ properties: {
444
+ provider: {
445
+ const: TENSORFLOW_MEDIAPIPE,
446
+ description: "Discriminator: TensorFlow MediaPipe backend."
447
+ },
448
+ providerConfig: {
449
+ type: "object",
450
+ description: "TensorFlow MediaPipe-specific options.",
451
+ properties: {
452
+ modelPath: {
453
+ type: "string",
454
+ description: "Filesystem path or URI for the ONNX model."
455
+ }
456
+ },
457
+ required: ["modelPath"],
458
+ additionalProperties: false
459
+ }
460
+ },
461
+ required: ["provider", "providerConfig"],
462
+ additionalProperties: true
463
+ };
464
+ var ExtendedModelSchema2 = {
465
+ type: "object",
466
+ properties: {
467
+ ...ModelSchema2.properties,
468
+ ...TFMPModelSchema.properties
469
+ },
470
+ required: [...ModelSchema2.required, ...TFMPModelSchema.required],
471
+ additionalProperties: false
472
+ };
320
473
  // src/tf-mediapipe/registry/TFMP_Client_RegisterJobFns.ts
321
474
  import { AiJob as AiJob3, getAiProviderRegistry as getAiProviderRegistry3 } from "@workglow/ai";
322
475
  import { ConcurrencyLimiter as ConcurrencyLimiter3, JobQueueClient as JobQueueClient3, JobQueueServer as JobQueueServer3 } from "@workglow/job-queue";
@@ -395,12 +548,18 @@ export {
395
548
  register_TFMP_ClientJobFns,
396
549
  register_HFT_InlineJobFns,
397
550
  register_HFT_ClientJobFns,
551
+ VisionPipelineUseCase,
552
+ TextPipelineUseCase,
398
553
  TFMP_WORKER_JOBRUN_REGISTER,
399
554
  TFMP_WORKER_JOBRUN,
400
555
  TFMP_TextEmbedding,
401
556
  TFMP_Download,
557
+ TFMPModelSchema,
402
558
  TENSORFLOW_MEDIAPIPE,
403
- QUANTIZATION_DATA_TYPES,
559
+ QuantizationDataType,
560
+ PipelineUseCase,
561
+ MultimodalPipelineUseCase,
562
+ HfTransformersOnnxModelSchema,
404
563
  HF_TRANSFORMERS_ONNX,
405
564
  HFT_WORKER_JOBRUN_REGISTER,
406
565
  HFT_WORKER_JOBRUN,
@@ -410,7 +569,8 @@ export {
410
569
  HFT_TextQuestionAnswer,
411
570
  HFT_TextGeneration,
412
571
  HFT_TextEmbedding,
413
- HFT_Download
572
+ HFT_Download,
573
+ AudioPipelineUseCase
414
574
  };
415
575
 
416
- //# debugId=FBD90EC190EA5D0364756E2164756E21
576
+ //# debugId=DB92C181C46D973A64756E2164756E21
package/dist/index.js.map CHANGED
@@ -1,19 +1,21 @@
1
1
  {
2
2
  "version": 3,
3
- "sources": ["../src/hf-transformers/common/HFT_Constants.ts", "../src/hf-transformers/common/HFT_JobRunFns.ts", "../src/hf-transformers/registry/HFT_Client_RegisterJobFns.ts", "../src/hf-transformers/registry/HFT_Inline_RegisterJobFns.ts", "../src/hf-transformers/registry/HFT_Worker_RegisterJobFns.ts", "../src/tf-mediapipe/common/TFMP_Constants.ts", "../src/tf-mediapipe/common/TFMP_JobRunFns.ts", "../src/tf-mediapipe/registry/TFMP_Client_RegisterJobFns.ts", "../src/tf-mediapipe/registry/TFMP_Inline_RegisterJobFns.ts", "../src/tf-mediapipe/registry/TFMP_Worker_RegisterJobFns.ts"],
3
+ "sources": ["../src/hf-transformers/common/HFT_Constants.ts", "../src/hf-transformers/common/HFT_JobRunFns.ts", "../src/hf-transformers/common/HFT_ModelSchema.ts", "../src/hf-transformers/registry/HFT_Client_RegisterJobFns.ts", "../src/hf-transformers/registry/HFT_Inline_RegisterJobFns.ts", "../src/hf-transformers/registry/HFT_Worker_RegisterJobFns.ts", "../src/tf-mediapipe/common/TFMP_Constants.ts", "../src/tf-mediapipe/common/TFMP_JobRunFns.ts", "../src/tf-mediapipe/common/TFMP_ModelSchema.ts", "../src/tf-mediapipe/registry/TFMP_Client_RegisterJobFns.ts", "../src/tf-mediapipe/registry/TFMP_Inline_RegisterJobFns.ts", "../src/tf-mediapipe/registry/TFMP_Worker_RegisterJobFns.ts"],
4
4
  "sourcesContent": [
5
- "/**\n * @license\n * Copyright 2025 Steven Roussey <sroussey@gmail.com>\n * SPDX-License-Identifier: Apache-2.0\n */\n\nexport const HF_TRANSFORMERS_ONNX = \"HF_TRANSFORMERS_ONNX\";\n\nexport enum QUANTIZATION_DATA_TYPES {\n auto = \"auto\", // Auto-detect based on environment\n fp32 = \"fp32\",\n fp16 = \"fp16\",\n q8 = \"q8\",\n int8 = \"int8\",\n uint8 = \"uint8\",\n q4 = \"q4\",\n bnb4 = \"bnb4\",\n q4f16 = \"q4f16\", // fp16 model with int4 block weight quantization\n}\n",
6
- "/**\n * @license\n * Copyright 2025 Steven Roussey <sroussey@gmail.com>\n * SPDX-License-Identifier: Apache-2.0\n */\n\nimport {\n DocumentQuestionAnsweringSingle,\n type FeatureExtractionPipeline,\n pipeline,\n type PipelineType,\n // @ts-ignore temporary \"fix\"\n type PretrainedModelOptions,\n QuestionAnsweringPipeline,\n SummarizationPipeline,\n SummarizationSingle,\n type TextGenerationPipeline,\n TextGenerationSingle,\n TextStreamer,\n TranslationPipeline,\n TranslationSingle,\n} from \"@sroussey/transformers\";\nimport {\n AiProviderRunFn,\n type DeReplicateFromSchema,\n DownloadModelTaskExecuteInput,\n Model,\n TextEmbeddingInputSchema,\n TextEmbeddingOutputSchema,\n TextGenerationInputSchema,\n TextGenerationOutputSchema,\n TextQuestionAnswerInputSchema,\n TextQuestionAnswerOutputSchema,\n TextRewriterInputSchema,\n TextRewriterOutputSchema,\n TextSummaryInputSchema,\n TextSummaryOutputSchema,\n TextTranslationInputSchema,\n TextTranslationOutputSchema,\n TypedArray,\n} from \"@workglow/ai\";\nimport { PermanentJobError } from \"@workglow/job-queue\";\nimport { CallbackStatus } from \"./HFT_CallbackStatus\";\nimport { QUANTIZATION_DATA_TYPES } from \"./HFT_Constants\";\n\nconst pipelines = new Map<string, any>();\n\n/**\n * Helper function to get a pipeline for a model\n */\nconst getPipeline = async (\n model: Model,\n onProgress: (progress: number, message?: string, details?: any) => void,\n options: PretrainedModelOptions = {}\n) => {\n if (pipelines.has(model.name)) {\n return pipelines.get(model.name);\n }\n\n // Create a callback status object for progress tracking\n const progressCallback = (status: CallbackStatus) => {\n const progress = status.status === \"progress\" ? Math.round(status.progress) : 0;\n if (status.status === \"progress\") {\n onProgress(progress, \"Downloading model\", {\n file: status.file,\n progress: status.progress,\n });\n }\n };\n\n const pipelineOptions: PretrainedModelOptions = {\n dtype: (model.quantization as QUANTIZATION_DATA_TYPES) || \"q8\",\n ...(model.use_external_data_format\n ? { use_external_data_format: model.use_external_data_format }\n : {}),\n ...(model.device ? { device: model.device as any } : {}),\n ...options,\n progress_callback: progressCallback,\n };\n\n const pipelineType = model.pipeline as PipelineType;\n const result = await pipeline(pipelineType, model.url, pipelineOptions);\n pipelines.set(model.name, result);\n return result;\n};\n\n/**\n * Core implementation for downloading and caching a Hugging Face Transformers model.\n * This is shared between inline and worker implementations.\n */\nexport const HFT_Download: AiProviderRunFn<\n DownloadModelTaskExecuteInput,\n DownloadModelTaskExecuteInput\n> = async (input, model, onProgress, signal) => {\n // Download the model by creating a pipeline\n await getPipeline(model!, onProgress, { abort_signal: signal });\n\n return {\n model: input.model!,\n };\n};\n\n/**\n * Core implementation for text embedding using Hugging Face Transformers.\n * This is shared between inline and worker implementations.\n */\n\ntype TextEmbeddingInput = DeReplicateFromSchema<typeof TextEmbeddingInputSchema>;\ntype TextEmbeddingOutput = DeReplicateFromSchema<typeof TextEmbeddingOutputSchema>;\nexport const HFT_TextEmbedding: AiProviderRunFn<TextEmbeddingInput, TextEmbeddingOutput> = async (\n input,\n model,\n onProgress,\n signal\n) => {\n const generateEmbedding: FeatureExtractionPipeline = await getPipeline(model!, onProgress, {\n abort_signal: signal,\n });\n\n // Generate the embedding\n const hfVector = await generateEmbedding(input.text, {\n pooling: \"mean\",\n normalize: model!.normalize,\n ...(signal ? { abort_signal: signal } : {}),\n });\n\n // Validate the embedding dimensions\n if (hfVector.size !== model!.nativeDimensions) {\n console.warn(\n `HuggingFace Embedding vector length does not match model dimensions v${hfVector.size} != m${model!.nativeDimensions}`,\n input,\n hfVector\n );\n throw new PermanentJobError(\n `HuggingFace Embedding vector length does not match model dimensions v${hfVector.size} != m${model!.nativeDimensions}`\n );\n }\n\n return { vector: hfVector.data as TypedArray };\n};\n\n/**\n * Core implementation for text generation using Hugging Face Transformers.\n * This is shared between inline and worker implementations.\n */\nexport const HFT_TextGeneration: AiProviderRunFn<\n DeReplicateFromSchema<typeof TextGenerationInputSchema>,\n DeReplicateFromSchema<typeof TextGenerationOutputSchema>\n> = async (input, model, onProgress, signal) => {\n const generateText: TextGenerationPipeline = await getPipeline(model!, onProgress, {\n abort_signal: signal,\n });\n\n const streamer = createTextStreamer(generateText.tokenizer, onProgress, signal);\n\n let results = await generateText(input.prompt, {\n streamer,\n ...(signal ? { abort_signal: signal } : {}),\n });\n\n if (!Array.isArray(results)) {\n results = [results];\n }\n let text = (results[0] as TextGenerationSingle)?.generated_text;\n\n if (Array.isArray(text)) {\n text = text[text.length - 1]?.content;\n }\n return {\n text,\n };\n};\n\n/**\n * Core implementation for text translation using Hugging Face Transformers.\n * This is shared between inline and worker implementations.\n */\nexport const HFT_TextTranslation: AiProviderRunFn<\n DeReplicateFromSchema<typeof TextTranslationInputSchema>,\n DeReplicateFromSchema<typeof TextTranslationOutputSchema>\n> = async (input, model, onProgress, signal) => {\n const translate: TranslationPipeline = await getPipeline(model!, onProgress, {\n abort_signal: signal,\n });\n const streamer = createTextStreamer(translate.tokenizer, onProgress);\n\n const result = await translate(input.text, {\n src_lang: input.source_lang,\n tgt_lang: input.target_lang,\n streamer,\n ...(signal ? { abort_signal: signal } : {}),\n } as any);\n\n let translatedText: string | string[] = \"\";\n if (Array.isArray(result)) {\n translatedText = result.map((r) => (r as TranslationSingle)?.translation_text || \"\");\n } else {\n translatedText = (result as TranslationSingle)?.translation_text || \"\";\n }\n\n return {\n text: translatedText,\n target_lang: input.target_lang,\n };\n};\n\n/**\n * Core implementation for text rewriting using Hugging Face Transformers.\n * This is shared between inline and worker implementations.\n */\nexport const HFT_TextRewriter: AiProviderRunFn<\n DeReplicateFromSchema<typeof TextRewriterInputSchema>,\n DeReplicateFromSchema<typeof TextRewriterOutputSchema>\n> = async (input, model, onProgress, signal) => {\n const generateText: TextGenerationPipeline = await getPipeline(model!, onProgress, {\n abort_signal: signal,\n });\n const streamer = createTextStreamer(generateText.tokenizer, onProgress);\n\n // This lib doesn't support this kind of rewriting with a separate prompt vs text\n const promptedText = (input.prompt ? input.prompt + \"\\n\" : \"\") + input.text;\n\n let results = await generateText(promptedText, {\n streamer,\n ...(signal ? { abort_signal: signal } : {}),\n });\n\n if (!Array.isArray(results)) {\n results = [results];\n }\n\n let text = (results[0] as TextGenerationSingle)?.generated_text;\n if (Array.isArray(text)) {\n text = text[text.length - 1]?.content;\n }\n\n if (text === promptedText) {\n throw new PermanentJobError(\"Rewriter failed to generate new text\");\n }\n\n return {\n text,\n };\n};\n\n/**\n * Core implementation for text summarization using Hugging Face Transformers.\n * This is shared between inline and worker implementations.\n */\nexport const HFT_TextSummary: AiProviderRunFn<\n DeReplicateFromSchema<typeof TextSummaryInputSchema>,\n DeReplicateFromSchema<typeof TextSummaryOutputSchema>\n> = async (input, model, onProgress, signal) => {\n const generateSummary: SummarizationPipeline = await getPipeline(model!, onProgress, {\n abort_signal: signal,\n });\n const streamer = createTextStreamer(generateSummary.tokenizer, onProgress);\n\n let result = await generateSummary(input.text, {\n streamer,\n ...(signal ? { abort_signal: signal } : {}),\n } as any);\n\n let summaryText = \"\";\n if (Array.isArray(result)) {\n summaryText = (result[0] as SummarizationSingle)?.summary_text || \"\";\n } else {\n summaryText = (result as SummarizationSingle)?.summary_text || \"\";\n }\n\n return {\n text: summaryText,\n };\n};\n\n/**\n * Core implementation for question answering using Hugging Face Transformers.\n * This is shared between inline and worker implementations.\n */\nexport const HFT_TextQuestionAnswer: AiProviderRunFn<\n DeReplicateFromSchema<typeof TextQuestionAnswerInputSchema>,\n DeReplicateFromSchema<typeof TextQuestionAnswerOutputSchema>\n> = async (input, model, onProgress, signal) => {\n // Get the question answering pipeline\n const generateAnswer: QuestionAnsweringPipeline = await getPipeline(model!, onProgress, {\n abort_signal: signal,\n });\n const streamer = createTextStreamer(generateAnswer.tokenizer, onProgress);\n\n const result = await generateAnswer(input.question, input.context, {\n streamer,\n ...(signal ? { abort_signal: signal } : {}),\n } as any);\n\n let answerText = \"\";\n if (Array.isArray(result)) {\n answerText = (result[0] as DocumentQuestionAnsweringSingle)?.answer || \"\";\n } else {\n answerText = (result as DocumentQuestionAnsweringSingle)?.answer || \"\";\n }\n\n return {\n text: answerText,\n };\n};\n\n/**\n * Create a text streamer for a given tokenizer and update progress function\n * @param tokenizer - The tokenizer to use for the streamer\n * @param updateProgress - The function to call to update the progress\n * @param signal - The signal to use for the streamer for aborting\n * @returns The text streamer\n */\nfunction createTextStreamer(\n tokenizer: any,\n updateProgress: (progress: number, message?: string, details?: any) => void,\n signal?: AbortSignal\n) {\n let count = 0;\n return new TextStreamer(tokenizer, {\n skip_prompt: true,\n decode_kwargs: { skip_special_tokens: true },\n callback_function: (text: string) => {\n count++;\n const result = 100 * (1 - Math.exp(-0.05 * count));\n const progress = Math.round(Math.min(result, 100));\n updateProgress(progress, \"Generating\", { text, progress });\n },\n ...(signal ? { abort_signal: signal } : {}),\n });\n}\n",
5
+ "/**\n * @license\n * Copyright 2025 Steven Roussey <sroussey@gmail.com>\n * SPDX-License-Identifier: Apache-2.0\n */\n\nexport const HF_TRANSFORMERS_ONNX = \"HF_TRANSFORMERS_ONNX\";\n\nexport type QuantizationDataType =\n | \"auto\" // Auto-detect based on environment\n | \"fp32\"\n | \"fp16\"\n | \"q8\"\n | \"int8\"\n | \"uint8\"\n | \"q4\"\n | \"bnb4\"\n | \"q4f16\"; // fp16 model with int4 block weight quantization\n\nexport const QuantizationDataType = {\n auto: \"auto\",\n fp32: \"fp32\",\n fp16: \"fp16\",\n q8: \"q8\",\n int8: \"int8\",\n uint8: \"uint8\",\n q4: \"q4\",\n bnb4: \"bnb4\",\n q4f16: \"q4f16\",\n} as const satisfies Record<QuantizationDataType, QuantizationDataType>;\n\nexport type TextPipelineUseCase =\n | \"fill-mask\" // https://huggingface.co/tasks/fill-mask\n | \"token-classification\" // https://huggingface.co/tasks/token-classification\n | \"text-generation\" // https://huggingface.co/tasks/text-generation#completion-generation-models\n | \"text2text-generation\" // https://huggingface.co/tasks/text-generation#text-to-text-generation-models\n | \"text-classification\" // https://huggingface.co/tasks/text-classification\n | \"summarization\" // https://huggingface.co/tasks/sentence-similarity\n | \"translation\" // https://huggingface.co/tasks/translation\n | \"feature-extraction\" // https://huggingface.co/tasks/feature-extraction\n | \"zero-shot-classification\" // https://huggingface.co/tasks/zero-shot-classification\n | \"question-answering\"; // https://huggingface.co/tasks/question-answering\n\nexport const TextPipelineUseCase = {\n \"fill-mask\": \"fill-mask\",\n \"token-classification\": \"token-classification\",\n \"text-generation\": \"text-generation\",\n \"text2text-generation\": \"text2text-generation\",\n \"text-classification\": \"text-classification\",\n summarization: \"summarization\",\n translation: \"translation\",\n \"feature-extraction\": \"feature-extraction\",\n \"zero-shot-classification\": \"zero-shot-classification\",\n \"question-answering\": \"question-answering\",\n} as const satisfies Record<TextPipelineUseCase, TextPipelineUseCase>;\n\nexport type VisionPipelineUseCase =\n | \"background-removal\" // https://huggingface.co/tasks/image-segmentation#background-removal\n | \"image-segmentation\" // https://huggingface.co/tasks/image-segmentation\n | \"depth-estimation\" // https://huggingface.co/tasks/depth-estimation\n | \"image-classification\" // https://huggingface.co/tasks/image-classification\n | \"image-to-image\" // https://huggingface.co/tasks/image-to-image\n | \"object-detection\" // https://huggingface.co/tasks/object-detection\n | \"image-feature-extraction\"; // https://huggingface.co/tasks/image-feature-extraction\n\nexport const VisionPipelineUseCase = {\n \"background-removal\": \"background-removal\",\n \"image-segmentation\": \"image-segmentation\",\n \"depth-estimation\": \"depth-estimation\",\n \"image-classification\": \"image-classification\",\n \"image-to-image\": \"image-to-image\",\n \"object-detection\": \"object-detection\",\n \"image-feature-extraction\": \"image-feature-extraction\",\n} as const satisfies Record<VisionPipelineUseCase, VisionPipelineUseCase>;\n\nexport type AudioPipelineUseCase =\n | \"audio-classification\" // https://huggingface.co/tasks/audio-classification\n | \"automatic-speech-recognition\" // https://huggingface.co/tasks/automatic-speech-recognition\n | \"text-to-speech\"; // https://huggingface.co/tasks/text-to-speech\n\nexport const AudioPipelineUseCase = {\n \"audio-classification\": \"audio-classification\",\n \"automatic-speech-recognition\": \"automatic-speech-recognition\",\n \"text-to-speech\": \"text-to-speech\",\n} as const satisfies Record<AudioPipelineUseCase, AudioPipelineUseCase>;\n\nexport type MultimodalPipelineUseCase =\n | \"document-question-answering\" // https://huggingface.co/tasks/document-question-answering\n | \"image-to-text\" // https://huggingface.co/tasks/image-to-text\n | \"zero-shot-audio-classification\" // https://huggingface.co/tasks/zero-shot-audio-classification\n | \"zero-shot-image-classification\" // https://huggingface.co/tasks/zero-shot-image-classification\n | \"zero-shot-object-detection\"; // https://huggingface.co/tasks/zero-shot-object-detection\n\nexport const MultimodalPipelineUseCase = {\n \"document-question-answering\": \"document-question-answering\",\n \"image-to-text\": \"image-to-text\",\n \"zero-shot-audio-classification\": \"zero-shot-audio-classification\",\n \"zero-shot-image-classification\": \"zero-shot-image-classification\",\n \"zero-shot-object-detection\": \"zero-shot-object-detection\",\n} as const satisfies Record<MultimodalPipelineUseCase, MultimodalPipelineUseCase>;\n\nexport type PipelineUseCase =\n | TextPipelineUseCase\n | VisionPipelineUseCase\n | AudioPipelineUseCase\n | MultimodalPipelineUseCase;\n\nexport const PipelineUseCase = {\n ...TextPipelineUseCase,\n ...VisionPipelineUseCase,\n ...AudioPipelineUseCase,\n ...MultimodalPipelineUseCase,\n} as const satisfies Record<PipelineUseCase, PipelineUseCase>;\n",
6
+ "/**\n * @license\n * Copyright 2025 Steven Roussey <sroussey@gmail.com>\n * SPDX-License-Identifier: Apache-2.0\n */\n\nimport {\n DocumentQuestionAnsweringSingle,\n type FeatureExtractionPipeline,\n pipeline,\n // @ts-ignore temporary \"fix\"\n type PretrainedModelOptions,\n QuestionAnsweringPipeline,\n SummarizationPipeline,\n SummarizationSingle,\n type TextGenerationPipeline,\n TextGenerationSingle,\n TextStreamer,\n TranslationPipeline,\n TranslationSingle,\n} from \"@sroussey/transformers\";\nimport {\n AiProviderRunFn,\n type DeReplicateFromSchema,\n DownloadModelTaskExecuteInput,\n TextEmbeddingInputSchema,\n TextEmbeddingOutputSchema,\n TextGenerationInputSchema,\n TextGenerationOutputSchema,\n TextQuestionAnswerInputSchema,\n TextQuestionAnswerOutputSchema,\n TextRewriterInputSchema,\n TextRewriterOutputSchema,\n TextSummaryInputSchema,\n TextSummaryOutputSchema,\n TextTranslationInputSchema,\n TextTranslationOutputSchema,\n TypedArray,\n} from \"@workglow/ai\";\nimport { PermanentJobError } from \"@workglow/job-queue\";\nimport { CallbackStatus } from \"./HFT_CallbackStatus\";\nimport { HfTransformersOnnxModelRecord } from \"./HFT_ModelSchema\";\n\nconst pipelines = new Map<string, any>();\n\n/**\n * Helper function to get a pipeline for a model\n */\nconst getPipeline = async (\n model: HfTransformersOnnxModelRecord,\n onProgress: (progress: number, message?: string, details?: any) => void,\n options: PretrainedModelOptions = {}\n) => {\n if (pipelines.has(model.model_id)) {\n return pipelines.get(model.model_id);\n }\n\n // Create a callback status object for progress tracking\n const progressCallback = (status: CallbackStatus) => {\n const progress = status.status === \"progress\" ? Math.round(status.progress) : 0;\n if (status.status === \"progress\") {\n onProgress(progress, \"Downloading model\", {\n file: status.file,\n progress: status.progress,\n });\n }\n };\n\n const pipelineOptions: PretrainedModelOptions = {\n dtype: model.providerConfig.dType || \"q8\",\n ...(model.providerConfig.useExternalDataFormat\n ? { use_external_data_format: model.providerConfig.useExternalDataFormat }\n : {}),\n ...(model.providerConfig.device ? { device: model.providerConfig.device as any } : {}),\n ...options,\n progress_callback: progressCallback,\n };\n\n const pipelineType = model.providerConfig.pipeline;\n const result = await pipeline(pipelineType, model.providerConfig.modelPath, pipelineOptions);\n pipelines.set(model.model_id, result);\n return result;\n};\n\n/**\n * Core implementation for downloading and caching a Hugging Face Transformers model.\n * This is shared between inline and worker implementations.\n */\nexport const HFT_Download: AiProviderRunFn<\n DownloadModelTaskExecuteInput,\n DownloadModelTaskExecuteInput,\n HfTransformersOnnxModelRecord\n> = async (input, model, onProgress, signal) => {\n // Download the model by creating a pipeline\n await getPipeline(model!, onProgress, { abort_signal: signal });\n\n return {\n model: input.model!,\n };\n};\n\n/**\n * Core implementation for text embedding using Hugging Face Transformers.\n * This is shared between inline and worker implementations.\n */\n\nexport const HFT_TextEmbedding: AiProviderRunFn<\n DeReplicateFromSchema<typeof TextEmbeddingInputSchema>,\n DeReplicateFromSchema<typeof TextEmbeddingOutputSchema>,\n HfTransformersOnnxModelRecord\n> = async (input, model, onProgress, signal) => {\n const generateEmbedding: FeatureExtractionPipeline = await getPipeline(model!, onProgress, {\n abort_signal: signal,\n });\n\n // Generate the embedding\n const hfVector = await generateEmbedding(input.text, {\n pooling: \"mean\",\n normalize: model?.providerConfig.normalize,\n ...(signal ? { abort_signal: signal } : {}),\n });\n\n // Validate the embedding dimensions\n if (hfVector.size !== model?.providerConfig.nativeDimensions) {\n console.warn(\n `HuggingFace Embedding vector length does not match model dimensions v${hfVector.size} != m${model?.providerConfig.nativeDimensions}`,\n input,\n hfVector\n );\n throw new PermanentJobError(\n `HuggingFace Embedding vector length does not match model dimensions v${hfVector.size} != m${model?.providerConfig.nativeDimensions}`\n );\n }\n\n return { vector: hfVector.data as TypedArray };\n};\n\n/**\n * Core implementation for text generation using Hugging Face Transformers.\n * This is shared between inline and worker implementations.\n */\nexport const HFT_TextGeneration: AiProviderRunFn<\n DeReplicateFromSchema<typeof TextGenerationInputSchema>,\n DeReplicateFromSchema<typeof TextGenerationOutputSchema>,\n HfTransformersOnnxModelRecord\n> = async (input, model, onProgress, signal) => {\n const generateText: TextGenerationPipeline = await getPipeline(model!, onProgress, {\n abort_signal: signal,\n });\n\n const streamer = createTextStreamer(generateText.tokenizer, onProgress, signal);\n\n let results = await generateText(input.prompt, {\n streamer,\n ...(signal ? { abort_signal: signal } : {}),\n });\n\n if (!Array.isArray(results)) {\n results = [results];\n }\n let text = (results[0] as TextGenerationSingle)?.generated_text;\n\n if (Array.isArray(text)) {\n text = text[text.length - 1]?.content;\n }\n return {\n text,\n };\n};\n\n/**\n * Core implementation for text translation using Hugging Face Transformers.\n * This is shared between inline and worker implementations.\n */\nexport const HFT_TextTranslation: AiProviderRunFn<\n DeReplicateFromSchema<typeof TextTranslationInputSchema>,\n DeReplicateFromSchema<typeof TextTranslationOutputSchema>,\n HfTransformersOnnxModelRecord\n> = async (input, model, onProgress, signal) => {\n const translate: TranslationPipeline = await getPipeline(model!, onProgress, {\n abort_signal: signal,\n });\n const streamer = createTextStreamer(translate.tokenizer, onProgress);\n\n const result = await translate(input.text, {\n src_lang: input.source_lang,\n tgt_lang: input.target_lang,\n streamer,\n ...(signal ? { abort_signal: signal } : {}),\n } as any);\n\n let translatedText: string | string[] = \"\";\n if (Array.isArray(result)) {\n translatedText = result.map((r) => (r as TranslationSingle)?.translation_text || \"\");\n } else {\n translatedText = (result as TranslationSingle)?.translation_text || \"\";\n }\n\n return {\n text: translatedText,\n target_lang: input.target_lang,\n };\n};\n\n/**\n * Core implementation for text rewriting using Hugging Face Transformers.\n * This is shared between inline and worker implementations.\n */\nexport const HFT_TextRewriter: AiProviderRunFn<\n DeReplicateFromSchema<typeof TextRewriterInputSchema>,\n DeReplicateFromSchema<typeof TextRewriterOutputSchema>,\n HfTransformersOnnxModelRecord\n> = async (input, model, onProgress, signal) => {\n const generateText: TextGenerationPipeline = await getPipeline(model!, onProgress, {\n abort_signal: signal,\n });\n const streamer = createTextStreamer(generateText.tokenizer, onProgress);\n\n // This lib doesn't support this kind of rewriting with a separate prompt vs text\n const promptedText = (input.prompt ? input.prompt + \"\\n\" : \"\") + input.text;\n\n let results = await generateText(promptedText, {\n streamer,\n ...(signal ? { abort_signal: signal } : {}),\n });\n\n if (!Array.isArray(results)) {\n results = [results];\n }\n\n let text = (results[0] as TextGenerationSingle)?.generated_text;\n if (Array.isArray(text)) {\n text = text[text.length - 1]?.content;\n }\n\n if (text === promptedText) {\n throw new PermanentJobError(\"Rewriter failed to generate new text\");\n }\n\n return {\n text,\n };\n};\n\n/**\n * Core implementation for text summarization using Hugging Face Transformers.\n * This is shared between inline and worker implementations.\n */\nexport const HFT_TextSummary: AiProviderRunFn<\n DeReplicateFromSchema<typeof TextSummaryInputSchema>,\n DeReplicateFromSchema<typeof TextSummaryOutputSchema>,\n HfTransformersOnnxModelRecord\n> = async (input, model, onProgress, signal) => {\n const generateSummary: SummarizationPipeline = await getPipeline(model!, onProgress, {\n abort_signal: signal,\n });\n const streamer = createTextStreamer(generateSummary.tokenizer, onProgress);\n\n let result = await generateSummary(input.text, {\n streamer,\n ...(signal ? { abort_signal: signal } : {}),\n } as any);\n\n let summaryText = \"\";\n if (Array.isArray(result)) {\n summaryText = (result[0] as SummarizationSingle)?.summary_text || \"\";\n } else {\n summaryText = (result as SummarizationSingle)?.summary_text || \"\";\n }\n\n return {\n text: summaryText,\n };\n};\n\n/**\n * Core implementation for question answering using Hugging Face Transformers.\n * This is shared between inline and worker implementations.\n */\nexport const HFT_TextQuestionAnswer: AiProviderRunFn<\n DeReplicateFromSchema<typeof TextQuestionAnswerInputSchema>,\n DeReplicateFromSchema<typeof TextQuestionAnswerOutputSchema>,\n HfTransformersOnnxModelRecord\n> = async (input, model, onProgress, signal) => {\n // Get the question answering pipeline\n const generateAnswer: QuestionAnsweringPipeline = await getPipeline(model!, onProgress, {\n abort_signal: signal,\n });\n const streamer = createTextStreamer(generateAnswer.tokenizer, onProgress);\n\n const result = await generateAnswer(input.question, input.context, {\n streamer,\n ...(signal ? { abort_signal: signal } : {}),\n } as any);\n\n let answerText = \"\";\n if (Array.isArray(result)) {\n answerText = (result[0] as DocumentQuestionAnsweringSingle)?.answer || \"\";\n } else {\n answerText = (result as DocumentQuestionAnsweringSingle)?.answer || \"\";\n }\n\n return {\n text: answerText,\n };\n};\n\n/**\n * Create a text streamer for a given tokenizer and update progress function\n * @param tokenizer - The tokenizer to use for the streamer\n * @param updateProgress - The function to call to update the progress\n * @param signal - The signal to use for the streamer for aborting\n * @returns The text streamer\n */\nfunction createTextStreamer(\n tokenizer: any,\n updateProgress: (progress: number, message?: string, details?: any) => void,\n signal?: AbortSignal\n) {\n let count = 0;\n return new TextStreamer(tokenizer, {\n skip_prompt: true,\n decode_kwargs: { skip_special_tokens: true },\n callback_function: (text: string) => {\n count++;\n const result = 100 * (1 - Math.exp(-0.05 * count));\n const progress = Math.round(Math.min(result, 100));\n updateProgress(progress, \"Generating\", { text, progress });\n },\n ...(signal ? { abort_signal: signal } : {}),\n });\n}\n",
7
+ "/**\n * @license\n * Copyright 2025 Steven Roussey <sroussey@gmail.com>\n * SPDX-License-Identifier: Apache-2.0\n */\n\nimport { ModelSchema } from \"@workglow/ai\";\nimport { DataPortSchemaObject, FromSchema } from \"@workglow/util\";\nimport { HF_TRANSFORMERS_ONNX, PipelineUseCase, QuantizationDataType } from \"./HFT_Constants\";\n\nexport const HfTransformersOnnxModelSchema = {\n type: \"object\",\n properties: {\n provider: {\n const: HF_TRANSFORMERS_ONNX,\n description: \"Discriminator: ONNX runtime backend.\",\n },\n providerConfig: {\n type: \"object\",\n description: \"ONNX runtime-specific options.\",\n properties: {\n pipeline: {\n type: \"string\",\n enum: Object.values(PipelineUseCase),\n description: \"Pipeline type for the ONNX model.\",\n default: \"text-generation\",\n },\n modelPath: {\n type: \"string\",\n description: \"Filesystem path or URI for the ONNX model.\",\n },\n dType: {\n type: \"string\",\n enum: Object.values(QuantizationDataType),\n description: \"Data type for the ONNX model.\",\n default: \"float32\",\n },\n device: {\n type: \"string\",\n enum: [\"cpu\", \"gpu\", \"webgpu\", \"wasm\", \"metal\"],\n description: \"High-level device selection.\",\n default: \"webgpu\",\n },\n executionProviders: {\n type: \"array\",\n items: { type: \"string\" },\n description: \"Raw ONNX Runtime execution provider identifiers.\",\n },\n intraOpNumThreads: {\n type: \"integer\",\n minimum: 1,\n },\n interOpNumThreads: {\n type: \"integer\",\n minimum: 1,\n },\n useExternalDataFormat: {\n type: \"boolean\",\n description: \"Whether the model uses external data format.\",\n },\n nativeDimensions: {\n type: \"integer\",\n description: \"The native dimensions of the model.\",\n },\n normalize: {\n type: \"boolean\",\n description: \"Whether the model uses normalization.\",\n },\n languageStyle: {\n type: \"string\",\n description: \"The language style of the model.\",\n },\n },\n required: [\"modelPath\", \"pipeline\"],\n additionalProperties: false,\n },\n },\n required: [\"provider\", \"providerConfig\"],\n additionalProperties: true,\n} as const satisfies DataPortSchemaObject;\n\nconst ExtendedModelSchema = {\n type: \"object\",\n properties: {\n ...ModelSchema.properties,\n ...HfTransformersOnnxModelSchema.properties,\n },\n required: [...ModelSchema.required, ...HfTransformersOnnxModelSchema.required],\n additionalProperties: false,\n} as const satisfies DataPortSchemaObject;\n\nexport type HfTransformersOnnxModelRecord = FromSchema<typeof ExtendedModelSchema>;\n",
7
8
  "/**\n * @license\n * Copyright 2025 Steven Roussey <sroussey@gmail.com>\n * SPDX-License-Identifier: Apache-2.0\n */\n\nimport { AiJob, AiJobInput, getAiProviderRegistry } from \"@workglow/ai\";\nimport { ConcurrencyLimiter, JobQueueClient, JobQueueServer } from \"@workglow/job-queue\";\nimport { InMemoryQueueStorage } from \"@workglow/storage\";\nimport { getTaskQueueRegistry, TaskInput, TaskOutput } from \"@workglow/task-graph\";\nimport { globalServiceRegistry, WORKER_MANAGER } from \"@workglow/util\";\nimport { HF_TRANSFORMERS_ONNX } from \"../common/HFT_Constants\";\n\n/**\n * Registers the HuggingFace Transformers client job functions with a web worker.\n * If no client is provided, creates a default in-memory queue and registers it.\n *\n * @param worker - The web worker to use for job execution\n * @param client - Optional existing JobQueueClient. If not provided, creates a default in-memory queue.\n */\nexport async function register_HFT_ClientJobFns(\n worker: Worker,\n client?: JobQueueClient<AiJobInput<TaskInput>, TaskOutput>\n): Promise<void> {\n const workerManager = globalServiceRegistry.get(WORKER_MANAGER);\n\n workerManager.registerWorker(HF_TRANSFORMERS_ONNX, worker);\n\n const ProviderRegistry = getAiProviderRegistry();\n const names = [\n \"DownloadModelTask\",\n \"TextEmbeddingTask\",\n \"TextGenerationTask\",\n \"TextTranslationTask\",\n \"TextRewriterTask\",\n \"TextSummaryTask\",\n \"TextQuestionAnswerTask\",\n ];\n for (const name of names) {\n ProviderRegistry.registerAsWorkerRunFn(HF_TRANSFORMERS_ONNX, name);\n }\n // If no client provided, create a default in-memory queue\n if (!client) {\n const storage = new InMemoryQueueStorage<AiJobInput<TaskInput>, TaskOutput>(\n HF_TRANSFORMERS_ONNX\n );\n\n const server = new JobQueueServer<AiJobInput<TaskInput>, TaskOutput>(AiJob, {\n storage,\n queueName: HF_TRANSFORMERS_ONNX,\n limiter: new ConcurrencyLimiter(1, 100),\n });\n\n client = new JobQueueClient<AiJobInput<TaskInput>, TaskOutput>({\n storage,\n queueName: HF_TRANSFORMERS_ONNX,\n });\n\n client.attach(server);\n\n getTaskQueueRegistry().registerQueue({ server, client, storage });\n // await server.start();\n }\n}\n",
8
- "/**\n * @license\n * Copyright 2025 Steven Roussey <sroussey@gmail.com>\n * SPDX-License-Identifier: Apache-2.0\n */\n\nimport { env } from \"@sroussey/transformers\";\nimport { AiJob, AiJobInput, getAiProviderRegistry } from \"@workglow/ai\";\nimport { ConcurrencyLimiter, JobQueueClient, JobQueueServer } from \"@workglow/job-queue\";\nimport { InMemoryQueueStorage } from \"@workglow/storage\";\nimport { getTaskQueueRegistry, TaskInput, TaskOutput } from \"@workglow/task-graph\";\nimport { HF_TRANSFORMERS_ONNX } from \"../common/HFT_Constants\";\nimport {\n HFT_Download,\n HFT_TextEmbedding,\n HFT_TextGeneration,\n HFT_TextQuestionAnswer,\n HFT_TextRewriter,\n HFT_TextSummary,\n HFT_TextTranslation,\n} from \"../common/HFT_JobRunFns\";\n\n/**\n * Registers the HuggingFace Transformers inline job functions for same-thread execution.\n * If no client is provided, creates a default in-memory queue and registers it.\n *\n * @param client - Optional existing JobQueueClient. If not provided, creates a default in-memory queue.\n */\nexport async function register_HFT_InlineJobFns(\n client?: JobQueueClient<AiJobInput<TaskInput>, TaskOutput>\n): Promise<void> {\n // @ts-ignore\n env.backends.onnx.wasm.proxy = true;\n const ProviderRegistry = getAiProviderRegistry();\n const fns = {\n [\"DownloadModelTask\"]: HFT_Download,\n [\"TextEmbeddingTask\"]: HFT_TextEmbedding,\n [\"TextGenerationTask\"]: HFT_TextGeneration,\n [\"TextQuestionAnswerTask\"]: HFT_TextQuestionAnswer,\n [\"TextRewriterTask\"]: HFT_TextRewriter,\n [\"TextSummaryTask\"]: HFT_TextSummary,\n [\"TextTranslationTask\"]: HFT_TextTranslation,\n };\n for (const [jobName, fn] of Object.entries(fns)) {\n ProviderRegistry.registerRunFn<any, any>(HF_TRANSFORMERS_ONNX, jobName, fn);\n }\n\n // If no client provided, create a default in-memory queue\n if (!client) {\n const storage = new InMemoryQueueStorage<AiJobInput<TaskInput>, TaskOutput>(\n HF_TRANSFORMERS_ONNX\n );\n await storage.setupDatabase();\n\n const server = new JobQueueServer<AiJobInput<TaskInput>, TaskOutput>(AiJob, {\n storage,\n queueName: HF_TRANSFORMERS_ONNX,\n limiter: new ConcurrencyLimiter(1, 100),\n });\n\n client = new JobQueueClient<AiJobInput<TaskInput>, TaskOutput>({\n storage,\n queueName: HF_TRANSFORMERS_ONNX,\n });\n\n client.attach(server);\n\n getTaskQueueRegistry().registerQueue({ server, client, storage });\n await server.start();\n }\n}\n",
9
+ "/**\n * @license\n * Copyright 2025 Steven Roussey <sroussey@gmail.com>\n * SPDX-License-Identifier: Apache-2.0\n */\n\nimport { env } from \"@sroussey/transformers\";\nimport { AiJob, AiJobInput, AiProviderRunFn, getAiProviderRegistry } from \"@workglow/ai\";\nimport { ConcurrencyLimiter, JobQueueClient, JobQueueServer } from \"@workglow/job-queue\";\nimport { InMemoryQueueStorage } from \"@workglow/storage\";\nimport { getTaskQueueRegistry, TaskInput, TaskOutput } from \"@workglow/task-graph\";\nimport { HF_TRANSFORMERS_ONNX } from \"../common/HFT_Constants\";\nimport {\n HFT_Download,\n HFT_TextEmbedding,\n HFT_TextGeneration,\n HFT_TextQuestionAnswer,\n HFT_TextRewriter,\n HFT_TextSummary,\n HFT_TextTranslation,\n} from \"../common/HFT_JobRunFns\";\n\n/**\n * Registers the HuggingFace Transformers inline job functions for same-thread execution.\n * If no client is provided, creates a default in-memory queue and registers it.\n *\n * @param client - Optional existing JobQueueClient. If not provided, creates a default in-memory queue.\n */\nexport async function register_HFT_InlineJobFns(\n client?: JobQueueClient<AiJobInput<TaskInput>, TaskOutput>\n): Promise<void> {\n // @ts-ignore\n env.backends.onnx.wasm.proxy = true;\n const ProviderRegistry = getAiProviderRegistry();\n const fns: Record<string, AiProviderRunFn<any, any, any>> = {\n [\"DownloadModelTask\"]: HFT_Download,\n [\"TextEmbeddingTask\"]: HFT_TextEmbedding,\n [\"TextGenerationTask\"]: HFT_TextGeneration,\n [\"TextQuestionAnswerTask\"]: HFT_TextQuestionAnswer,\n [\"TextRewriterTask\"]: HFT_TextRewriter,\n [\"TextSummaryTask\"]: HFT_TextSummary,\n [\"TextTranslationTask\"]: HFT_TextTranslation,\n };\n for (const [jobName, fn] of Object.entries(fns)) {\n ProviderRegistry.registerRunFn<any, any>(HF_TRANSFORMERS_ONNX, jobName, fn);\n }\n\n // If no client provided, create a default in-memory queue\n if (!client) {\n const storage = new InMemoryQueueStorage<AiJobInput<TaskInput>, TaskOutput>(\n HF_TRANSFORMERS_ONNX\n );\n await storage.setupDatabase();\n\n const server = new JobQueueServer<AiJobInput<TaskInput>, TaskOutput>(AiJob, {\n storage,\n queueName: HF_TRANSFORMERS_ONNX,\n limiter: new ConcurrencyLimiter(1, 100),\n });\n\n client = new JobQueueClient<AiJobInput<TaskInput>, TaskOutput>({\n storage,\n queueName: HF_TRANSFORMERS_ONNX,\n });\n\n client.attach(server);\n\n getTaskQueueRegistry().registerQueue({ server, client, storage });\n await server.start();\n }\n}\n",
9
10
  "/**\n * @license\n * Copyright 2025 Steven Roussey <sroussey@gmail.com>\n * SPDX-License-Identifier: Apache-2.0\n */\n\nimport {\n createServiceToken,\n globalServiceRegistry,\n parentPort,\n WORKER_SERVER,\n} from \"@workglow/util\";\nimport {\n HFT_Download,\n HFT_TextEmbedding,\n HFT_TextGeneration,\n HFT_TextQuestionAnswer,\n HFT_TextRewriter,\n HFT_TextSummary,\n HFT_TextTranslation,\n} from \"../common/HFT_JobRunFns\";\n\nexport const HFT_WORKER_JOBRUN = createServiceToken(\"worker.ai-provider.hft\");\n\nexport const HFT_WORKER_JOBRUN_REGISTER = globalServiceRegistry.register(\n HFT_WORKER_JOBRUN,\n () => {\n const workerServer = globalServiceRegistry.get(WORKER_SERVER);\n workerServer.registerFunction(\"DownloadModelTask\", HFT_Download);\n workerServer.registerFunction(\"TextEmbeddingTask\", HFT_TextEmbedding);\n workerServer.registerFunction(\"TextGenerationTask\", HFT_TextGeneration);\n workerServer.registerFunction(\"TextTranslationTask\", HFT_TextTranslation);\n workerServer.registerFunction(\"TextRewriterTask\", HFT_TextRewriter);\n workerServer.registerFunction(\"TextSummaryTask\", HFT_TextSummary);\n workerServer.registerFunction(\"TextQuestionAnswerTask\", HFT_TextQuestionAnswer);\n parentPort.postMessage({ type: \"ready\" });\n console.log(\"HFT_WORKER_JOBRUN registered\");\n return workerServer;\n },\n true\n);\n",
10
11
  "/**\n * @license\n * Copyright 2025 Steven Roussey <sroussey@gmail.com>\n * SPDX-License-Identifier: Apache-2.0\n */\n\nexport const TENSORFLOW_MEDIAPIPE = \"TENSORFLOW_MEDIAPIPE\";\n",
11
- "/**\n * @license\n * Copyright 2025 Steven Roussey <sroussey@gmail.com>\n * SPDX-License-Identifier: Apache-2.0\n */\n\nimport { FilesetResolver, TextEmbedder } from \"@mediapipe/tasks-text\";\nimport type {\n AiProviderRunFn,\n DeReplicateFromSchema,\n DownloadModelTaskExecuteInput,\n DownloadModelTaskExecuteOutput,\n TextEmbeddingInputSchema,\n TextEmbeddingOutputSchema,\n} from \"@workglow/ai\";\nimport { PermanentJobError } from \"@workglow/job-queue\";\n\n/**\n * Core implementation for downloading and caching a MediaPipe TFJS model.\n * This is shared between inline and worker implementations.\n */\nexport const TFMP_Download: AiProviderRunFn<\n DownloadModelTaskExecuteInput,\n DownloadModelTaskExecuteOutput\n> = async (input, model, onProgress, signal) => {\n const textFiles = await FilesetResolver.forTextTasks(\n \"https://cdn.jsdelivr.net/npm/@mediapipe/tasks-text@latest/wasm\"\n );\n\n // Create an embedder to get dimensions\n const embedder = await TextEmbedder.createFromOptions(textFiles, {\n baseOptions: {\n modelAssetPath: model!.url,\n },\n });\n\n return {\n model: input.model,\n };\n};\n\n/**\n * Core implementation for text embedding using MediaPipe TFJS.\n * This is shared between inline and worker implementations.\n */\nexport const TFMP_TextEmbedding: AiProviderRunFn<\n DeReplicateFromSchema<typeof TextEmbeddingInputSchema>,\n DeReplicateFromSchema<typeof TextEmbeddingOutputSchema>\n> = async (input, model, onProgress, signal) => {\n const textFiles = await FilesetResolver.forTextTasks(\n \"https://cdn.jsdelivr.net/npm/@mediapipe/tasks-text@latest/wasm\"\n );\n\n onProgress(0.1, \"Model loaded\");\n\n const embedder = await TextEmbedder.createFromOptions(textFiles, {\n baseOptions: {\n modelAssetPath: model!.url,\n },\n });\n\n if (signal.aborted) {\n throw new PermanentJobError(\"Aborted job\");\n }\n\n onProgress(0.2, \"Embedding text\");\n\n const result = embedder.embed(input.text);\n\n if (!result.embeddings?.[0]?.floatEmbedding) {\n throw new PermanentJobError(\"Failed to generate embedding: Empty result\");\n }\n\n const embedding = Float32Array.from(result.embeddings[0].floatEmbedding);\n\n return {\n vector: embedding,\n };\n};\n",
12
+ "/**\n * @license\n * Copyright 2025 Steven Roussey <sroussey@gmail.com>\n * SPDX-License-Identifier: Apache-2.0\n */\n\nimport { FilesetResolver, TextEmbedder } from \"@mediapipe/tasks-text\";\nimport type {\n AiProviderRunFn,\n DeReplicateFromSchema,\n DownloadModelTaskExecuteInput,\n DownloadModelTaskExecuteOutput,\n TextEmbeddingInputSchema,\n TextEmbeddingOutputSchema,\n} from \"@workglow/ai\";\nimport { PermanentJobError } from \"@workglow/job-queue\";\nimport { TFMPModelRecord } from \"./TFMP_ModelSchema\";\n\n/**\n * Core implementation for downloading and caching a MediaPipe TFJS model.\n * This is shared between inline and worker implementations.\n */\nexport const TFMP_Download: AiProviderRunFn<\n DownloadModelTaskExecuteInput,\n DownloadModelTaskExecuteOutput,\n TFMPModelRecord\n> = async (input, model, onProgress, signal) => {\n const textFiles = await FilesetResolver.forTextTasks(\n \"https://cdn.jsdelivr.net/npm/@mediapipe/tasks-text@latest/wasm\"\n );\n\n // Create an embedder to get dimensions\n const embedder = await TextEmbedder.createFromOptions(textFiles, {\n baseOptions: {\n modelAssetPath: model!.providerConfig.modelPath,\n },\n });\n\n return {\n model: input.model,\n };\n};\n\n/**\n * Core implementation for text embedding using MediaPipe TFJS.\n * This is shared between inline and worker implementations.\n */\nexport const TFMP_TextEmbedding: AiProviderRunFn<\n DeReplicateFromSchema<typeof TextEmbeddingInputSchema>,\n DeReplicateFromSchema<typeof TextEmbeddingOutputSchema>,\n TFMPModelRecord\n> = async (input, model, onProgress, signal) => {\n const textFiles = await FilesetResolver.forTextTasks(\n \"https://cdn.jsdelivr.net/npm/@mediapipe/tasks-text@latest/wasm\"\n );\n\n onProgress(0.1, \"Model loaded\");\n\n const embedder = await TextEmbedder.createFromOptions(textFiles, {\n baseOptions: {\n modelAssetPath: model!.providerConfig.modelPath,\n },\n });\n\n if (signal.aborted) {\n throw new PermanentJobError(\"Aborted job\");\n }\n\n onProgress(0.2, \"Embedding text\");\n\n const result = embedder.embed(input.text);\n\n if (!result.embeddings?.[0]?.floatEmbedding) {\n throw new PermanentJobError(\"Failed to generate embedding: Empty result\");\n }\n\n const embedding = Float32Array.from(result.embeddings[0].floatEmbedding);\n\n return {\n vector: embedding,\n };\n};\n",
13
+ "/**\n * @license\n * Copyright 2025 Steven Roussey <sroussey@gmail.com>\n * SPDX-License-Identifier: Apache-2.0\n */\n\nimport { ModelSchema } from \"@workglow/ai\";\nimport { DataPortSchemaObject, FromSchema } from \"@workglow/util\";\nimport { TENSORFLOW_MEDIAPIPE } from \"../common/TFMP_Constants\";\n\nexport const TFMPModelSchema = {\n type: \"object\",\n properties: {\n provider: {\n const: TENSORFLOW_MEDIAPIPE,\n description: \"Discriminator: TensorFlow MediaPipe backend.\",\n },\n providerConfig: {\n type: \"object\",\n description: \"TensorFlow MediaPipe-specific options.\",\n properties: {\n modelPath: {\n type: \"string\",\n description: \"Filesystem path or URI for the ONNX model.\",\n },\n },\n required: [\"modelPath\"],\n additionalProperties: false,\n },\n },\n required: [\"provider\", \"providerConfig\"],\n additionalProperties: true,\n} as const satisfies DataPortSchemaObject;\n\nconst ExtendedModelSchema = {\n type: \"object\",\n properties: {\n ...ModelSchema.properties,\n ...TFMPModelSchema.properties,\n },\n required: [...ModelSchema.required, ...TFMPModelSchema.required],\n additionalProperties: false,\n} as const satisfies DataPortSchemaObject;\n\nexport type TFMPModelRecord = FromSchema<typeof ExtendedModelSchema>;\n",
12
14
  "/**\n * @license\n * Copyright 2025 Steven Roussey <sroussey@gmail.com>\n * SPDX-License-Identifier: Apache-2.0\n */\n\nimport { AiJob, AiJobInput, getAiProviderRegistry } from \"@workglow/ai\";\nimport { ConcurrencyLimiter, JobQueueClient, JobQueueServer } from \"@workglow/job-queue\";\nimport { InMemoryQueueStorage } from \"@workglow/storage\";\nimport { getTaskQueueRegistry, TaskInput, TaskOutput } from \"@workglow/task-graph\";\nimport { globalServiceRegistry, WORKER_MANAGER } from \"@workglow/util\";\nimport { TENSORFLOW_MEDIAPIPE } from \"../common/TFMP_Constants\";\n\n/**\n * Registers the TensorFlow MediaPipe client job functions with a web worker.\n * If no client is provided, creates a default in-memory queue and registers it.\n *\n * @param worker - The web worker to use for job execution\n * @param client - Optional existing JobQueueClient. If not provided, creates a default in-memory queue.\n */\nexport async function register_TFMP_ClientJobFns(\n worker: Worker,\n client?: JobQueueClient<AiJobInput<TaskInput>, TaskOutput>\n): Promise<void> {\n const workerManager = globalServiceRegistry.get(WORKER_MANAGER);\n workerManager.registerWorker(TENSORFLOW_MEDIAPIPE, worker);\n\n const aiProviderRegistry = getAiProviderRegistry();\n const names = [\"DownloadModelTask\", \"TextEmbeddingTask\"];\n for (const name of names) {\n aiProviderRegistry.registerAsWorkerRunFn(TENSORFLOW_MEDIAPIPE, name);\n }\n\n // If no client provided, create a default in-memory queue\n if (!client) {\n const storage = new InMemoryQueueStorage<AiJobInput<TaskInput>, TaskOutput>(\n TENSORFLOW_MEDIAPIPE\n );\n await storage.setupDatabase();\n\n const server = new JobQueueServer<AiJobInput<TaskInput>, TaskOutput>(AiJob, {\n storage,\n queueName: TENSORFLOW_MEDIAPIPE,\n limiter: new ConcurrencyLimiter(1, 100),\n });\n\n client = new JobQueueClient<AiJobInput<TaskInput>, TaskOutput>({\n storage,\n queueName: TENSORFLOW_MEDIAPIPE,\n });\n\n client.attach(server);\n\n getTaskQueueRegistry().registerQueue({ server, client, storage });\n await server.start();\n }\n}\n",
13
- "/**\n * @license\n * Copyright 2025 Steven Roussey <sroussey@gmail.com>\n * SPDX-License-Identifier: Apache-2.0\n */\n\nimport { AiJob, AiJobInput, getAiProviderRegistry } from \"@workglow/ai\";\nimport { ConcurrencyLimiter, JobQueueClient, JobQueueServer } from \"@workglow/job-queue\";\nimport { InMemoryQueueStorage } from \"@workglow/storage\";\nimport { getTaskQueueRegistry, TaskInput, TaskOutput } from \"@workglow/task-graph\";\nimport { TENSORFLOW_MEDIAPIPE } from \"../common/TFMP_Constants\";\nimport { TFMP_Download, TFMP_TextEmbedding } from \"../common/TFMP_JobRunFns\";\n\n/**\n * Registers the TensorFlow MediaPipe inline job functions for same-thread execution.\n * If no client is provided, creates a default in-memory queue and registers it.\n *\n * @param client - Optional existing JobQueueClient. If not provided, creates a default in-memory queue.\n */\nexport async function register_TFMP_InlineJobFns(\n client?: JobQueueClient<AiJobInput<TaskInput>, TaskOutput>\n): Promise<void> {\n const aiProviderRegistry = getAiProviderRegistry();\n\n aiProviderRegistry.registerRunFn(TENSORFLOW_MEDIAPIPE, \"DownloadModelTask\", TFMP_Download);\n aiProviderRegistry.registerRunFn(TENSORFLOW_MEDIAPIPE, \"TextEmbeddingTask\", TFMP_TextEmbedding);\n\n // If no client provided, create a default in-memory queue\n if (!client) {\n const storage = new InMemoryQueueStorage<AiJobInput<TaskInput>, TaskOutput>(\n TENSORFLOW_MEDIAPIPE\n );\n await storage.setupDatabase();\n\n const server = new JobQueueServer<AiJobInput<TaskInput>, TaskOutput>(AiJob, {\n storage,\n queueName: TENSORFLOW_MEDIAPIPE,\n limiter: new ConcurrencyLimiter(1, 100),\n });\n\n client = new JobQueueClient<AiJobInput<TaskInput>, TaskOutput>({\n storage,\n queueName: TENSORFLOW_MEDIAPIPE,\n });\n\n client.attach(server);\n\n getTaskQueueRegistry().registerQueue({ server, client, storage });\n await server.start();\n }\n}\n",
15
+ "/**\n * @license\n * Copyright 2025 Steven Roussey <sroussey@gmail.com>\n * SPDX-License-Identifier: Apache-2.0\n */\n\nimport { AiJob, AiJobInput, getAiProviderRegistry } from \"@workglow/ai\";\nimport { ConcurrencyLimiter, JobQueueClient, JobQueueServer } from \"@workglow/job-queue\";\nimport { InMemoryQueueStorage } from \"@workglow/storage\";\nimport { getTaskQueueRegistry, TaskInput, TaskOutput } from \"@workglow/task-graph\";\nimport { TENSORFLOW_MEDIAPIPE } from \"../common/TFMP_Constants\";\nimport { TFMP_Download, TFMP_TextEmbedding } from \"../common/TFMP_JobRunFns\";\n\n/**\n * Registers the TensorFlow MediaPipe inline job functions for same-thread execution.\n * If no client is provided, creates a default in-memory queue and registers it.\n *\n * @param client - Optional existing JobQueueClient. If not provided, creates a default in-memory queue.\n */\nexport async function register_TFMP_InlineJobFns(\n client?: JobQueueClient<AiJobInput<TaskInput>, TaskOutput>\n): Promise<void> {\n const aiProviderRegistry = getAiProviderRegistry();\n\n aiProviderRegistry.registerRunFn<any, any>(\n TENSORFLOW_MEDIAPIPE,\n \"DownloadModelTask\",\n TFMP_Download as any\n );\n aiProviderRegistry.registerRunFn<any, any>(\n TENSORFLOW_MEDIAPIPE,\n \"TextEmbeddingTask\",\n TFMP_TextEmbedding as any\n );\n\n // If no client provided, create a default in-memory queue\n if (!client) {\n const storage = new InMemoryQueueStorage<AiJobInput<TaskInput>, TaskOutput>(\n TENSORFLOW_MEDIAPIPE\n );\n await storage.setupDatabase();\n\n const server = new JobQueueServer<AiJobInput<TaskInput>, TaskOutput>(AiJob, {\n storage,\n queueName: TENSORFLOW_MEDIAPIPE,\n limiter: new ConcurrencyLimiter(1, 100),\n });\n\n client = new JobQueueClient<AiJobInput<TaskInput>, TaskOutput>({\n storage,\n queueName: TENSORFLOW_MEDIAPIPE,\n });\n\n client.attach(server);\n\n getTaskQueueRegistry().registerQueue({ server, client, storage });\n await server.start();\n }\n}\n",
14
16
  "/**\n * @license\n * Copyright 2025 Steven Roussey <sroussey@gmail.com>\n * SPDX-License-Identifier: Apache-2.0\n */\n\nimport {\n createServiceToken,\n globalServiceRegistry,\n parentPort,\n WORKER_SERVER,\n} from \"@workglow/util\";\nimport { TFMP_Download, TFMP_TextEmbedding } from \"../common/TFMP_JobRunFns\";\n\n// Register the worker functions\nexport const TFMP_WORKER_JOBRUN = createServiceToken(\"worker.ai-provider.tfmp\");\n\nexport const TFMP_WORKER_JOBRUN_REGISTER = globalServiceRegistry.register(\n TFMP_WORKER_JOBRUN,\n () => {\n const workerServer = globalServiceRegistry.get(WORKER_SERVER);\n workerServer.registerFunction(\"DownloadModelTask\", TFMP_Download);\n workerServer.registerFunction(\"TextEmbeddingTask\", TFMP_TextEmbedding);\n parentPort.postMessage({ type: \"ready\" });\n console.log(\"TFMP_WORKER_JOBRUN registered\");\n return workerServer;\n },\n true\n);\n"
15
17
  ],
16
- "mappings": ";AAMO,IAAM,uBAAuB;AAE7B,IAAK;AAAA,CAAL,CAAK,6BAAL;AAAA,EACL,mCAAO;AAAA,EACP,mCAAO;AAAA,EACP,mCAAO;AAAA,EACP,iCAAK;AAAA,EACL,mCAAO;AAAA,EACP,oCAAQ;AAAA,EACR,iCAAK;AAAA,EACL,mCAAO;AAAA,EACP,oCAAQ;AAAA,GATE;;ACFZ;AAAA;AAAA;AAAA;AAmCA;AAIA,IAAM,YAAY,IAAI;AAKtB,IAAM,cAAc,OAClB,OACA,YACA,UAAkC,CAAC,MAChC;AAAA,EACH,IAAI,UAAU,IAAI,MAAM,IAAI,GAAG;AAAA,IAC7B,OAAO,UAAU,IAAI,MAAM,IAAI;AAAA,EACjC;AAAA,EAGA,MAAM,mBAAmB,CAAC,WAA2B;AAAA,IACnD,MAAM,WAAW,OAAO,WAAW,aAAa,KAAK,MAAM,OAAO,QAAQ,IAAI;AAAA,IAC9E,IAAI,OAAO,WAAW,YAAY;AAAA,MAChC,WAAW,UAAU,qBAAqB;AAAA,QACxC,MAAM,OAAO;AAAA,QACb,UAAU,OAAO;AAAA,MACnB,CAAC;AAAA,IACH;AAAA;AAAA,EAGF,MAAM,kBAA0C;AAAA,IAC9C,OAAQ,MAAM,gBAA4C;AAAA,OACtD,MAAM,2BACN,EAAE,0BAA0B,MAAM,yBAAyB,IAC3D,CA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AAUT,eAAsB,0BAA0B,CAC9C,QACe;AAAA,EACf,MAAM,qBAAqB,uBAAsB;AAAA,EAEjD,mBAAmB,cACjB,sBACA,qBACA,aACF;AAAA,EACA,mBAAmB,cACjB,sBACA,qBACA,kBACF;AAAA,EAGA,IAAI,CAAC,QAAQ;AAAA,IACX,MAAM,UAAU,IAAI,sBAClB,oBACF;AAAA,IACA,MAAM,QAAQ,cAAc;AAAA,IAE5B,MAAM,SAAS,IAAI,gBAAkD,QAAO;AAAA,MAC1E;AAAA,MACA,WAAW;AAAA,MACX,SAAS,IAAI,oBAAmB,GAAG,GAAG;AAAA,IACxC,CAAC;AAAA,IAED,SAAS,IAAI,gBAAkD;AAAA,MAC7D;AAAA,MACA,WAAW;AAAA,IACb,CAAC;AAAA,IAED,OAAO,OAAO,MAAM;AAAA,IAEpB,sBAAqB,EAAE,cAAc,EAAE,QAAQ,QAAQ,QAAQ,CAAC;AAAA,IAChE,MAAM,OAAO,MAAM;AAAA,EACrB;AAAA;;ACnDF;AAAA,wBACE;AAAA,2BACA;AAAA,gBACA;AAAA,mBACA;AAAA;AAKK,IAAM,qBAAqB,oBAAmB,yBAAyB;AAEvE,IAAM,8BAA8B,uBAAsB,SAC/D,oBACA,MAAM;AAAA,EACJ,MAAM,eAAe,uBAAsB,IAAI,cAAa;AAAA,EAC5D,aAAa,iBAAiB,qBAAqB,aAAa;AAAA,EAChE,aAAa,iBAAiB,qBAAqB,kBAAkB;AAAA,EACrE,YAAW,YAAY,EAAE,MAAM,QAAQ,CAAC;AAAA,EACxC,QAAQ,IAAI,+BAA+B;AAAA,EAC3C,OAAO;AAAA,GAET,IACF;",
19
+ "debugId": "DB92C181C46D973A64756E2164756E21",
18
20
  "names": []
19
21
  }
@@ -4,14 +4,15 @@
4
4
  * SPDX-License-Identifier: Apache-2.0
5
5
  */
6
6
  import type { AiProviderRunFn, DeReplicateFromSchema, DownloadModelTaskExecuteInput, DownloadModelTaskExecuteOutput, TextEmbeddingInputSchema, TextEmbeddingOutputSchema } from "@workglow/ai";
7
+ import { TFMPModelRecord } from "./TFMP_ModelSchema";
7
8
  /**
8
9
  * Core implementation for downloading and caching a MediaPipe TFJS model.
9
10
  * This is shared between inline and worker implementations.
10
11
  */
11
- export declare const TFMP_Download: AiProviderRunFn<DownloadModelTaskExecuteInput, DownloadModelTaskExecuteOutput>;
12
+ export declare const TFMP_Download: AiProviderRunFn<DownloadModelTaskExecuteInput, DownloadModelTaskExecuteOutput, TFMPModelRecord>;
12
13
  /**
13
14
  * Core implementation for text embedding using MediaPipe TFJS.
14
15
  * This is shared between inline and worker implementations.
15
16
  */
16
- export declare const TFMP_TextEmbedding: AiProviderRunFn<DeReplicateFromSchema<typeof TextEmbeddingInputSchema>, DeReplicateFromSchema<typeof TextEmbeddingOutputSchema>>;
17
+ export declare const TFMP_TextEmbedding: AiProviderRunFn<DeReplicateFromSchema<typeof TextEmbeddingInputSchema>, DeReplicateFromSchema<typeof TextEmbeddingOutputSchema>, TFMPModelRecord>;
17
18
  //# sourceMappingURL=TFMP_JobRunFns.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"TFMP_JobRunFns.d.ts","sourceRoot":"","sources":["../../../src/tf-mediapipe/common/TFMP_JobRunFns.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAGH,OAAO,KAAK,EACR,eAAe,EACf,qBAAqB,EACrB,6BAA6B,EAC7B,8BAA8B,EAC9B,wBAAwB,EACxB,yBAAyB,EAC5B,MAAM,cAAc,CAAC;AAGtB;;;GAGG;AACH,eAAO,MAAM,aAAa,EAAE,eAAe,CACzC,6BAA6B,EAC7B,8BAA8B,CAgB/B,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,kBAAkB,EAAE,eAAe,CAC9C,qBAAqB,CAAC,OAAO,wBAAwB,CAAC,EACtD,qBAAqB,CAAC,OAAO,yBAAyB,CAAC,CA+BxD,CAAC"}
1
+ {"version":3,"file":"TFMP_JobRunFns.d.ts","sourceRoot":"","sources":["../../../src/tf-mediapipe/common/TFMP_JobRunFns.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAGH,OAAO,KAAK,EACV,eAAe,EACf,qBAAqB,EACrB,6BAA6B,EAC7B,8BAA8B,EAC9B,wBAAwB,EACxB,yBAAyB,EAC1B,MAAM,cAAc,CAAC;AAEtB,OAAO,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AAErD;;;GAGG;AACH,eAAO,MAAM,aAAa,EAAE,eAAe,CACzC,6BAA6B,EAC7B,8BAA8B,EAC9B,eAAe,CAgBhB,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,kBAAkB,EAAE,eAAe,CAC9C,qBAAqB,CAAC,OAAO,wBAAwB,CAAC,EACtD,qBAAqB,CAAC,OAAO,yBAAyB,CAAC,EACvD,eAAe,CA+BhB,CAAC"}
@@ -0,0 +1,74 @@
1
+ /**
2
+ * @license
3
+ * Copyright 2025 Steven Roussey <sroussey@gmail.com>
4
+ * SPDX-License-Identifier: Apache-2.0
5
+ */
6
+ import { FromSchema } from "@workglow/util";
7
+ export declare const TFMPModelSchema: {
8
+ readonly type: "object";
9
+ readonly properties: {
10
+ readonly provider: {
11
+ readonly const: "TENSORFLOW_MEDIAPIPE";
12
+ readonly description: "Discriminator: TensorFlow MediaPipe backend.";
13
+ };
14
+ readonly providerConfig: {
15
+ readonly type: "object";
16
+ readonly description: "TensorFlow MediaPipe-specific options.";
17
+ readonly properties: {
18
+ readonly modelPath: {
19
+ readonly type: "string";
20
+ readonly description: "Filesystem path or URI for the ONNX model.";
21
+ };
22
+ };
23
+ readonly required: readonly ["modelPath"];
24
+ readonly additionalProperties: false;
25
+ };
26
+ };
27
+ readonly required: readonly ["provider", "providerConfig"];
28
+ readonly additionalProperties: true;
29
+ };
30
+ declare const ExtendedModelSchema: {
31
+ readonly type: "object";
32
+ readonly properties: {
33
+ readonly provider: {
34
+ readonly const: "TENSORFLOW_MEDIAPIPE";
35
+ readonly description: "Discriminator: TensorFlow MediaPipe backend.";
36
+ };
37
+ readonly providerConfig: {
38
+ readonly type: "object";
39
+ readonly description: "TensorFlow MediaPipe-specific options.";
40
+ readonly properties: {
41
+ readonly modelPath: {
42
+ readonly type: "string";
43
+ readonly description: "Filesystem path or URI for the ONNX model.";
44
+ };
45
+ };
46
+ readonly required: readonly ["modelPath"];
47
+ readonly additionalProperties: false;
48
+ };
49
+ readonly model_id: {
50
+ readonly type: "string";
51
+ };
52
+ readonly tasks: {
53
+ readonly type: "array";
54
+ readonly items: {
55
+ readonly type: "string";
56
+ };
57
+ };
58
+ readonly title: {
59
+ readonly type: "string";
60
+ };
61
+ readonly description: {
62
+ readonly type: "string";
63
+ };
64
+ readonly metadata: {
65
+ readonly type: "object";
66
+ readonly default: {};
67
+ };
68
+ };
69
+ readonly required: readonly ["model_id", "tasks", "provider", "title", "description", "providerConfig", "metadata", "provider", "providerConfig"];
70
+ readonly additionalProperties: false;
71
+ };
72
+ export type TFMPModelRecord = FromSchema<typeof ExtendedModelSchema>;
73
+ export {};
74
+ //# sourceMappingURL=TFMP_ModelSchema.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"TFMP_ModelSchema.d.ts","sourceRoot":"","sources":["../../../src/tf-mediapipe/common/TFMP_ModelSchema.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAGH,OAAO,EAAwB,UAAU,EAAE,MAAM,gBAAgB,CAAC;AAGlE,eAAO,MAAM,eAAe;;;;;;;;;;;;;;;;;;;;;;CAsBa,CAAC;AAE1C,QAAA,MAAM,mBAAmB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAQgB,CAAC;AAE1C,MAAM,MAAM,eAAe,GAAG,UAAU,CAAC,OAAO,mBAAmB,CAAC,CAAC"}
@@ -5,6 +5,7 @@
5
5
  */
6
6
  export * from "./common/TFMP_Constants";
7
7
  export * from "./common/TFMP_JobRunFns";
8
+ export * from "./common/TFMP_ModelSchema";
8
9
  export * from "./registry/TFMP_Client_RegisterJobFns";
9
10
  export * from "./registry/TFMP_Inline_RegisterJobFns";
10
11
  export * from "./registry/TFMP_Worker_RegisterJobFns";
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/tf-mediapipe/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,cAAc,yBAAyB,CAAC;AACxC,cAAc,yBAAyB,CAAC;AACxC,cAAc,uCAAuC,CAAC;AACtD,cAAc,uCAAuC,CAAC;AACtD,cAAc,uCAAuC,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/tf-mediapipe/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,cAAc,yBAAyB,CAAC;AACxC,cAAc,yBAAyB,CAAC;AACxC,cAAc,2BAA2B,CAAC;AAC1C,cAAc,uCAAuC,CAAC;AACtD,cAAc,uCAAuC,CAAC;AACtD,cAAc,uCAAuC,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"TFMP_Inline_RegisterJobFns.d.ts","sourceRoot":"","sources":["../../../src/tf-mediapipe/registry/TFMP_Inline_RegisterJobFns.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAS,UAAU,EAAyB,MAAM,cAAc,CAAC;AACxE,OAAO,EAAsB,cAAc,EAAkB,MAAM,qBAAqB,CAAC;AAEzF,OAAO,EAAwB,SAAS,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAC;AAInF;;;;;GAKG;AACH,wBAAsB,0BAA0B,CAC9C,MAAM,CAAC,EAAE,cAAc,CAAC,UAAU,CAAC,SAAS,CAAC,EAAE,UAAU,CAAC,GACzD,OAAO,CAAC,IAAI,CAAC,CA6Bf"}
1
+ {"version":3,"file":"TFMP_Inline_RegisterJobFns.d.ts","sourceRoot":"","sources":["../../../src/tf-mediapipe/registry/TFMP_Inline_RegisterJobFns.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAS,UAAU,EAAyB,MAAM,cAAc,CAAC;AACxE,OAAO,EAAsB,cAAc,EAAkB,MAAM,qBAAqB,CAAC;AAEzF,OAAO,EAAwB,SAAS,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAC;AAInF;;;;;GAKG;AACH,wBAAsB,0BAA0B,CAC9C,MAAM,CAAC,EAAE,cAAc,CAAC,UAAU,CAAC,SAAS,CAAC,EAAE,UAAU,CAAC,GACzD,OAAO,CAAC,IAAI,CAAC,CAqCf"}
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@workglow/ai-provider",
3
3
  "type": "module",
4
- "version": "0.0.58",
4
+ "version": "0.0.59",
5
5
  "description": "AI provider integrations for Workglow, supporting OpenAI, Hugging Face Transformers, MediaPipe, and GGML models.",
6
6
  "scripts": {
7
7
  "watch": "concurrently -c 'auto' 'bun:watch-*'",
@@ -30,11 +30,11 @@
30
30
  "access": "public"
31
31
  },
32
32
  "peerDependencies": {
33
- "@workglow/ai": "0.0.58",
34
- "@workglow/job-queue": "0.0.58",
35
- "@workglow/storage": "0.0.58",
36
- "@workglow/task-graph": "0.0.58",
37
- "@workglow/util": "0.0.58",
33
+ "@workglow/ai": "0.0.59",
34
+ "@workglow/job-queue": "0.0.59",
35
+ "@workglow/storage": "0.0.59",
36
+ "@workglow/task-graph": "0.0.59",
37
+ "@workglow/util": "0.0.59",
38
38
  "@sroussey/transformers": "3.8.1",
39
39
  "@mediapipe/tasks-text": "^0.10.21"
40
40
  },
@@ -56,11 +56,11 @@
56
56
  }
57
57
  },
58
58
  "devDependencies": {
59
- "@workglow/ai": "0.0.58",
60
- "@workglow/job-queue": "0.0.58",
61
- "@workglow/storage": "0.0.58",
62
- "@workglow/task-graph": "0.0.58",
63
- "@workglow/util": "0.0.58",
59
+ "@workglow/ai": "0.0.59",
60
+ "@workglow/job-queue": "0.0.59",
61
+ "@workglow/storage": "0.0.59",
62
+ "@workglow/task-graph": "0.0.59",
63
+ "@workglow/util": "0.0.59",
64
64
  "@sroussey/transformers": "3.8.1",
65
65
  "@mediapipe/tasks-text": "^0.10.21"
66
66
  }