@workglow/ai-provider 0.0.97 → 0.0.98
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/dist/HFT_JobRunFns-ajak33q5.js +60 -0
- package/dist/HFT_JobRunFns-ajak33q5.js.map +9 -0
- package/dist/anthropic/index.js +11 -92
- package/dist/anthropic/index.js.map +4 -7
- package/dist/google-gemini/index.js +11 -103
- package/dist/google-gemini/index.js.map +4 -7
- package/dist/hf-transformers/common/HFT_JobRunFns.d.ts.map +1 -1
- package/dist/hf-transformers/index.js +46 -1080
- package/dist/hf-transformers/index.js.map +4 -9
- package/dist/index-2pvfsjyx.js +857 -0
- package/dist/index-2pvfsjyx.js.map +10 -0
- package/dist/index-34rcjm0y.js +78 -0
- package/dist/index-34rcjm0y.js.map +12 -0
- package/dist/index-9w5hs4zc.js +73 -0
- package/dist/index-9w5hs4zc.js.map +12 -0
- package/dist/index-jd3bbc2x.js +11 -0
- package/dist/index-jd3bbc2x.js.map +9 -0
- package/dist/index-kctzvn3c.js +75 -0
- package/dist/index-kctzvn3c.js.map +12 -0
- package/dist/index-m0r2hvfz.js +57 -0
- package/dist/index-m0r2hvfz.js.map +10 -0
- package/dist/index-rmbnv0rw.js +169 -0
- package/dist/index-rmbnv0rw.js.map +11 -0
- package/dist/index-tn88s0ke.js +71 -0
- package/dist/index-tn88s0ke.js.map +12 -0
- package/dist/index-wnmajxg6.js +86 -0
- package/dist/index-wnmajxg6.js.map +12 -0
- package/dist/index-xyavfrb8.js +97 -0
- package/dist/index-xyavfrb8.js.map +12 -0
- package/dist/index.browser-jd3bbc2x.js +11 -0
- package/dist/index.browser-jd3bbc2x.js.map +9 -0
- package/dist/index.d.ts +6 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +80 -1369
- package/dist/index.js.map +3 -20
- package/dist/provider-hf-inference/HFI_Worker.d.ts +7 -0
- package/dist/provider-hf-inference/HFI_Worker.d.ts.map +1 -0
- package/dist/provider-hf-inference/HfInferenceProvider.d.ts +40 -0
- package/dist/provider-hf-inference/HfInferenceProvider.d.ts.map +1 -0
- package/dist/provider-hf-inference/common/HFI_Constants.d.ts +7 -0
- package/dist/provider-hf-inference/common/HFI_Constants.d.ts.map +1 -0
- package/dist/provider-hf-inference/common/HFI_JobRunFns.d.ts +17 -0
- package/dist/provider-hf-inference/common/HFI_JobRunFns.d.ts.map +1 -0
- package/dist/provider-hf-inference/common/HFI_ModelSchema.d.ts +146 -0
- package/dist/provider-hf-inference/common/HFI_ModelSchema.d.ts.map +1 -0
- package/dist/provider-hf-inference/index.d.ts +11 -0
- package/dist/provider-hf-inference/index.d.ts.map +1 -0
- package/dist/provider-hf-inference/index.js +209 -0
- package/dist/provider-hf-inference/index.js.map +11 -0
- package/dist/provider-llamacpp/LlamaCppProvider.d.ts +38 -0
- package/dist/provider-llamacpp/LlamaCppProvider.d.ts.map +1 -0
- package/dist/provider-llamacpp/LlamaCpp_Worker.d.ts +7 -0
- package/dist/provider-llamacpp/LlamaCpp_Worker.d.ts.map +1 -0
- package/dist/provider-llamacpp/common/LlamaCpp_Constants.d.ts +8 -0
- package/dist/provider-llamacpp/common/LlamaCpp_Constants.d.ts.map +1 -0
- package/dist/provider-llamacpp/common/LlamaCpp_JobRunFns.d.ts +20 -0
- package/dist/provider-llamacpp/common/LlamaCpp_JobRunFns.d.ts.map +1 -0
- package/dist/provider-llamacpp/common/LlamaCpp_ModelSchema.d.ts +209 -0
- package/dist/provider-llamacpp/common/LlamaCpp_ModelSchema.d.ts.map +1 -0
- package/dist/provider-llamacpp/index.d.ts +11 -0
- package/dist/provider-llamacpp/index.d.ts.map +1 -0
- package/dist/provider-llamacpp/index.js +365 -0
- package/dist/provider-llamacpp/index.js.map +11 -0
- package/dist/provider-ollama/index.browser.js +4 -8
- package/dist/provider-ollama/index.browser.js.map +2 -2
- package/dist/provider-ollama/index.js +12 -88
- package/dist/provider-ollama/index.js.map +4 -7
- package/dist/provider-openai/index.js +11 -95
- package/dist/provider-openai/index.js.map +4 -7
- package/dist/tf-mediapipe/index.js +4 -8
- package/dist/tf-mediapipe/index.js.map +2 -2
- package/package.json +39 -18
- package/dist/ggml/server.d.ts +0 -2
- package/dist/ggml/server.d.ts.map +0 -1
package/dist/index.js.map
CHANGED
|
@@ -1,29 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
|
-
"sources": ["../src/
|
|
3
|
+
"sources": ["../src/tf-mediapipe/common/TFMP_Constants.ts", "../src/tf-mediapipe/common/TFMP_ModelSchema.ts", "../src/tf-mediapipe/TensorFlowMediaPipeProvider.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\";\nexport const HTF_CACHE_NAME = \"transformers-cache\";\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 type {\n BackgroundRemovalPipeline,\n DocumentQuestionAnsweringSingle,\n FeatureExtractionPipeline,\n FillMaskPipeline,\n FillMaskSingle,\n ImageClassificationPipeline,\n ImageFeatureExtractionPipeline,\n ImageSegmentationPipeline,\n ImageToTextPipeline,\n ObjectDetectionPipeline,\n // @ts-ignore temporary \"fix\"\n PretrainedModelOptions,\n QuestionAnsweringPipeline,\n RawImage,\n SummarizationPipeline,\n SummarizationSingle,\n TextClassificationOutput,\n TextClassificationPipeline,\n TextGenerationPipeline,\n TextGenerationSingle,\n TokenClassificationPipeline,\n TokenClassificationSingle,\n TranslationPipeline,\n TranslationSingle,\n ZeroShotClassificationPipeline,\n ZeroShotImageClassificationPipeline,\n ZeroShotObjectDetectionPipeline,\n} from \"@sroussey/transformers\";\nimport type {\n AiProviderRunFn,\n AiProviderStreamFn,\n BackgroundRemovalTaskInput,\n BackgroundRemovalTaskOutput,\n DownloadModelTaskRunInput,\n DownloadModelTaskRunOutput,\n ImageClassificationTaskInput,\n ImageClassificationTaskOutput,\n ImageEmbeddingTaskInput,\n ImageEmbeddingTaskOutput,\n ImageSegmentationTaskInput,\n ImageSegmentationTaskOutput,\n ImageToTextTaskInput,\n ImageToTextTaskOutput,\n ObjectDetectionTaskInput,\n ObjectDetectionTaskOutput,\n TextClassificationTaskInput,\n TextClassificationTaskOutput,\n TextEmbeddingTaskInput,\n TextEmbeddingTaskOutput,\n TextFillMaskTaskInput,\n TextFillMaskTaskOutput,\n TextGenerationTaskInput,\n TextGenerationTaskOutput,\n TextLanguageDetectionTaskInput,\n TextLanguageDetectionTaskOutput,\n TextNamedEntityRecognitionTaskInput,\n TextNamedEntityRecognitionTaskOutput,\n TextQuestionAnswerTaskInput,\n TextQuestionAnswerTaskOutput,\n TextRewriterTaskInput,\n TextRewriterTaskOutput,\n TextSummaryTaskInput,\n TextSummaryTaskOutput,\n TextTranslationTaskInput,\n TextTranslationTaskOutput,\n UnloadModelTaskRunInput,\n UnloadModelTaskRunOutput,\n} from \"@workglow/ai\";\nimport type { StreamEvent } from \"@workglow/task-graph\";\n\nlet _transformersSdk: typeof import(\"@sroussey/transformers\") | undefined;\nasync function loadTransformersSDK() {\n if (!_transformersSdk) {\n try {\n _transformersSdk = await import(\"@sroussey/transformers\");\n } catch {\n throw new Error(\n \"@sroussey/transformers is required for HuggingFace Transformers tasks. Install it with: bun add @sroussey/transformers\"\n );\n }\n }\n return _transformersSdk;\n}\n\nimport { TypedArray } from \"@workglow/util\";\nimport { CallbackStatus } from \"./HFT_CallbackStatus\";\nimport { HTF_CACHE_NAME } from \"./HFT_Constants\";\nimport { HfTransformersOnnxModelConfig } from \"./HFT_ModelSchema\";\n\nconst pipelines = new Map<string, any>();\n\n/**\n * Clear all cached pipelines\n */\nexport function clearPipelineCache(): void {\n pipelines.clear();\n}\n\n/**\n * Generate a cache key for a pipeline that includes all configuration options\n * that affect pipeline creation (model_path, pipeline, dtype, device)\n */\nfunction getPipelineCacheKey(model: HfTransformersOnnxModelConfig): string {\n const dtype = model.provider_config.dtype || \"q8\";\n const device = model.provider_config.device || \"\";\n return `${model.provider_config.model_path}:${model.provider_config.pipeline}:${dtype}:${device}`;\n}\n\n/**\n * Helper function to get a pipeline for a model\n * @param progressScaleMax - Maximum progress value for download phase (100 for download-only, 10 for download+run)\n */\nconst getPipeline = async (\n model: HfTransformersOnnxModelConfig,\n onProgress: (progress: number, message?: string, details?: any) => void,\n options: PretrainedModelOptions = {},\n progressScaleMax: number = 10\n) => {\n const cacheKey = getPipelineCacheKey(model);\n if (pipelines.has(cacheKey)) {\n return pipelines.get(cacheKey);\n }\n\n // Track file sizes and progress for weighted calculation\n const fileSizes = new Map<string, number>();\n const fileProgress = new Map<string, number>();\n const fileCompleted = new Set<string>();\n const fileFirstSent = new Set<string>();\n const fileLastSent = new Set<string>();\n const fileLastEventTime = new Map<string, number>();\n const pendingProgressByFile = new Map<\n string,\n { progress: number; file: string; fileProgress: number }\n >();\n let throttleTimer: ReturnType<typeof setTimeout> | null = null;\n const THROTTLE_MS = 160;\n\n // Pre-estimate total download size based on typical model structure:\n // 3 tiny files (~1KB each) + 1 medium file (~20MB) + 0-2 large files (~1GB each if present)\n const estimatedTinyFiles = 3;\n const estimatedMediumFiles = 1;\n const estimatedTinySize = 1024; // 1KB\n const estimatedMediumSize = 20 * 1024 * 1024; // 20MB\n const estimatedLargeSize = 1024 * 1024 * 1024; // 1GB\n\n // Start with minimum estimate (4 files), add large files dynamically as we discover them\n const baseEstimate =\n estimatedTinyFiles * estimatedTinySize + estimatedMediumFiles * estimatedMediumSize;\n\n /**\n * Sends a progress event, respecting throttling but always sending first/last per file\n */\n const sendProgress = (\n overallProgress: number,\n file: string,\n fileProgressValue: number,\n isFirst: boolean,\n isLast: boolean\n ): void => {\n const now = Date.now();\n const lastTime = fileLastEventTime.get(file) || 0;\n const timeSinceLastEvent = now - lastTime;\n const shouldThrottle = !isFirst && !isLast && timeSinceLastEvent < THROTTLE_MS;\n\n if (shouldThrottle) {\n // Store pending progress for this file\n pendingProgressByFile.set(file, {\n progress: overallProgress,\n file,\n fileProgress: fileProgressValue,\n });\n // Schedule sending if not already scheduled\n if (!throttleTimer) {\n const timeRemaining = Math.max(1, THROTTLE_MS - timeSinceLastEvent);\n throttleTimer = setTimeout(() => {\n // Send all pending progress events\n for (const [pendingFile, pending] of pendingProgressByFile.entries()) {\n onProgress(Math.round(pending.progress), \"Downloading model\", {\n file: pendingFile,\n progress: pending.fileProgress,\n });\n fileLastEventTime.set(pendingFile, Date.now());\n }\n pendingProgressByFile.clear();\n throttleTimer = null;\n }, timeRemaining);\n }\n return;\n }\n\n // Send immediately\n onProgress(Math.round(overallProgress), \"Downloading model\", {\n file,\n progress: fileProgressValue,\n });\n fileLastEventTime.set(file, now);\n // Clear any pending progress for this file since we're sending it now\n pendingProgressByFile.delete(file);\n if (throttleTimer && pendingProgressByFile.size === 0) {\n clearTimeout(throttleTimer);\n throttleTimer = null;\n }\n };\n\n // Track whether we've seen a substantial file (to avoid premature progress reports for tiny config files)\n let hasSeenSubstantialFile = false;\n const substantialFileThreshold = 1024 * 1024; // 1MB - files larger than this are substantial\n\n // Get the abort signal from options if provided\n const abortSignal = options.abort_signal;\n\n // Create a callback status object for progress tracking\n const progressCallback = (status: CallbackStatus) => {\n // Check if operation has been aborted before processing progress\n if (abortSignal?.aborted) {\n return; // Don't process progress for aborted operations\n }\n\n if (status.status === \"progress\") {\n const file = status.file;\n const fileTotal = status.total;\n const fileProgressValue = status.progress;\n\n // Track file size on first progress event\n if (!fileSizes.has(file)) {\n fileSizes.set(file, fileTotal);\n fileProgress.set(file, 0);\n\n // Check if this is a substantial file\n if (fileTotal >= substantialFileThreshold) {\n hasSeenSubstantialFile = true;\n }\n }\n\n // Update file progress\n fileProgress.set(file, fileProgressValue);\n\n // Check if file is complete\n const isComplete = fileProgressValue >= 100;\n if (isComplete && !fileCompleted.has(file)) {\n fileCompleted.add(file);\n fileProgress.set(file, 100);\n }\n\n // Calculate actual loaded bytes and adjust estimated total\n let actualLoadedSize = 0;\n let actualTotalSize = 0;\n\n // Categorize seen files and track their actual sizes\n const tinyThreshold = 100 * 1024; // 100KB - files smaller are config/vocab\n const mediumThreshold = 100 * 1024 * 1024; // 100MB - tokenizer and small models\n let seenTinyCount = 0;\n let seenMediumCount = 0;\n let seenLargeCount = 0;\n\n for (const [trackedFile, size] of fileSizes.entries()) {\n actualTotalSize += size;\n const progress = fileProgress.get(trackedFile) || 0;\n actualLoadedSize += (size * progress) / 100;\n\n // Categorize file\n if (size < tinyThreshold) {\n seenTinyCount++;\n } else if (size < mediumThreshold) {\n seenMediumCount++;\n } else {\n seenLargeCount++;\n }\n }\n\n // Adjust estimated total size:\n // - Start with actual sizes of seen files\n // - Add estimates for unseen tiny/medium files\n // - For large files: conservatively assume 1 until we've seen all expected files\n const unseenTinyFiles = Math.max(0, estimatedTinyFiles - seenTinyCount);\n const unseenMediumFiles = Math.max(0, estimatedMediumFiles - seenMediumCount);\n\n // Dynamically estimate large files:\n // - If we've seen a large file, assume up to 2 total\n // - Otherwise, conservatively assume 1 large file might exist to prevent premature 100% progress\n // - This prevents the progress from jumping when a large file appears unexpectedly\n let estimatedLargeFiles: number;\n if (seenLargeCount > 0) {\n estimatedLargeFiles = 2; // We've seen at least one, expect up to 2\n } else {\n estimatedLargeFiles = 1; // Haven't seen any large files yet, but assume 1 might exist\n }\n const unseenLargeFiles = Math.max(0, estimatedLargeFiles - seenLargeCount);\n\n const adjustedTotalSize =\n actualTotalSize +\n unseenTinyFiles * estimatedTinySize +\n unseenMediumFiles * estimatedMediumSize +\n unseenLargeFiles * estimatedLargeSize;\n\n // Scale progress to the configured range (0-100 for download-only, 0-10 for download+run)\n const rawProgress = adjustedTotalSize > 0 ? (actualLoadedSize / adjustedTotalSize) * 100 : 0;\n const overallProgress = (rawProgress * progressScaleMax) / 100;\n\n // Determine if this is first or last event for this file\n const isFirst = !fileFirstSent.has(file);\n const isLast = isComplete && !fileLastSent.has(file);\n\n if (isFirst) {\n fileFirstSent.add(file);\n }\n if (isLast) {\n fileLastSent.add(file);\n }\n\n // Only report progress if we've seen a substantial file (to avoid premature 100% for tiny config files)\n if (hasSeenSubstantialFile) {\n sendProgress(overallProgress, file, fileProgressValue, isFirst, isLast);\n }\n } else if (status.status === \"done\" || status.status === \"download\") {\n // Handle file completion from bookend events\n const file = status.file;\n\n // Check if this file should mark the start of substantial downloads\n const fileSize = fileSizes.get(file) || 0;\n if (fileSize >= substantialFileThreshold) {\n hasSeenSubstantialFile = true;\n }\n\n if (!fileCompleted.has(file)) {\n fileCompleted.add(file);\n fileProgress.set(file, 100);\n\n // Recalculate overall progress using same logic as progress handler\n let actualLoadedSize = 0;\n let actualTotalSize = 0;\n\n const tinyThreshold = 100 * 1024; // 100KB - files smaller are config/vocab\n const mediumThreshold = 100 * 1024 * 1024; // 100MB - tokenizer and small models\n let seenTinyCount = 0;\n let seenMediumCount = 0;\n let seenLargeCount = 0;\n\n for (const [trackedFile, size] of fileSizes.entries()) {\n actualTotalSize += size;\n const progress = fileProgress.get(trackedFile) || 0;\n actualLoadedSize += (size * progress) / 100;\n\n // Categorize file\n if (size < tinyThreshold) {\n seenTinyCount++;\n } else if (size < mediumThreshold) {\n seenMediumCount++;\n } else {\n seenLargeCount++;\n }\n }\n\n // Adjust estimated total size (same logic as progress handler)\n const unseenTinyFiles = Math.max(0, estimatedTinyFiles - seenTinyCount);\n const unseenMediumFiles = Math.max(0, estimatedMediumFiles - seenMediumCount);\n\n // Dynamically estimate large files (same logic as progress handler)\n let estimatedLargeFiles: number;\n if (seenLargeCount > 0) {\n estimatedLargeFiles = 2;\n } else {\n estimatedLargeFiles = 1;\n }\n const unseenLargeFiles = Math.max(0, estimatedLargeFiles - seenLargeCount);\n\n const adjustedTotalSize =\n actualTotalSize +\n unseenTinyFiles * estimatedTinySize +\n unseenMediumFiles * estimatedMediumSize +\n unseenLargeFiles * estimatedLargeSize;\n\n // Scale progress to the configured range (0-100 for download-only, 0-10 for download+run)\n const rawProgress =\n adjustedTotalSize > 0 ? (actualLoadedSize / adjustedTotalSize) * 100 : 0;\n const overallProgress = (rawProgress * progressScaleMax) / 100;\n const isLast = !fileLastSent.has(file);\n if (isLast) {\n fileLastSent.add(file);\n // Only report if we've seen a substantial file\n if (hasSeenSubstantialFile) {\n sendProgress(overallProgress, file, 100, false, true);\n }\n }\n }\n }\n };\n\n const pipelineOptions: PretrainedModelOptions = {\n dtype: model.provider_config.dtype || \"q8\",\n ...(model.provider_config.use_external_data_format\n ? { useExternalDataFormat: model.provider_config.use_external_data_format }\n : {}),\n ...(model.provider_config.device ? { device: model.provider_config.device as any } : {}),\n ...options,\n progress_callback: progressCallback,\n };\n\n // Check if already aborted before starting\n if (abortSignal?.aborted) {\n throw new Error(\"Operation aborted before pipeline creation\");\n }\n\n const pipelineType = model.provider_config.pipeline;\n\n // Wrap the pipeline call with abort handling\n // Create a promise that rejects when aborted\n const abortPromise = new Promise<never>((_, reject) => {\n if (abortSignal) {\n const handleAbort = () => {\n reject(new Error(\"Pipeline download aborted\"));\n };\n\n if (abortSignal.aborted) {\n handleAbort();\n } else {\n abortSignal.addEventListener(\"abort\", handleAbort, { once: true });\n }\n }\n });\n\n // Race between pipeline creation and abort\n const { pipeline } = await loadTransformersSDK();\n const pipelinePromise = pipeline(pipelineType, model.provider_config.model_path, pipelineOptions);\n\n try {\n const result = await (abortSignal\n ? Promise.race([pipelinePromise, abortPromise])\n : pipelinePromise);\n\n // Check if aborted after pipeline creation\n if (abortSignal?.aborted) {\n throw new Error(\"Operation aborted after pipeline creation\");\n }\n\n pipelines.set(cacheKey, result);\n return result;\n } catch (error: any) {\n // If aborted, throw a clean abort error rather than internal stream errors\n if (abortSignal?.aborted) {\n throw new Error(\"Pipeline download aborted\");\n }\n // Otherwise, re-throw the original error\n throw error;\n }\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 DownloadModelTaskRunInput,\n DownloadModelTaskRunOutput,\n HfTransformersOnnxModelConfig\n> = async (input, model, onProgress, signal) => {\n // Download the model by creating a pipeline\n // Use 100 as progressScaleMax since this is download-only (0-100%)\n await getPipeline(model!, onProgress, { abort_signal: signal }, 100);\n\n return {\n model: input.model!,\n };\n};\n\n/**\n * Core implementation for unloading a Hugging Face Transformers model.\n * This is shared between inline and worker implementations.\n */\nexport const HFT_Unload: AiProviderRunFn<\n UnloadModelTaskRunInput,\n UnloadModelTaskRunOutput,\n HfTransformersOnnxModelConfig\n> = async (input, model, onProgress, signal) => {\n // Delete the pipeline from the in-memory map\n const cacheKey = getPipelineCacheKey(model!);\n if (pipelines.has(cacheKey)) {\n pipelines.delete(cacheKey);\n onProgress(50, \"Pipeline removed from memory\");\n }\n\n // Delete model cache entries\n const model_path = model!.provider_config.model_path;\n await deleteModelCache(model_path);\n onProgress(100, \"Model cache deleted\");\n\n return {\n model: input.model!,\n };\n};\n\n/**\n * Deletes all cache entries for a given model path\n * @param model_path - The model path to delete from cache\n */\nconst deleteModelCache = async (model_path: string): Promise<void> => {\n const cache = await caches.open(HTF_CACHE_NAME);\n const keys = await cache.keys();\n const prefix = `/${model_path}/`;\n\n // Collect all matching requests first\n const requestsToDelete: Request[] = [];\n for (const request of keys) {\n const url = new URL(request.url);\n if (url.pathname.startsWith(prefix)) {\n requestsToDelete.push(request);\n }\n }\n\n // Delete all matching requests\n let deletedCount = 0;\n for (const request of requestsToDelete) {\n try {\n const deleted = await cache.delete(request);\n if (deleted) {\n deletedCount++;\n } else {\n // If delete returns false, try with URL string as fallback\n const deletedByUrl = await cache.delete(request.url);\n if (deletedByUrl) {\n deletedCount++;\n }\n }\n } catch (error) {\n console.error(`Failed to delete cache entry: ${request.url}`, error);\n }\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 TextEmbeddingTaskInput,\n TextEmbeddingTaskOutput,\n HfTransformersOnnxModelConfig\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: model?.provider_config.pooling || \"mean\",\n normalize: model?.provider_config.normalize,\n ...(signal ? { abort_signal: signal } : {}),\n });\n\n const isArrayInput = Array.isArray(input.text);\n const embeddingDim = model?.provider_config.native_dimensions;\n\n // If the input is an array, the tensor will have multiple dimensions (e.g., [10, 384])\n // We need to split it into separate vectors for each input text\n if (isArrayInput && hfVector.dims.length > 1) {\n const [numTexts, vectorDim] = hfVector.dims;\n\n // Validate that the number of texts matches\n if (numTexts !== input.text.length) {\n throw new Error(\n `HuggingFace Embedding tensor batch size does not match input array length: ${numTexts} != ${input.text.length}`\n );\n }\n\n // Validate dimensions\n if (vectorDim !== embeddingDim) {\n throw new Error(\n `HuggingFace Embedding vector dimension does not match model dimensions: ${vectorDim} != ${embeddingDim}`\n );\n }\n\n // Extract each embedding vector using tensor indexing\n // hfVector[i] returns a sub-tensor for the i-th text\n const vectors: TypedArray[] = Array.from(\n { length: numTexts },\n (_, i) => (hfVector as any)[i].data as TypedArray\n );\n\n return { vector: vectors };\n }\n\n // Single text input - validate dimensions\n if (hfVector.size !== embeddingDim) {\n console.warn(\n `HuggingFace Embedding vector length does not match model dimensions v${hfVector.size} != m${embeddingDim}`,\n input,\n hfVector\n );\n throw new Error(\n `HuggingFace Embedding vector length does not match model dimensions v${hfVector.size} != m${embeddingDim}`\n );\n }\n\n return { vector: hfVector.data as TypedArray };\n};\n\nexport const HFT_TextClassification: AiProviderRunFn<\n TextClassificationTaskInput,\n TextClassificationTaskOutput,\n HfTransformersOnnxModelConfig\n> = async (input, model, onProgress, signal) => {\n if (model?.provider_config?.pipeline === \"zero-shot-classification\") {\n if (\n !input.candidateLabels ||\n !Array.isArray(input.candidateLabels) ||\n input.candidateLabels.length === 0\n ) {\n throw new Error(\"Zero-shot text classification requires candidate labels\");\n }\n\n const zeroShotClassifier: ZeroShotClassificationPipeline = await getPipeline(\n model!,\n onProgress,\n {\n abort_signal: signal,\n }\n );\n const result: any = await zeroShotClassifier(input.text, input.candidateLabels as string[], {});\n\n return {\n categories: result.labels.map((label: string, idx: number) => ({\n label,\n score: result.scores[idx],\n })),\n };\n }\n\n const TextClassification: TextClassificationPipeline = await getPipeline(model!, onProgress, {\n abort_signal: signal,\n });\n const result = await TextClassification(input.text, {\n top_k: input.maxCategories || undefined,\n ...(signal ? { abort_signal: signal } : {}),\n });\n\n if (Array.isArray(result[0])) {\n return {\n categories: result[0].map((category) => ({\n label: category.label,\n score: category.score,\n })),\n };\n }\n\n return {\n categories: (result as TextClassificationOutput).map((category) => ({\n label: category.label,\n score: category.score,\n })),\n };\n};\n\nexport const HFT_TextLanguageDetection: AiProviderRunFn<\n TextLanguageDetectionTaskInput,\n TextLanguageDetectionTaskOutput,\n HfTransformersOnnxModelConfig\n> = async (input, model, onProgress, signal) => {\n const TextClassification: TextClassificationPipeline = await getPipeline(model!, onProgress, {\n abort_signal: signal,\n });\n const result = await TextClassification(input.text, {\n top_k: input.maxLanguages || undefined,\n ...(signal ? { abort_signal: signal } : {}),\n });\n\n if (Array.isArray(result[0])) {\n return {\n languages: result[0].map((category) => ({\n language: category.label,\n score: category.score,\n })),\n };\n }\n\n return {\n languages: (result as TextClassificationOutput).map((category) => ({\n language: category.label,\n score: category.score,\n })),\n };\n};\n\nexport const HFT_TextNamedEntityRecognition: AiProviderRunFn<\n TextNamedEntityRecognitionTaskInput,\n TextNamedEntityRecognitionTaskOutput,\n HfTransformersOnnxModelConfig\n> = async (input, model, onProgress, signal) => {\n const textNamedEntityRecognition: TokenClassificationPipeline = await getPipeline(\n model!,\n onProgress,\n {\n abort_signal: signal,\n }\n );\n let results = await textNamedEntityRecognition(input.text, {\n ignore_labels: input.blockList as string[] | undefined,\n ...(signal ? { abort_signal: signal } : {}),\n });\n let entities: TokenClassificationSingle[] = [];\n if (!Array.isArray(results)) {\n entities = [results];\n } else {\n entities = results as TokenClassificationSingle[];\n }\n return {\n entities: entities.map((entity) => ({\n entity: entity.entity,\n score: entity.score,\n word: entity.word,\n })),\n };\n};\n\nexport const HFT_TextFillMask: AiProviderRunFn<\n TextFillMaskTaskInput,\n TextFillMaskTaskOutput,\n HfTransformersOnnxModelConfig\n> = async (input, model, onProgress, signal) => {\n const unmasker: FillMaskPipeline = await getPipeline(model!, onProgress, {\n abort_signal: signal,\n });\n let results = await unmasker(input.text);\n let predictions: FillMaskSingle[] = [];\n if (!Array.isArray(results)) {\n predictions = [results];\n } else {\n predictions = results as FillMaskSingle[];\n }\n return {\n predictions: predictions.map((prediction) => ({\n entity: prediction.token_str,\n score: prediction.score,\n sequence: prediction.sequence,\n })),\n };\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 TextGenerationTaskInput,\n TextGenerationTaskOutput,\n HfTransformersOnnxModelConfig\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 TextTranslationTaskInput,\n TextTranslationTaskOutput,\n HfTransformersOnnxModelConfig\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 const translatedText = Array.isArray(result)\n ? (result[0] as TranslationSingle)?.translation_text || \"\"\n : (result as TranslationSingle)?.translation_text || \"\";\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 TextRewriterTaskInput,\n TextRewriterTaskOutput,\n HfTransformersOnnxModelConfig\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 Error(\"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 TextSummaryTaskInput,\n TextSummaryTaskOutput,\n HfTransformersOnnxModelConfig\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 TextQuestionAnswerTaskInput,\n TextQuestionAnswerTaskOutput,\n HfTransformersOnnxModelConfig\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 * Core implementation for image segmentation using Hugging Face Transformers.\n */\nexport const HFT_ImageSegmentation: AiProviderRunFn<\n ImageSegmentationTaskInput,\n ImageSegmentationTaskOutput,\n HfTransformersOnnxModelConfig\n> = async (input, model, onProgress, signal) => {\n const segmenter: ImageSegmentationPipeline = await getPipeline(model!, onProgress, {\n abort_signal: signal,\n });\n\n const result = await segmenter(input.image as any, {\n threshold: input.threshold,\n mask_threshold: input.maskThreshold,\n ...(signal ? { abort_signal: signal } : {}),\n });\n\n const masks = Array.isArray(result) ? result : [result];\n\n const processedMasks = await Promise.all(\n masks.map(async (mask) => ({\n label: mask.label || \"\",\n score: mask.score || 0,\n mask: {} as { [x: string]: unknown },\n }))\n );\n\n return {\n masks: processedMasks,\n };\n};\n\n/**\n * Core implementation for image to text using Hugging Face Transformers.\n */\nexport const HFT_ImageToText: AiProviderRunFn<\n ImageToTextTaskInput,\n ImageToTextTaskOutput,\n HfTransformersOnnxModelConfig\n> = async (input, model, onProgress, signal) => {\n const captioner: ImageToTextPipeline = await getPipeline(model!, onProgress, {\n abort_signal: signal,\n });\n\n const result: any = await captioner(input.image as string, {\n max_new_tokens: input.maxTokens,\n ...(signal ? { abort_signal: signal } : {}),\n });\n\n const text = Array.isArray(result) ? result[0]?.generated_text : result?.generated_text;\n\n return {\n text: text || \"\",\n };\n};\n\n/**\n * Core implementation for background removal using Hugging Face Transformers.\n */\nexport const HFT_BackgroundRemoval: AiProviderRunFn<\n BackgroundRemovalTaskInput,\n BackgroundRemovalTaskOutput,\n HfTransformersOnnxModelConfig\n> = async (input, model, onProgress, signal) => {\n const remover: BackgroundRemovalPipeline = await getPipeline(model!, onProgress, {\n abort_signal: signal,\n });\n\n const result = await remover(input.image as string, {\n ...(signal ? { abort_signal: signal } : {}),\n });\n\n const resultImage = Array.isArray(result) ? result[0] : result;\n\n return {\n image: imageToBase64(resultImage),\n };\n};\n\n/**\n * Core implementation for image embedding using Hugging Face Transformers.\n */\nexport const HFT_ImageEmbedding: AiProviderRunFn<\n ImageEmbeddingTaskInput,\n ImageEmbeddingTaskOutput,\n HfTransformersOnnxModelConfig\n> = async (input, model, onProgress, signal) => {\n const embedder: ImageFeatureExtractionPipeline = await getPipeline(model!, onProgress, {\n abort_signal: signal,\n });\n\n const result: any = await embedder(input.image as string);\n\n return {\n vector: result.data as TypedArray,\n } as ImageEmbeddingTaskOutput;\n};\n\n/**\n * Core implementation for image classification using Hugging Face Transformers.\n * Auto-selects between regular and zero-shot classification.\n */\nexport const HFT_ImageClassification: AiProviderRunFn<\n ImageClassificationTaskInput,\n ImageClassificationTaskOutput,\n HfTransformersOnnxModelConfig\n> = async (input, model, onProgress, signal) => {\n if (model?.provider_config?.pipeline === \"zero-shot-image-classification\") {\n if (!input.categories || !Array.isArray(input.categories) || input.categories.length === 0) {\n console.warn(\"Zero-shot image classification requires categories\", input);\n throw new Error(\"Zero-shot image classification requires categories\");\n }\n const zeroShotClassifier: ZeroShotImageClassificationPipeline = await getPipeline(\n model!,\n onProgress,\n {\n abort_signal: signal,\n }\n );\n const result: any = await zeroShotClassifier(\n input.image as string,\n input.categories! as string[],\n {}\n );\n\n const results = Array.isArray(result) ? result : [result];\n\n return {\n categories: results.map((r: any) => ({\n label: r.label,\n score: r.score,\n })),\n };\n }\n\n const classifier: ImageClassificationPipeline = await getPipeline(model!, onProgress, {\n abort_signal: signal,\n });\n const result: any = await classifier(input.image as string, {\n top_k: (input as any).maxCategories,\n ...(signal ? { abort_signal: signal } : {}),\n });\n\n const results = Array.isArray(result) ? result : [result];\n\n return {\n categories: results.map((r: any) => ({\n label: r.label,\n score: r.score,\n })),\n };\n};\n\n/**\n * Core implementation for object detection using Hugging Face Transformers.\n * Auto-selects between regular and zero-shot detection.\n */\nexport const HFT_ObjectDetection: AiProviderRunFn<\n ObjectDetectionTaskInput,\n ObjectDetectionTaskOutput,\n HfTransformersOnnxModelConfig\n> = async (input, model, onProgress, signal) => {\n if (model?.provider_config?.pipeline === \"zero-shot-object-detection\") {\n if (!input.labels || !Array.isArray(input.labels) || input.labels.length === 0) {\n throw new Error(\"Zero-shot object detection requires labels\");\n }\n const zeroShotDetector: ZeroShotObjectDetectionPipeline = await getPipeline(\n model!,\n onProgress,\n {\n abort_signal: signal,\n }\n );\n const result: any = await zeroShotDetector(input.image as string, Array.from(input.labels!), {\n threshold: (input as any).threshold,\n });\n\n const detections = Array.isArray(result) ? result : [result];\n\n return {\n detections: detections.map((d: any) => ({\n label: d.label,\n score: d.score,\n box: d.box,\n })),\n };\n }\n\n const detector: ObjectDetectionPipeline = await getPipeline(model!, onProgress, {\n abort_signal: signal,\n });\n const result: any = await detector(input.image as string, {\n threshold: (input as any).threshold,\n ...(signal ? { abort_signal: signal } : {}),\n });\n\n const detections = Array.isArray(result) ? result : [result];\n\n return {\n detections: detections.map((d: any) => ({\n label: d.label,\n score: d.score,\n box: d.box,\n })),\n };\n};\n/**\n * Helper function to convert RawImage to base64 PNG\n */\nfunction imageToBase64(image: RawImage): string {\n // Convert RawImage to base64 PNG\n // This is a simplified version - actual implementation would use canvas or similar\n return (image as any).toBase64?.() || \"\";\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 const { TextStreamer } = _transformersSdk!;\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\n// ========================================================================\n// Streaming support: converts TextStreamer callback to AsyncIterable\n// ========================================================================\n\ntype StreamEventQueue<T> = {\n push: (event: T) => void;\n done: () => void;\n error: (err: Error) => void;\n iterable: AsyncIterable<T>;\n};\n\nfunction createStreamEventQueue<T>(): StreamEventQueue<T> {\n const buffer: T[] = [];\n let resolve: ((value: IteratorResult<T>) => void) | null = null;\n let finished = false;\n let err: Error | null = null;\n\n const push = (event: T) => {\n if (resolve) {\n const r = resolve;\n resolve = null;\n r({ value: event, done: false });\n } else {\n buffer.push(event);\n }\n };\n\n const done = () => {\n finished = true;\n if (resolve) {\n const r = resolve;\n resolve = null;\n r({ value: undefined as any, done: true });\n }\n };\n\n const error = (e: Error) => {\n err = e;\n if (resolve) {\n const r = resolve;\n resolve = null;\n r({ value: undefined as any, done: true });\n }\n };\n\n const iterable: AsyncIterable<T> = {\n [Symbol.asyncIterator]() {\n return {\n next(): Promise<IteratorResult<T>> {\n if (err) return Promise.reject(err);\n if (buffer.length > 0) {\n return Promise.resolve({ value: buffer.shift()!, done: false });\n }\n if (finished) {\n return Promise.resolve({ value: undefined as any, done: true });\n }\n return new Promise<IteratorResult<T>>((r) => {\n resolve = r;\n });\n },\n };\n },\n };\n\n return { push, done, error, iterable };\n}\n\n/**\n * Creates a TextStreamer that pushes StreamEvents into an async queue.\n * The pipeline runs to completion and updates the queue; the caller\n * consumes the queue as an AsyncIterable<StreamEvent>.\n */\nfunction createStreamingTextStreamer(\n tokenizer: any,\n queue: StreamEventQueue<StreamEvent<any>>,\n signal?: AbortSignal\n) {\n const { TextStreamer } = _transformersSdk!;\n return new TextStreamer(tokenizer, {\n skip_prompt: true,\n decode_kwargs: { skip_special_tokens: true },\n callback_function: (text: string) => {\n queue.push({ type: \"text-delta\", port: \"text\", textDelta: text });\n },\n ...(signal ? { abort_signal: signal } : {}),\n });\n}\n\n// ========================================================================\n// Streaming implementations (append mode)\n// ========================================================================\n\nexport const HFT_TextGeneration_Stream: AiProviderStreamFn<\n TextGenerationTaskInput,\n TextGenerationTaskOutput,\n HfTransformersOnnxModelConfig\n> = async function* (input, model, signal): AsyncIterable<StreamEvent<TextGenerationTaskOutput>> {\n const noopProgress = () => {};\n const generateText: TextGenerationPipeline = await getPipeline(model!, noopProgress, {\n abort_signal: signal,\n });\n\n const queue = createStreamEventQueue<StreamEvent<TextGenerationTaskOutput>>();\n const streamer = createStreamingTextStreamer(generateText.tokenizer, queue, signal);\n\n const pipelinePromise = generateText(input.prompt, {\n streamer,\n ...(signal ? { abort_signal: signal } : {}),\n }).then(\n () => queue.done(),\n (err: Error) => queue.error(err)\n );\n\n yield* queue.iterable;\n await pipelinePromise;\n yield { type: \"finish\", data: {} as TextGenerationTaskOutput };\n};\n\nexport const HFT_TextRewriter_Stream: AiProviderStreamFn<\n TextRewriterTaskInput,\n TextRewriterTaskOutput,\n HfTransformersOnnxModelConfig\n> = async function* (input, model, signal): AsyncIterable<StreamEvent<TextRewriterTaskOutput>> {\n const noopProgress = () => {};\n const generateText: TextGenerationPipeline = await getPipeline(model!, noopProgress, {\n abort_signal: signal,\n });\n\n const queue = createStreamEventQueue<StreamEvent<TextRewriterTaskOutput>>();\n const streamer = createStreamingTextStreamer(generateText.tokenizer, queue);\n\n const promptedText = (input.prompt ? input.prompt + \"\\n\" : \"\") + input.text;\n\n const pipelinePromise = generateText(promptedText, {\n streamer,\n ...(signal ? { abort_signal: signal } : {}),\n }).then(\n () => queue.done(),\n (err: Error) => queue.error(err)\n );\n\n yield* queue.iterable;\n await pipelinePromise;\n yield { type: \"finish\", data: {} as TextRewriterTaskOutput };\n};\n\nexport const HFT_TextSummary_Stream: AiProviderStreamFn<\n TextSummaryTaskInput,\n TextSummaryTaskOutput,\n HfTransformersOnnxModelConfig\n> = async function* (input, model, signal): AsyncIterable<StreamEvent<TextSummaryTaskOutput>> {\n const noopProgress = () => {};\n const generateSummary: SummarizationPipeline = await getPipeline(model!, noopProgress, {\n abort_signal: signal,\n });\n\n const queue = createStreamEventQueue<StreamEvent<TextSummaryTaskOutput>>();\n const streamer = createStreamingTextStreamer(generateSummary.tokenizer, queue);\n\n const pipelinePromise = generateSummary(input.text, {\n streamer,\n ...(signal ? { abort_signal: signal } : {}),\n } as any).then(\n () => queue.done(),\n (err: Error) => queue.error(err)\n );\n\n yield* queue.iterable;\n await pipelinePromise;\n yield { type: \"finish\", data: {} as TextSummaryTaskOutput };\n};\n\nexport const HFT_TextQuestionAnswer_Stream: AiProviderStreamFn<\n TextQuestionAnswerTaskInput,\n TextQuestionAnswerTaskOutput,\n HfTransformersOnnxModelConfig\n> = async function* (\n input,\n model,\n signal\n): AsyncIterable<StreamEvent<TextQuestionAnswerTaskOutput>> {\n const noopProgress = () => {};\n const generateAnswer: QuestionAnsweringPipeline = await getPipeline(model!, noopProgress, {\n abort_signal: signal,\n });\n\n const queue = createStreamEventQueue<StreamEvent<TextQuestionAnswerTaskOutput>>();\n const streamer = createStreamingTextStreamer(generateAnswer.tokenizer, queue);\n\n let pipelineResult:\n | DocumentQuestionAnsweringSingle\n | DocumentQuestionAnsweringSingle[]\n | undefined;\n const pipelinePromise = generateAnswer(input.question, input.context, {\n streamer,\n ...(signal ? { abort_signal: signal } : {}),\n } as any).then(\n (result) => {\n pipelineResult = result;\n queue.done();\n },\n (err: Error) => queue.error(err)\n );\n\n yield* queue.iterable;\n await pipelinePromise;\n\n let answerText = \"\";\n if (pipelineResult !== undefined) {\n if (Array.isArray(pipelineResult)) {\n answerText = (pipelineResult[0] as DocumentQuestionAnsweringSingle)?.answer ?? \"\";\n } else {\n answerText = (pipelineResult as DocumentQuestionAnsweringSingle)?.answer ?? \"\";\n }\n }\n yield { type: \"finish\", data: { text: answerText } as TextQuestionAnswerTaskOutput };\n};\n\nexport const HFT_TextTranslation_Stream: AiProviderStreamFn<\n TextTranslationTaskInput,\n TextTranslationTaskOutput,\n HfTransformersOnnxModelConfig\n> = async function* (input, model, signal): AsyncIterable<StreamEvent<TextTranslationTaskOutput>> {\n const noopProgress = () => {};\n const translate: TranslationPipeline = await getPipeline(model!, noopProgress, {\n abort_signal: signal,\n });\n\n const queue = createStreamEventQueue<StreamEvent<TextTranslationTaskOutput>>();\n const streamer = createStreamingTextStreamer(translate.tokenizer, queue);\n\n const pipelinePromise = 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).then(\n () => queue.done(),\n (err: Error) => queue.error(err)\n );\n\n yield* queue.iterable;\n await pipelinePromise;\n yield { type: \"finish\", data: { target_lang: input.target_lang } as TextTranslationTaskOutput };\n};\n\n// ========================================================================\n// Task registries\n// ========================================================================\n\n/**\n * All HuggingFace Transformers task run functions, keyed by task type name.\n * Pass this to `new HuggingFaceTransformersProvider(HFT_TASKS)` when the\n * actual run function implementations are needed (inline mode, worker server).\n */\nexport const HFT_TASKS = {\n DownloadModelTask: HFT_Download,\n UnloadModelTask: HFT_Unload,\n TextEmbeddingTask: HFT_TextEmbedding,\n TextGenerationTask: HFT_TextGeneration,\n TextQuestionAnswerTask: HFT_TextQuestionAnswer,\n TextLanguageDetectionTask: HFT_TextLanguageDetection,\n TextClassificationTask: HFT_TextClassification,\n TextFillMaskTask: HFT_TextFillMask,\n TextNamedEntityRecognitionTask: HFT_TextNamedEntityRecognition,\n TextRewriterTask: HFT_TextRewriter,\n TextSummaryTask: HFT_TextSummary,\n TextTranslationTask: HFT_TextTranslation,\n ImageSegmentationTask: HFT_ImageSegmentation,\n ImageToTextTask: HFT_ImageToText,\n BackgroundRemovalTask: HFT_BackgroundRemoval,\n ImageEmbeddingTask: HFT_ImageEmbedding,\n ImageClassificationTask: HFT_ImageClassification,\n ObjectDetectionTask: HFT_ObjectDetection,\n} as const;\n\n/**\n * Streaming variants of HuggingFace Transformers task run functions.\n * Pass this as the second argument to `new HuggingFaceTransformersProvider(HFT_TASKS, HFT_STREAM_TASKS)`.\n */\nexport const HFT_STREAM_TASKS: Record<\n string,\n AiProviderStreamFn<any, any, HfTransformersOnnxModelConfig>\n> = {\n TextGenerationTask: HFT_TextGeneration_Stream,\n TextRewriterTask: HFT_TextRewriter_Stream,\n TextSummaryTask: HFT_TextSummary_Stream,\n TextQuestionAnswerTask: HFT_TextQuestionAnswer_Stream,\n TextTranslationTask: HFT_TextTranslation_Stream,\n};\n",
|
|
7
|
-
"/**\n * @license\n * Copyright 2025 Steven Roussey <sroussey@gmail.com>\n * SPDX-License-Identifier: Apache-2.0\n */\n\nexport const ANTHROPIC = \"ANTHROPIC\";\n",
|
|
8
|
-
"/**\n * @license\n * Copyright 2025 Steven Roussey <sroussey@gmail.com>\n * SPDX-License-Identifier: Apache-2.0\n */\n\nexport const GOOGLE_GEMINI = \"GOOGLE_GEMINI\";\n",
|
|
9
|
-
"/**\n * @license\n * Copyright 2025 Steven Roussey <sroussey@gmail.com>\n * SPDX-License-Identifier: Apache-2.0\n */\n\n// Constants (no SDK dependency)\nexport * from \"./anthropic/common/Anthropic_Constants\";\nexport * from \"./google-gemini/common/Gemini_Constants\";\nexport * from \"./hf-transformers/common/HFT_Constants\";\nexport * from \"./provider-ollama/common/Ollama_Constants\";\nexport * from \"./provider-openai/common/OpenAI_Constants\";\nexport * from \"./tf-mediapipe/common/TFMP_Constants\";\n\n// Model schemas (no SDK dependency)\nexport * from \"./anthropic/common/Anthropic_ModelSchema\";\nexport * from \"./google-gemini/common/Gemini_ModelSchema\";\nexport * from \"./hf-transformers/common/HFT_ModelSchema\";\nexport * from \"./provider-ollama/common/Ollama_ModelSchema\";\nexport * from \"./provider-openai/common/OpenAI_ModelSchema\";\nexport * from \"./tf-mediapipe/common/TFMP_ModelSchema\";\n\n// Provider classes (no SDK dependency -- they use dependency injection)\nexport * from \"./anthropic/AnthropicProvider\";\nexport * from \"./google-gemini/GoogleGeminiProvider\";\nexport * from \"./hf-transformers/HuggingFaceTransformersProvider\";\nexport * from \"./provider-ollama/OllamaProvider\";\nexport * from \"./provider-openai/OpenAiProvider\";\nexport * from \"./tf-mediapipe/TensorFlowMediaPipeProvider\";\n",
|
|
10
|
-
"/**\n * @license\n * Copyright 2025 Steven Roussey <sroussey@gmail.com>\n * SPDX-License-Identifier: Apache-2.0\n */\n\nexport const OLLAMA = \"OLLAMA\";\nexport const OLLAMA_DEFAULT_BASE_URL = \"http://localhost:11434\";\n",
|
|
11
|
-
"/**\n * @license\n * Copyright 2025 Steven Roussey <sroussey@gmail.com>\n * SPDX-License-Identifier: Apache-2.0\n */\n\nexport const OPENAI = \"OPENAI\";\n",
|
|
12
5
|
"/**\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\nexport type TextPipelineTask =\n | \"text-embedder\"\n | \"text-classifier\"\n | \"text-language-detector\"\n | \"genai-text\"\n | \"audio-classifier\"\n | \"audio-embedder\"\n | \"vision-face-detector\"\n | \"vision-face-landmarker\"\n | \"vision-face-stylizer\"\n | \"vision-gesture-recognizer\"\n | \"vision-hand-landmarker\"\n | \"vision-holistic-landmarker\"\n | \"vision-image-classifier\"\n | \"vision-image-embedder\"\n | \"vision-image-segmenter\"\n | \"vision-image-interactive-segmenter\"\n | \"vision-object-detector\"\n | \"vision-pose-landmarker\";\n\nexport const TextPipelineTask = {\n \"text-embedder\": \"text-embedder\",\n \"text-classifier\": \"text-classifier\",\n \"text-language-detector\": \"text-language-detector\",\n \"genai-text\": \"genai-text\",\n \"audio-classifier\": \"audio-classifier\",\n \"audio-embedder\": \"audio-embedder\",\n \"vision-face-detector\": \"vision-face-detector\",\n \"vision-face-landmarker\": \"vision-face-landmarker\",\n \"vision-face-stylizer\": \"vision-face-stylizer\",\n \"vision-gesture-recognizer\": \"vision-gesture-recognizer\",\n \"vision-hand-landmarker\": \"vision-hand-landmarker\",\n \"vision-holistic-landmarker\": \"vision-holistic-landmarker\",\n \"vision-image-classifier\": \"vision-image-classifier\",\n \"vision-image-embedder\": \"vision-image-embedder\",\n \"vision-image-segmenter\": \"vision-image-segmenter\",\n \"vision-image-interactive-segmenter\": \"vision-image-interactive-segmenter\",\n \"vision-object-detector\": \"vision-object-detector\",\n \"vision-pose-landmarker\": \"vision-pose-landmarker\",\n} as const satisfies Record<TextPipelineTask, TextPipelineTask>;\n",
|
|
13
|
-
"/**\n * @license\n * Copyright 2025 Steven Roussey <sroussey@gmail.com>\n * SPDX-License-Identifier: Apache-2.0\n */\n\nimport { ModelConfigSchema, ModelRecordSchema } from \"@workglow/ai\";\nimport { DataPortSchemaObject, FromSchema } from \"@workglow/util\";\nimport { ANTHROPIC } from \"./Anthropic_Constants\";\n\nexport const AnthropicModelSchema = {\n type: \"object\",\n properties: {\n provider: {\n const: ANTHROPIC,\n description: \"Discriminator: Anthropic cloud provider.\",\n },\n provider_config: {\n type: \"object\",\n description: \"Anthropic-specific configuration.\",\n properties: {\n model_name: {\n type: \"string\",\n description:\n \"The Anthropic model identifier (e.g., 'claude-sonnet-4-20250514', 'claude-3-5-haiku-20241022').\",\n },\n api_key: {\n type: \"string\",\n description:\n \"Anthropic API key. Falls back to ANTHROPIC_API_KEY environment variable if not set.\",\n \"x-ui-hidden\": true,\n },\n base_url: {\n type: \"string\",\n description: \"Base URL for the Anthropic API (optional).\",\n },\n max_tokens: {\n type: \"integer\",\n description: \"Default max tokens for responses. Anthropic requires this parameter.\",\n default: 1024,\n minimum: 1,\n },\n },\n required: [\"model_name\"],\n additionalProperties: false,\n },\n },\n required: [\"provider\", \"provider_config\"],\n additionalProperties: true,\n} as const satisfies DataPortSchemaObject;\n\nexport const AnthropicModelRecordSchema = {\n type: \"object\",\n properties: {\n ...ModelRecordSchema.properties,\n ...AnthropicModelSchema.properties,\n },\n required: [...ModelRecordSchema.required, ...AnthropicModelSchema.required],\n additionalProperties: false,\n} as const satisfies DataPortSchemaObject;\n\nexport type AnthropicModelRecord = FromSchema<typeof AnthropicModelRecordSchema>;\n\nexport const AnthropicModelConfigSchema = {\n type: \"object\",\n properties: {\n ...ModelConfigSchema.properties,\n ...AnthropicModelSchema.properties,\n },\n required: [...ModelConfigSchema.required, ...AnthropicModelSchema.required],\n additionalProperties: false,\n} as const satisfies DataPortSchemaObject;\n\nexport type AnthropicModelConfig = FromSchema<typeof AnthropicModelConfigSchema>;\n",
|
|
14
|
-
"/**\n * @license\n * Copyright 2025 Steven Roussey <sroussey@gmail.com>\n * SPDX-License-Identifier: Apache-2.0\n */\n\nimport { ModelConfigSchema, ModelRecordSchema } from \"@workglow/ai\";\nimport { DataPortSchemaObject, FromSchema } from \"@workglow/util\";\nimport { GOOGLE_GEMINI } from \"./Gemini_Constants\";\n\nexport const GeminiModelSchema = {\n type: \"object\",\n properties: {\n provider: {\n const: GOOGLE_GEMINI,\n description: \"Discriminator: Google Gemini cloud provider.\",\n },\n provider_config: {\n type: \"object\",\n description: \"Google Gemini-specific configuration.\",\n properties: {\n model_name: {\n type: \"string\",\n description:\n \"The Gemini model identifier (e.g., 'gemini-2.0-flash', 'text-embedding-004').\",\n },\n api_key: {\n type: \"string\",\n description: \"Google AI API key. Falls back to default API key if not set.\",\n },\n embedding_task_type: {\n oneOf: [\n { type: \"null\" },\n {\n type: \"string\",\n enum: [\n \"RETRIEVAL_QUERY\",\n \"RETRIEVAL_DOCUMENT\",\n \"SEMANTIC_SIMILARITY\",\n \"CLASSIFICATION\",\n \"CLUSTERING\",\n ],\n },\n ],\n description: \"Task type hint for embedding models.\",\n default: null,\n },\n },\n required: [\"model_name\"],\n additionalProperties: false,\n },\n },\n required: [\"provider\", \"provider_config\"],\n additionalProperties: true,\n} as const satisfies DataPortSchemaObject;\n\nexport const GeminiModelRecordSchema = {\n type: \"object\",\n properties: {\n ...ModelRecordSchema.properties,\n ...GeminiModelSchema.properties,\n },\n required: [...ModelRecordSchema.required, ...GeminiModelSchema.required],\n additionalProperties: false,\n} as const satisfies DataPortSchemaObject;\n\nexport type GeminiModelRecord = FromSchema<typeof GeminiModelRecordSchema>;\n\nexport const GeminiModelConfigSchema = {\n type: \"object\",\n properties: {\n ...ModelConfigSchema.properties,\n ...GeminiModelSchema.properties,\n },\n required: [...ModelConfigSchema.required, ...GeminiModelSchema.required],\n additionalProperties: false,\n} as const satisfies DataPortSchemaObject;\n\nexport type GeminiModelConfig = FromSchema<typeof GeminiModelConfigSchema>;\n",
|
|
15
|
-
"/**\n * @license\n * Copyright 2025 Steven Roussey <sroussey@gmail.com>\n * SPDX-License-Identifier: Apache-2.0\n */\n\nimport { ModelConfigSchema, ModelRecordSchema } 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 provider_config: {\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 model_path: {\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: \"auto\",\n },\n device: {\n type: \"string\",\n enum: [\"cpu\", \"gpu\", \"webgpu\", \"wasm\", \"metal\"],\n description: \"High-level device selection.\",\n default: \"webgpu\",\n },\n execution_providers: {\n type: \"array\",\n items: { type: \"string\" },\n description: \"Raw ONNX Runtime execution provider identifiers.\",\n \"x-ui-hidden\": true,\n },\n intra_op_num_threads: {\n type: \"integer\",\n minimum: 1,\n },\n inter_op_num_threads: {\n type: \"integer\",\n minimum: 1,\n },\n use_external_data_format: {\n type: \"boolean\",\n description: \"Whether the model uses external data format.\",\n },\n native_dimensions: {\n type: \"integer\",\n description: \"The native dimensions of the model.\",\n },\n pooling: {\n type: \"string\",\n enum: [\"mean\", \"last_token\", \"cls\"],\n description: \"The pooling strategy to use for the model.\",\n default: \"mean\",\n },\n normalize: {\n type: \"boolean\",\n description: \"Whether the model uses normalization.\",\n default: true,\n },\n language_style: {\n type: \"string\",\n description: \"The language style of the model.\",\n },\n mrl: {\n type: \"boolean\",\n description: \"Whether the model uses matryoshka.\",\n default: false,\n },\n },\n required: [\"model_path\", \"pipeline\"],\n additionalProperties: false,\n if: {\n properties: {\n pipeline: {\n const: \"feature-extraction\",\n },\n },\n },\n then: {\n required: [\"native_dimensions\"],\n },\n },\n },\n required: [\"provider\", \"provider_config\"],\n additionalProperties: true,\n} as const satisfies DataPortSchemaObject;\n\nexport const HfTransformersOnnxModelRecordSchema = {\n type: \"object\",\n properties: {\n ...ModelRecordSchema.properties,\n ...HfTransformersOnnxModelSchema.properties,\n },\n required: [...ModelRecordSchema.required, ...HfTransformersOnnxModelSchema.required],\n additionalProperties: false,\n} as const satisfies DataPortSchemaObject;\n\nexport type HfTransformersOnnxModelRecord = FromSchema<typeof HfTransformersOnnxModelRecordSchema>;\n\nexport const HfTransformersOnnxModelConfigSchema = {\n type: \"object\",\n properties: {\n ...ModelConfigSchema.properties,\n ...HfTransformersOnnxModelSchema.properties,\n },\n required: [...ModelConfigSchema.required, ...HfTransformersOnnxModelSchema.required],\n additionalProperties: false,\n} as const satisfies DataPortSchemaObject;\n\nexport type HfTransformersOnnxModelConfig = FromSchema<typeof HfTransformersOnnxModelConfigSchema>;\n",
|
|
16
|
-
"/**\n * @license\n * Copyright 2025 Steven Roussey <sroussey@gmail.com>\n * SPDX-License-Identifier: Apache-2.0\n */\n\nimport { ModelConfigSchema, ModelRecordSchema } from \"@workglow/ai\";\nimport { DataPortSchemaObject, FromSchema } from \"@workglow/util\";\nimport { OLLAMA, OLLAMA_DEFAULT_BASE_URL } from \"./Ollama_Constants\";\n\nexport const OllamaModelSchema = {\n type: \"object\",\n properties: {\n provider: {\n const: OLLAMA,\n description: \"Discriminator: Ollama local LLM server.\",\n },\n provider_config: {\n type: \"object\",\n description: \"Ollama-specific configuration.\",\n properties: {\n model_name: {\n type: \"string\",\n description: \"The Ollama model identifier (e.g., 'llama3.2', 'nomic-embed-text').\",\n },\n base_url: {\n type: \"string\",\n description: \"Base URL for the Ollama server.\",\n default: OLLAMA_DEFAULT_BASE_URL,\n },\n },\n required: [\"model_name\"],\n additionalProperties: false,\n },\n },\n required: [\"provider\", \"provider_config\"],\n additionalProperties: true,\n} as const satisfies DataPortSchemaObject;\n\nexport const OllamaModelRecordSchema = {\n type: \"object\",\n properties: {\n ...ModelRecordSchema.properties,\n ...OllamaModelSchema.properties,\n },\n required: [...ModelRecordSchema.required, ...OllamaModelSchema.required],\n additionalProperties: false,\n} as const satisfies DataPortSchemaObject;\n\nexport type OllamaModelRecord = FromSchema<typeof OllamaModelRecordSchema>;\n\nexport const OllamaModelConfigSchema = {\n type: \"object\",\n properties: {\n ...ModelConfigSchema.properties,\n ...OllamaModelSchema.properties,\n },\n required: [...ModelConfigSchema.required, ...OllamaModelSchema.required],\n additionalProperties: false,\n} as const satisfies DataPortSchemaObject;\n\nexport type OllamaModelConfig = FromSchema<typeof OllamaModelConfigSchema>;\n",
|
|
17
|
-
"/**\n * @license\n * Copyright 2025 Steven Roussey <sroussey@gmail.com>\n * SPDX-License-Identifier: Apache-2.0\n */\n\nimport { ModelConfigSchema, ModelRecordSchema } from \"@workglow/ai\";\nimport { DataPortSchemaObject, FromSchema } from \"@workglow/util\";\nimport { OPENAI } from \"./OpenAI_Constants\";\n\nexport const OpenAiModelSchema = {\n type: \"object\",\n properties: {\n provider: {\n const: OPENAI,\n description: \"Discriminator: OpenAI cloud provider.\",\n },\n provider_config: {\n type: \"object\",\n description: \"OpenAI-specific configuration.\",\n properties: {\n model_name: {\n type: \"string\",\n description: \"The OpenAI model identifier (e.g., 'gpt-4o', 'text-embedding-3-small').\",\n },\n api_key: {\n type: \"string\",\n description: \"OpenAI API key. Falls back to default API key if not set.\",\n },\n base_url: {\n type: \"string\",\n description: \"Base URL for the OpenAI API. Useful for Azure OpenAI or proxy servers.\",\n default: \"https://api.openai.com/v1\",\n },\n organization: {\n type: \"string\",\n description: \"OpenAI organization ID (optional).\",\n },\n },\n required: [\"model_name\"],\n additionalProperties: false,\n },\n },\n required: [\"provider\", \"provider_config\"],\n additionalProperties: true,\n} as const satisfies DataPortSchemaObject;\n\nexport const OpenAiModelRecordSchema = {\n type: \"object\",\n properties: {\n ...ModelRecordSchema.properties,\n ...OpenAiModelSchema.properties,\n },\n required: [...ModelRecordSchema.required, ...OpenAiModelSchema.required],\n additionalProperties: false,\n} as const satisfies DataPortSchemaObject;\n\nexport type OpenAiModelRecord = FromSchema<typeof OpenAiModelRecordSchema>;\n\nexport const OpenAiModelConfigSchema = {\n type: \"object\",\n properties: {\n ...ModelConfigSchema.properties,\n ...OpenAiModelSchema.properties,\n },\n required: [...ModelConfigSchema.required, ...OpenAiModelSchema.required],\n additionalProperties: false,\n} as const satisfies DataPortSchemaObject;\n\nexport type OpenAiModelConfig = FromSchema<typeof OpenAiModelConfigSchema>;\n",
|
|
18
6
|
"/**\n * @license\n * Copyright 2025 Steven Roussey <sroussey@gmail.com>\n * SPDX-License-Identifier: Apache-2.0\n */\n\nimport { ModelConfigSchema, ModelRecordSchema } from \"@workglow/ai\";\nimport { DataPortSchemaObject, FromSchema } from \"@workglow/util\";\nimport { TENSORFLOW_MEDIAPIPE, TextPipelineTask } 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 provider_config: {\n type: \"object\",\n description: \"TensorFlow MediaPipe-specific options.\",\n properties: {\n model_path: {\n type: \"string\",\n description: \"Filesystem path or URI for the ONNX model.\",\n },\n task_engine: {\n type: \"string\",\n enum: [\"text\", \"audio\", \"vision\", \"genai\"],\n description: \"Task engine for the MediaPipe model.\",\n },\n pipeline: {\n type: \"string\",\n enum: Object.values(TextPipelineTask),\n description: \"Pipeline task type for the MediaPipe model.\",\n },\n },\n required: [\"model_path\", \"task_engine\", \"pipeline\"],\n additionalProperties: false,\n },\n },\n required: [\"provider\", \"provider_config\"],\n additionalProperties: true,\n} as const satisfies DataPortSchemaObject;\n\nexport const TFMPModelRecordSchema = {\n type: \"object\",\n properties: {\n ...ModelRecordSchema.properties,\n ...TFMPModelSchema.properties,\n },\n required: [...ModelRecordSchema.required, ...TFMPModelSchema.required],\n additionalProperties: false,\n} as const satisfies DataPortSchemaObject;\n\nexport type TFMPModelRecord = FromSchema<typeof TFMPModelRecordSchema>;\n\nexport const TFMPModelConfigSchema = {\n type: \"object\",\n properties: {\n ...ModelConfigSchema.properties,\n ...TFMPModelSchema.properties,\n },\n required: [...ModelConfigSchema.required, ...TFMPModelSchema.required],\n additionalProperties: false,\n} as const satisfies DataPortSchemaObject;\n\nexport type TFMPModelConfig = FromSchema<typeof TFMPModelConfigSchema>;\n",
|
|
19
|
-
"/**\n * @license\n * Copyright 2025 Steven Roussey <sroussey@gmail.com>\n * SPDX-License-Identifier: Apache-2.0\n */\n\nimport { AiProvider, type AiProviderRunFn, type AiProviderStreamFn } from \"@workglow/ai\";\nimport { ANTHROPIC } from \"./common/Anthropic_Constants\";\nimport type { AnthropicModelConfig } from \"./common/Anthropic_ModelSchema\";\n\n/**\n * AI provider for Anthropic cloud models.\n *\n * Supports text generation, text rewriting, and text summarization via the\n * Anthropic Messages API using the `@anthropic-ai/sdk` SDK.\n *\n * Note: Anthropic does not offer an embeddings API, so TextEmbeddingTask\n * is not supported by this provider.\n *\n * Task run functions are injected via the constructor so that the SDK\n * is only imported where actually needed (inline mode, worker server), not on\n * the main thread in worker mode.\n *\n * @example\n * ```typescript\n * // Worker mode (main thread) -- lightweight, no SDK import:\n * await new AnthropicProvider().register({\n * mode: \"worker\",\n * worker: new Worker(new URL(\"./worker_anthropic.ts\", import.meta.url), { type: \"module\" }),\n * });\n *\n * // Inline mode -- caller provides the tasks:\n * import { ANTHROPIC_TASKS } from \"@workglow/ai-provider/anthropic\";\n * await new AnthropicProvider(ANTHROPIC_TASKS).register({ mode: \"inline\" });\n * ```\n */\nexport class AnthropicProvider extends AiProvider<AnthropicModelConfig> {\n readonly name = ANTHROPIC;\n\n readonly taskTypes = [\"TextGenerationTask\", \"TextRewriterTask\", \"TextSummaryTask\"] as const;\n\n constructor(\n tasks?: Record<string, AiProviderRunFn<any, any, AnthropicModelConfig>>,\n streamTasks?: Record<string, AiProviderStreamFn<any, any, AnthropicModelConfig>>\n ) {\n super(tasks, streamTasks);\n }\n}\n",
|
|
20
|
-
"/**\n * @license\n * Copyright 2025 Steven Roussey <sroussey@gmail.com>\n * SPDX-License-Identifier: Apache-2.0\n */\n\nimport { AiProvider, type AiProviderRunFn, type AiProviderStreamFn } from \"@workglow/ai\";\nimport { GOOGLE_GEMINI } from \"./common/Gemini_Constants\";\nimport type { GeminiModelConfig } from \"./common/Gemini_ModelSchema\";\n\n/**\n * AI provider for Google Gemini cloud models.\n *\n * Supports text generation, text embedding, text rewriting, and text summarization\n * via the Google Generative AI API using the `@google/generative-ai` SDK.\n *\n * Task run functions are injected via the constructor so that the SDK\n * is only imported where actually needed (inline mode, worker server), not on\n * the main thread in worker mode.\n *\n * @example\n * ```typescript\n * // Worker mode (main thread) -- lightweight, no SDK import:\n * await new GoogleGeminiProvider().register({\n * mode: \"worker\",\n * worker: new Worker(new URL(\"./worker_gemini.ts\", import.meta.url), { type: \"module\" }),\n * });\n *\n * // Inline mode -- caller provides the tasks:\n * import { GEMINI_TASKS } from \"@workglow/ai-provider/google-gemini\";\n * await new GoogleGeminiProvider(GEMINI_TASKS).register({ mode: \"inline\" });\n * ```\n */\nexport class GoogleGeminiProvider extends AiProvider<GeminiModelConfig> {\n readonly name = GOOGLE_GEMINI;\n\n readonly taskTypes = [\n \"TextGenerationTask\",\n \"TextEmbeddingTask\",\n \"TextRewriterTask\",\n \"TextSummaryTask\",\n ] as const;\n\n constructor(\n tasks?: Record<string, AiProviderRunFn<any, any, GeminiModelConfig>>,\n streamTasks?: Record<string, AiProviderStreamFn<any, any, GeminiModelConfig>>\n ) {\n super(tasks, streamTasks);\n }\n}\n",
|
|
21
|
-
"/**\n * @license\n * Copyright 2025 Steven Roussey <sroussey@gmail.com>\n * SPDX-License-Identifier: Apache-2.0\n */\n\nimport {\n AiProvider,\n type AiProviderRegisterOptions,\n type AiProviderRunFn,\n type AiProviderStreamFn,\n} from \"@workglow/ai\";\nimport { HF_TRANSFORMERS_ONNX } from \"./common/HFT_Constants\";\nimport type { HfTransformersOnnxModelConfig } from \"./common/HFT_ModelSchema\";\n\n/**\n * AI provider for HuggingFace Transformers ONNX models.\n *\n * Supports text, vision, and multimodal tasks via the @sroussey/transformers library.\n *\n * Task run functions are injected via the constructor so that the heavy\n * `@sroussey/transformers` library is only imported where actually needed\n * (inline mode, worker server), not on the main thread in worker mode.\n *\n * @example\n * ```typescript\n * // Worker mode (main thread) -- lightweight, no heavy imports:\n * await new HuggingFaceTransformersProvider().register({\n * mode: \"worker\",\n * worker: new Worker(new URL(\"./worker_hft.ts\", import.meta.url), { type: \"module\" }),\n * });\n *\n * // Inline mode -- caller provides the tasks:\n * import { HFT_TASKS } from \"@workglow/ai-provider/hf-transformers\";\n * await new HuggingFaceTransformersProvider(HFT_TASKS).register({ mode: \"inline\" });\n *\n * // Worker side -- caller provides the tasks:\n * import { HFT_TASKS } from \"@workglow/ai-provider/hf-transformers\";\n * new HuggingFaceTransformersProvider(HFT_TASKS).registerOnWorkerServer(workerServer);\n * ```\n */\nexport class HuggingFaceTransformersProvider extends AiProvider<HfTransformersOnnxModelConfig> {\n readonly name = HF_TRANSFORMERS_ONNX;\n\n readonly taskTypes = [\n \"DownloadModelTask\",\n \"UnloadModelTask\",\n \"TextEmbeddingTask\",\n \"TextGenerationTask\",\n \"TextQuestionAnswerTask\",\n \"TextLanguageDetectionTask\",\n \"TextClassificationTask\",\n \"TextFillMaskTask\",\n \"TextNamedEntityRecognitionTask\",\n \"TextRewriterTask\",\n \"TextSummaryTask\",\n \"TextTranslationTask\",\n \"ImageSegmentationTask\",\n \"ImageToTextTask\",\n \"BackgroundRemovalTask\",\n \"ImageEmbeddingTask\",\n \"ImageClassificationTask\",\n \"ObjectDetectionTask\",\n ] as const;\n\n constructor(\n tasks?: Record<string, AiProviderRunFn<any, any, HfTransformersOnnxModelConfig>>,\n streamTasks?: Record<string, AiProviderStreamFn<any, any, HfTransformersOnnxModelConfig>>\n ) {\n super(tasks, streamTasks);\n }\n\n protected override async onInitialize(options: AiProviderRegisterOptions): Promise<void> {\n if (options.mode === \"inline\") {\n const { env } = await import(\"@sroussey/transformers\");\n // @ts-ignore -- backends.onnx.wasm.proxy is not fully typed\n env.backends.onnx.wasm.proxy = true;\n }\n }\n\n override async dispose(): Promise<void> {\n if (this.tasks) {\n const { clearPipelineCache } = await import(\"./common/HFT_JobRunFns\");\n clearPipelineCache();\n }\n }\n}\n",
|
|
22
|
-
"/**\n * @license\n * Copyright 2025 Steven Roussey <sroussey@gmail.com>\n * SPDX-License-Identifier: Apache-2.0\n */\n\nimport { AiProvider, type AiProviderRunFn, type AiProviderStreamFn } from \"@workglow/ai\";\nimport { OLLAMA } from \"./common/Ollama_Constants\";\nimport type { OllamaModelConfig } from \"./common/Ollama_ModelSchema\";\n\n/**\n * AI provider for Ollama local LLM server.\n *\n * Supports text generation, text embedding, text rewriting, and text summarization\n * via the Ollama API using the `ollama` SDK.\n *\n * Ollama runs locally and does not require an API key -- only a `base_url`\n * (defaults to `http://localhost:11434`).\n *\n * Task run functions are injected via the constructor so that the `ollama` SDK\n * is only imported where actually needed (inline mode, worker server), not on\n * the main thread in worker mode.\n *\n * @example\n * ```typescript\n * // Worker mode (main thread) -- lightweight, no SDK import:\n * await new OllamaProvider().register({\n * mode: \"worker\",\n * worker: new Worker(new URL(\"./worker_ollama.ts\", import.meta.url), { type: \"module\" }),\n * });\n *\n * // Inline mode -- caller provides the tasks:\n * import { OLLAMA_TASKS } from \"@workglow/ai-provider/ollama\";\n * await new OllamaProvider(OLLAMA_TASKS).register({ mode: \"inline\" });\n * ```\n */\nexport class OllamaProvider extends AiProvider<OllamaModelConfig> {\n readonly name = OLLAMA;\n\n readonly taskTypes = [\n \"TextGenerationTask\",\n \"TextEmbeddingTask\",\n \"TextRewriterTask\",\n \"TextSummaryTask\",\n ] as const;\n\n constructor(\n tasks?: Record<string, AiProviderRunFn<any, any, OllamaModelConfig>>,\n streamTasks?: Record<string, AiProviderStreamFn<any, any, OllamaModelConfig>>\n ) {\n super(tasks, streamTasks);\n }\n}\n",
|
|
23
|
-
"/**\n * @license\n * Copyright 2025 Steven Roussey <sroussey@gmail.com>\n * SPDX-License-Identifier: Apache-2.0\n */\n\nimport { AiProvider, type AiProviderRunFn, type AiProviderStreamFn } from \"@workglow/ai\";\nimport { OPENAI } from \"./common/OpenAI_Constants\";\nimport type { OpenAiModelConfig } from \"./common/OpenAI_ModelSchema\";\n\n/**\n * AI provider for OpenAI cloud models.\n *\n * Supports text generation, text embedding, text rewriting, and text summarization\n * via the OpenAI API using the `openai` SDK.\n *\n * Task run functions are injected via the constructor so that the `openai` SDK\n * is only imported where actually needed (inline mode, worker server), not on\n * the main thread in worker mode.\n *\n * @example\n * ```typescript\n * // Worker mode (main thread) -- lightweight, no SDK import:\n * await new OpenAiProvider().register({\n * mode: \"worker\",\n * worker: new Worker(new URL(\"./worker_openai.ts\", import.meta.url), { type: \"module\" }),\n * });\n *\n * // Inline mode -- caller provides the tasks:\n * import { OPENAI_TASKS } from \"@workglow/ai-provider/openai\";\n * await new OpenAiProvider(OPENAI_TASKS).register({ mode: \"inline\" });\n *\n * // Worker side -- caller provides the tasks:\n * import { OPENAI_TASKS } from \"@workglow/ai-provider/openai\";\n * new OpenAiProvider(OPENAI_TASKS).registerOnWorkerServer(workerServer);\n * ```\n */\nexport class OpenAiProvider extends AiProvider<OpenAiModelConfig> {\n readonly name = OPENAI;\n\n readonly taskTypes = [\n \"TextGenerationTask\",\n \"TextEmbeddingTask\",\n \"TextRewriterTask\",\n \"TextSummaryTask\",\n ] as const;\n\n constructor(\n tasks?: Record<string, AiProviderRunFn<any, any, OpenAiModelConfig>>,\n streamTasks?: Record<string, AiProviderStreamFn<any, any, OpenAiModelConfig>>\n ) {\n super(tasks, streamTasks);\n }\n}\n",
|
|
24
7
|
"/**\n * @license\n * Copyright 2025 Steven Roussey <sroussey@gmail.com>\n * SPDX-License-Identifier: Apache-2.0\n */\n\nimport { AiProvider, type AiProviderRunFn } from \"@workglow/ai\";\nimport { TENSORFLOW_MEDIAPIPE } from \"./common/TFMP_Constants\";\nimport type { TFMPModelConfig } from \"./common/TFMP_ModelSchema\";\n\n/**\n * AI provider for TensorFlow MediaPipe models.\n *\n * Supports text, vision, and gesture recognition tasks via @mediapipe packages.\n *\n * Task run functions are injected via the constructor so that the heavy\n * `@mediapipe/*` libraries are only imported where actually needed\n * (inline mode, worker server), not on the main thread in worker mode.\n *\n * @example\n * ```typescript\n * // Worker mode (main thread) -- lightweight, no heavy imports:\n * await new TensorFlowMediaPipeProvider().register({\n * mode: \"worker\",\n * worker: new Worker(new URL(\"./worker_tfmp.ts\", import.meta.url), { type: \"module\" }),\n * });\n *\n * // Inline mode -- caller provides the tasks:\n * import { TFMP_TASKS } from \"@workglow/ai-provider/tf-mediapipe\";\n * await new TensorFlowMediaPipeProvider(TFMP_TASKS).register({ mode: \"inline\" });\n *\n * // Worker side -- caller provides the tasks:\n * import { TFMP_TASKS } from \"@workglow/ai-provider/tf-mediapipe\";\n * new TensorFlowMediaPipeProvider(TFMP_TASKS).registerOnWorkerServer(workerServer);\n * ```\n */\nexport class TensorFlowMediaPipeProvider extends AiProvider<TFMPModelConfig> {\n readonly name = TENSORFLOW_MEDIAPIPE;\n\n readonly taskTypes = [\n \"DownloadModelTask\",\n \"UnloadModelTask\",\n \"TextEmbeddingTask\",\n \"TextLanguageDetectionTask\",\n \"TextClassificationTask\",\n \"ImageSegmentationTask\",\n \"ImageEmbeddingTask\",\n \"ImageClassificationTask\",\n \"ObjectDetectionTask\",\n \"GestureRecognizerTask\",\n \"HandLandmarkerTask\",\n \"FaceDetectorTask\",\n \"FaceLandmarkerTask\",\n \"PoseLandmarkerTask\",\n ] as const;\n\n constructor(tasks?: Record<string, AiProviderRunFn<any, any, TFMPModelConfig>>) {\n super(tasks);\n }\n}\n"
|
|
25
8
|
],
|
|
26
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;IAMa,uBAAuB,wBACvB,iBAAiB,sBAajB,sBAwBA,qBAsBA,uBAeA,sBAaA,2BAcA;AAAA;AAAA,EAxFA,uBAAuB;AAAA,IAClC,MAAM;AAAA,IACN,MAAM;AAAA,IACN,MAAM;AAAA,IACN,IAAI;AAAA,IACJ,MAAM;AAAA,IACN,OAAO;AAAA,IACP,IAAI;AAAA,IACJ,MAAM;AAAA,IACN,OAAO;AAAA,EACT;AAAA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A;AAAA,EACF;AAAA,EAEA,WAAW,CAAC,OAAoE;AAAA,IAC9E,MAAM,KAAK;AAAA;AAEf;",
|
|
10
|
+
"debugId": "5DD642E9FD2CB22A64756E2164756E21",
|
|
28
11
|
"names": []
|
|
29
12
|
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"HFI_Worker.d.ts","sourceRoot":"","sources":["../../src/provider-hf-inference/HFI_Worker.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAMH,wBAAgB,0BAA0B,SAKzC"}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright 2025 Steven Roussey <sroussey@gmail.com>
|
|
4
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
5
|
+
*/
|
|
6
|
+
import { AiProvider, type AiProviderRunFn, type AiProviderStreamFn } from "@workglow/ai";
|
|
7
|
+
import type { HfInferenceModelConfig } from "./common/HFI_ModelSchema";
|
|
8
|
+
/**
|
|
9
|
+
* AI provider for Hugging Face Inference API.
|
|
10
|
+
*
|
|
11
|
+
* Supports text generation, text embedding, text rewriting, and text summarization
|
|
12
|
+
* via the Hugging Face Inference API using the `@huggingface/inference` SDK.
|
|
13
|
+
*
|
|
14
|
+
* Task run functions are injected via the constructor so that the `@huggingface/inference` SDK
|
|
15
|
+
* is only imported where actually needed (inline mode, worker server), not on
|
|
16
|
+
* the main thread in worker mode.
|
|
17
|
+
*
|
|
18
|
+
* @example
|
|
19
|
+
* ```typescript
|
|
20
|
+
* // Worker mode (main thread) -- lightweight, no SDK import:
|
|
21
|
+
* await new HfInferenceProvider().register({
|
|
22
|
+
* mode: "worker",
|
|
23
|
+
* worker: new Worker(new URL("./worker_hfi.ts", import.meta.url), { type: "module" }),
|
|
24
|
+
* });
|
|
25
|
+
*
|
|
26
|
+
* // Inline mode -- caller provides the tasks:
|
|
27
|
+
* import { HFI_TASKS } from "@workglow/ai-provider/hf-inference";
|
|
28
|
+
* await new HfInferenceProvider(HFI_TASKS).register({ mode: "inline" });
|
|
29
|
+
*
|
|
30
|
+
* // Worker side -- caller provides the tasks:
|
|
31
|
+
* import { HFI_TASKS } from "@workglow/ai-provider/hf-inference";
|
|
32
|
+
* new HfInferenceProvider(HFI_TASKS).registerOnWorkerServer(workerServer);
|
|
33
|
+
* ```
|
|
34
|
+
*/
|
|
35
|
+
export declare class HfInferenceProvider extends AiProvider<HfInferenceModelConfig> {
|
|
36
|
+
readonly name = "HF_INFERENCE";
|
|
37
|
+
readonly taskTypes: readonly ["TextGenerationTask", "TextEmbeddingTask", "TextRewriterTask", "TextSummaryTask"];
|
|
38
|
+
constructor(tasks?: Record<string, AiProviderRunFn<any, any, HfInferenceModelConfig>>, streamTasks?: Record<string, AiProviderStreamFn<any, any, HfInferenceModelConfig>>);
|
|
39
|
+
}
|
|
40
|
+
//# sourceMappingURL=HfInferenceProvider.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"HfInferenceProvider.d.ts","sourceRoot":"","sources":["../../src/provider-hf-inference/HfInferenceProvider.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,UAAU,EAAE,KAAK,eAAe,EAAE,KAAK,kBAAkB,EAAE,MAAM,cAAc,CAAC;AAEzF,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,0BAA0B,CAAC;AAEvE;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AACH,qBAAa,mBAAoB,SAAQ,UAAU,CAAC,sBAAsB,CAAC;IACzE,QAAQ,CAAC,IAAI,kBAAgB;IAE7B,QAAQ,CAAC,SAAS,8FAKP;gBAGT,KAAK,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,eAAe,CAAC,GAAG,EAAE,GAAG,EAAE,sBAAsB,CAAC,CAAC,EACzE,WAAW,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,kBAAkB,CAAC,GAAG,EAAE,GAAG,EAAE,sBAAsB,CAAC,CAAC;CAIrF"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"HFI_Constants.d.ts","sourceRoot":"","sources":["../../../src/provider-hf-inference/common/HFI_Constants.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,eAAO,MAAM,YAAY,iBAAiB,CAAC"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright 2025 Steven Roussey <sroussey@gmail.com>
|
|
4
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
5
|
+
*/
|
|
6
|
+
import type { AiProviderRunFn, AiProviderStreamFn, TextEmbeddingTaskInput, TextEmbeddingTaskOutput, TextGenerationTaskInput, TextGenerationTaskOutput, TextRewriterTaskInput, TextRewriterTaskOutput, TextSummaryTaskInput, TextSummaryTaskOutput } from "@workglow/ai";
|
|
7
|
+
import type { HfInferenceModelConfig } from "./HFI_ModelSchema";
|
|
8
|
+
export declare const HFI_TextGeneration: AiProviderRunFn<TextGenerationTaskInput, TextGenerationTaskOutput, HfInferenceModelConfig>;
|
|
9
|
+
export declare const HFI_TextEmbedding: AiProviderRunFn<TextEmbeddingTaskInput, TextEmbeddingTaskOutput, HfInferenceModelConfig>;
|
|
10
|
+
export declare const HFI_TextRewriter: AiProviderRunFn<TextRewriterTaskInput, TextRewriterTaskOutput, HfInferenceModelConfig>;
|
|
11
|
+
export declare const HFI_TextSummary: AiProviderRunFn<TextSummaryTaskInput, TextSummaryTaskOutput, HfInferenceModelConfig>;
|
|
12
|
+
export declare const HFI_TextGeneration_Stream: AiProviderStreamFn<TextGenerationTaskInput, TextGenerationTaskOutput, HfInferenceModelConfig>;
|
|
13
|
+
export declare const HFI_TextRewriter_Stream: AiProviderStreamFn<TextRewriterTaskInput, TextRewriterTaskOutput, HfInferenceModelConfig>;
|
|
14
|
+
export declare const HFI_TextSummary_Stream: AiProviderStreamFn<TextSummaryTaskInput, TextSummaryTaskOutput, HfInferenceModelConfig>;
|
|
15
|
+
export declare const HFI_TASKS: Record<string, AiProviderRunFn<any, any, HfInferenceModelConfig>>;
|
|
16
|
+
export declare const HFI_STREAM_TASKS: Record<string, AiProviderStreamFn<any, any, HfInferenceModelConfig>>;
|
|
17
|
+
//# sourceMappingURL=HFI_JobRunFns.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"HFI_JobRunFns.d.ts","sourceRoot":"","sources":["../../../src/provider-hf-inference/common/HFI_JobRunFns.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EACV,eAAe,EACf,kBAAkB,EAClB,sBAAsB,EACtB,uBAAuB,EACvB,uBAAuB,EACvB,wBAAwB,EACxB,qBAAqB,EACrB,sBAAsB,EACtB,oBAAoB,EACpB,qBAAqB,EACtB,MAAM,cAAc,CAAC;AAEtB,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,mBAAmB,CAAC;AAyChE,eAAO,MAAM,kBAAkB,EAAE,eAAe,CAC9C,uBAAuB,EACvB,wBAAwB,EACxB,sBAAsB,CAuBvB,CAAC;AAEF,eAAO,MAAM,iBAAiB,EAAE,eAAe,CAC7C,sBAAsB,EACtB,uBAAuB,EACvB,sBAAsB,CAmCvB,CAAC;AAEF,eAAO,MAAM,gBAAgB,EAAE,eAAe,CAC5C,qBAAqB,EACrB,sBAAsB,EACtB,sBAAsB,CAsBvB,CAAC;AAEF,eAAO,MAAM,eAAe,EAAE,eAAe,CAC3C,oBAAoB,EACpB,qBAAqB,EACrB,sBAAsB,CAsBvB,CAAC;AAMF,eAAO,MAAM,yBAAyB,EAAE,kBAAkB,CACxD,uBAAuB,EACvB,wBAAwB,EACxB,sBAAsB,CA+BvB,CAAC;AAEF,eAAO,MAAM,uBAAuB,EAAE,kBAAkB,CACtD,qBAAqB,EACrB,sBAAsB,EACtB,sBAAsB,CA0BvB,CAAC;AAEF,eAAO,MAAM,sBAAsB,EAAE,kBAAkB,CACrD,oBAAoB,EACpB,qBAAqB,EACrB,sBAAsB,CA0BvB,CAAC;AAMF,eAAO,MAAM,SAAS,EAAE,MAAM,CAAC,MAAM,EAAE,eAAe,CAAC,GAAG,EAAE,GAAG,EAAE,sBAAsB,CAAC,CAKvF,CAAC;AAEF,eAAO,MAAM,gBAAgB,EAAE,MAAM,CACnC,MAAM,EACN,kBAAkB,CAAC,GAAG,EAAE,GAAG,EAAE,sBAAsB,CAAC,CAKrD,CAAC"}
|
|
@@ -0,0 +1,146 @@
|
|
|
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 HfInferenceModelSchema: {
|
|
8
|
+
readonly type: "object";
|
|
9
|
+
readonly properties: {
|
|
10
|
+
readonly provider: {
|
|
11
|
+
readonly const: "HF_INFERENCE";
|
|
12
|
+
readonly description: "Discriminator: Hugging Face Inference API provider.";
|
|
13
|
+
};
|
|
14
|
+
readonly provider_config: {
|
|
15
|
+
readonly type: "object";
|
|
16
|
+
readonly description: "Hugging Face Inference-specific configuration.";
|
|
17
|
+
readonly properties: {
|
|
18
|
+
readonly model_name: {
|
|
19
|
+
readonly type: "string";
|
|
20
|
+
readonly description: "The Hugging Face model identifier (e.g., 'meta-llama/Llama-3.3-70B-Instruct').";
|
|
21
|
+
};
|
|
22
|
+
readonly api_key: {
|
|
23
|
+
readonly type: "string";
|
|
24
|
+
readonly description: "Hugging Face API key. Falls back to HF_TOKEN environment variable if not set.";
|
|
25
|
+
};
|
|
26
|
+
readonly provider: {
|
|
27
|
+
readonly type: "string";
|
|
28
|
+
readonly description: "Optional provider to route to specific HF inference providers (e.g., 'fal-ai', 'fireworks-ai').";
|
|
29
|
+
};
|
|
30
|
+
};
|
|
31
|
+
readonly required: readonly ["model_name"];
|
|
32
|
+
readonly additionalProperties: false;
|
|
33
|
+
};
|
|
34
|
+
};
|
|
35
|
+
readonly required: readonly ["provider", "provider_config"];
|
|
36
|
+
readonly additionalProperties: true;
|
|
37
|
+
};
|
|
38
|
+
export declare const HfInferenceModelRecordSchema: {
|
|
39
|
+
readonly type: "object";
|
|
40
|
+
readonly properties: {
|
|
41
|
+
readonly provider: {
|
|
42
|
+
readonly const: "HF_INFERENCE";
|
|
43
|
+
readonly description: "Discriminator: Hugging Face Inference API provider.";
|
|
44
|
+
};
|
|
45
|
+
readonly provider_config: {
|
|
46
|
+
readonly type: "object";
|
|
47
|
+
readonly description: "Hugging Face Inference-specific configuration.";
|
|
48
|
+
readonly properties: {
|
|
49
|
+
readonly model_name: {
|
|
50
|
+
readonly type: "string";
|
|
51
|
+
readonly description: "The Hugging Face model identifier (e.g., 'meta-llama/Llama-3.3-70B-Instruct').";
|
|
52
|
+
};
|
|
53
|
+
readonly api_key: {
|
|
54
|
+
readonly type: "string";
|
|
55
|
+
readonly description: "Hugging Face API key. Falls back to HF_TOKEN environment variable if not set.";
|
|
56
|
+
};
|
|
57
|
+
readonly provider: {
|
|
58
|
+
readonly type: "string";
|
|
59
|
+
readonly description: "Optional provider to route to specific HF inference providers (e.g., 'fal-ai', 'fireworks-ai').";
|
|
60
|
+
};
|
|
61
|
+
};
|
|
62
|
+
readonly required: readonly ["model_name"];
|
|
63
|
+
readonly additionalProperties: false;
|
|
64
|
+
};
|
|
65
|
+
readonly model_id: {
|
|
66
|
+
readonly type: "string";
|
|
67
|
+
};
|
|
68
|
+
readonly tasks: {
|
|
69
|
+
readonly type: "array";
|
|
70
|
+
readonly items: {
|
|
71
|
+
readonly type: "string";
|
|
72
|
+
};
|
|
73
|
+
readonly "x-ui-editor": "multiselect";
|
|
74
|
+
};
|
|
75
|
+
readonly title: {
|
|
76
|
+
readonly type: "string";
|
|
77
|
+
};
|
|
78
|
+
readonly description: {
|
|
79
|
+
readonly type: "string";
|
|
80
|
+
readonly "x-ui-editor": "textarea";
|
|
81
|
+
};
|
|
82
|
+
readonly metadata: {
|
|
83
|
+
readonly type: "object";
|
|
84
|
+
readonly default: {};
|
|
85
|
+
readonly "x-ui-hidden": true;
|
|
86
|
+
};
|
|
87
|
+
};
|
|
88
|
+
readonly required: readonly ["model_id", "tasks", "provider", "title", "description", "provider_config", "metadata", "provider", "provider_config"];
|
|
89
|
+
readonly additionalProperties: false;
|
|
90
|
+
};
|
|
91
|
+
export type HfInferenceModelRecord = FromSchema<typeof HfInferenceModelRecordSchema>;
|
|
92
|
+
export declare const HfInferenceModelConfigSchema: {
|
|
93
|
+
readonly type: "object";
|
|
94
|
+
readonly properties: {
|
|
95
|
+
readonly provider: {
|
|
96
|
+
readonly const: "HF_INFERENCE";
|
|
97
|
+
readonly description: "Discriminator: Hugging Face Inference API provider.";
|
|
98
|
+
};
|
|
99
|
+
readonly provider_config: {
|
|
100
|
+
readonly type: "object";
|
|
101
|
+
readonly description: "Hugging Face Inference-specific configuration.";
|
|
102
|
+
readonly properties: {
|
|
103
|
+
readonly model_name: {
|
|
104
|
+
readonly type: "string";
|
|
105
|
+
readonly description: "The Hugging Face model identifier (e.g., 'meta-llama/Llama-3.3-70B-Instruct').";
|
|
106
|
+
};
|
|
107
|
+
readonly api_key: {
|
|
108
|
+
readonly type: "string";
|
|
109
|
+
readonly description: "Hugging Face API key. Falls back to HF_TOKEN environment variable if not set.";
|
|
110
|
+
};
|
|
111
|
+
readonly provider: {
|
|
112
|
+
readonly type: "string";
|
|
113
|
+
readonly description: "Optional provider to route to specific HF inference providers (e.g., 'fal-ai', 'fireworks-ai').";
|
|
114
|
+
};
|
|
115
|
+
};
|
|
116
|
+
readonly required: readonly ["model_name"];
|
|
117
|
+
readonly additionalProperties: false;
|
|
118
|
+
};
|
|
119
|
+
readonly model_id: {
|
|
120
|
+
readonly type: "string";
|
|
121
|
+
};
|
|
122
|
+
readonly tasks: {
|
|
123
|
+
readonly type: "array";
|
|
124
|
+
readonly items: {
|
|
125
|
+
readonly type: "string";
|
|
126
|
+
};
|
|
127
|
+
readonly "x-ui-editor": "multiselect";
|
|
128
|
+
};
|
|
129
|
+
readonly title: {
|
|
130
|
+
readonly type: "string";
|
|
131
|
+
};
|
|
132
|
+
readonly description: {
|
|
133
|
+
readonly type: "string";
|
|
134
|
+
readonly "x-ui-editor": "textarea";
|
|
135
|
+
};
|
|
136
|
+
readonly metadata: {
|
|
137
|
+
readonly type: "object";
|
|
138
|
+
readonly default: {};
|
|
139
|
+
readonly "x-ui-hidden": true;
|
|
140
|
+
};
|
|
141
|
+
};
|
|
142
|
+
readonly required: readonly ["provider", "provider_config", "provider", "provider_config"];
|
|
143
|
+
readonly additionalProperties: false;
|
|
144
|
+
};
|
|
145
|
+
export type HfInferenceModelConfig = FromSchema<typeof HfInferenceModelConfigSchema>;
|
|
146
|
+
//# sourceMappingURL=HFI_ModelSchema.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"HFI_ModelSchema.d.ts","sourceRoot":"","sources":["../../../src/provider-hf-inference/common/HFI_ModelSchema.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAGH,OAAO,EAAwB,UAAU,EAAE,MAAM,gBAAgB,CAAC;AAGlE,eAAO,MAAM,sBAAsB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA8BM,CAAC;AAE1C,eAAO,MAAM,4BAA4B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAQA,CAAC;AAE1C,MAAM,MAAM,sBAAsB,GAAG,UAAU,CAAC,OAAO,4BAA4B,CAAC,CAAC;AAErF,eAAO,MAAM,4BAA4B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAQA,CAAC;AAE1C,MAAM,MAAM,sBAAsB,GAAG,UAAU,CAAC,OAAO,4BAA4B,CAAC,CAAC"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright 2025 Steven Roussey <sroussey@gmail.com>
|
|
4
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
5
|
+
*/
|
|
6
|
+
export * from "./common/HFI_Constants";
|
|
7
|
+
export * from "./common/HFI_JobRunFns";
|
|
8
|
+
export * from "./common/HFI_ModelSchema";
|
|
9
|
+
export * from "./HFI_Worker";
|
|
10
|
+
export * from "./HfInferenceProvider";
|
|
11
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/provider-hf-inference/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,cAAc,wBAAwB,CAAC;AACvC,cAAc,wBAAwB,CAAC;AACvC,cAAc,0BAA0B,CAAC;AACzC,cAAc,cAAc,CAAC;AAC7B,cAAc,uBAAuB,CAAC"}
|