@huggingface/inference 3.13.2 → 3.14.0
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/{src → commonjs}/InferenceClient.d.ts +2 -2
- package/dist/commonjs/InferenceClient.d.ts.map +1 -0
- package/dist/commonjs/InferenceClient.js +83 -0
- package/dist/commonjs/config.js +6 -0
- package/dist/commonjs/index.d.ts +7 -0
- package/dist/commonjs/index.d.ts.map +1 -0
- package/dist/commonjs/index.js +49 -0
- package/dist/commonjs/lib/InferenceOutputError.js +10 -0
- package/dist/commonjs/lib/getDefaultTask.js +48 -0
- package/dist/{src → commonjs}/lib/getInferenceProviderMapping.d.ts +1 -1
- package/dist/{src → commonjs}/lib/getInferenceProviderMapping.d.ts.map +1 -1
- package/dist/commonjs/lib/getInferenceProviderMapping.js +81 -0
- package/dist/{src → commonjs}/lib/getProviderHelper.d.ts +2 -2
- package/dist/{src → commonjs}/lib/getProviderHelper.d.ts.map +1 -1
- package/dist/commonjs/lib/getProviderHelper.js +168 -0
- package/dist/commonjs/lib/isUrl.js +6 -0
- package/dist/{src → commonjs}/lib/makeRequestOptions.d.ts +3 -3
- package/dist/{src → commonjs}/lib/makeRequestOptions.d.ts.map +1 -1
- package/dist/commonjs/lib/makeRequestOptions.js +161 -0
- package/dist/commonjs/package.d.ts +3 -0
- package/dist/commonjs/package.d.ts.map +1 -0
- package/dist/commonjs/package.js +6 -0
- package/dist/commonjs/package.json +3 -0
- package/dist/{src → commonjs}/providers/black-forest-labs.d.ts +2 -2
- package/dist/{src → commonjs}/providers/black-forest-labs.d.ts.map +1 -1
- package/dist/commonjs/providers/black-forest-labs.js +82 -0
- package/dist/{src → commonjs}/providers/cerebras.d.ts +1 -1
- package/dist/{src → commonjs}/providers/cerebras.d.ts.map +1 -1
- package/dist/commonjs/providers/cerebras.js +26 -0
- package/dist/{src → commonjs}/providers/cohere.d.ts +1 -1
- package/dist/{src → commonjs}/providers/cohere.d.ts.map +1 -1
- package/dist/commonjs/providers/cohere.js +29 -0
- package/dist/{src → commonjs}/providers/consts.d.ts +3 -3
- package/dist/commonjs/providers/consts.d.ts.map +1 -0
- package/dist/commonjs/providers/consts.js +35 -0
- package/dist/{src → commonjs}/providers/fal-ai.d.ts +3 -3
- package/dist/{src → commonjs}/providers/fal-ai.d.ts.map +1 -1
- package/dist/commonjs/providers/fal-ai.js +216 -0
- package/dist/{src → commonjs}/providers/featherless-ai.d.ts +2 -2
- package/dist/{src → commonjs}/providers/featherless-ai.d.ts.map +1 -1
- package/dist/commonjs/providers/featherless-ai.js +38 -0
- package/dist/{src → commonjs}/providers/fireworks-ai.d.ts +1 -1
- package/dist/commonjs/providers/fireworks-ai.d.ts.map +1 -0
- package/dist/commonjs/providers/fireworks-ai.js +29 -0
- package/dist/{src → commonjs}/providers/groq.d.ts +1 -1
- package/dist/{src → commonjs}/providers/groq.d.ts.map +1 -1
- package/dist/commonjs/providers/groq.js +39 -0
- package/dist/{src → commonjs}/providers/hf-inference.d.ts +6 -6
- package/dist/{src → commonjs}/providers/hf-inference.d.ts.map +1 -1
- package/dist/commonjs/providers/hf-inference.js +432 -0
- package/dist/{src → commonjs}/providers/hyperbolic.d.ts +2 -2
- package/dist/{src → commonjs}/providers/hyperbolic.d.ts.map +1 -1
- package/dist/commonjs/providers/hyperbolic.js +78 -0
- package/dist/{src → commonjs}/providers/nebius.d.ts +2 -2
- package/dist/{src → commonjs}/providers/nebius.d.ts.map +1 -1
- package/dist/commonjs/providers/nebius.js +70 -0
- package/dist/{src → commonjs}/providers/novita.d.ts +2 -2
- package/dist/{src → commonjs}/providers/novita.d.ts.map +1 -1
- package/dist/commonjs/providers/novita.js +73 -0
- package/dist/{src → commonjs}/providers/nscale.d.ts +2 -2
- package/dist/{src → commonjs}/providers/nscale.d.ts.map +1 -1
- package/dist/commonjs/providers/nscale.js +46 -0
- package/dist/{src → commonjs}/providers/openai.d.ts +1 -1
- package/dist/{src → commonjs}/providers/openai.d.ts.map +1 -1
- package/dist/commonjs/providers/openai.js +15 -0
- package/dist/{src → commonjs}/providers/ovhcloud.d.ts +2 -2
- package/dist/{src → commonjs}/providers/ovhcloud.d.ts.map +1 -1
- package/dist/commonjs/providers/ovhcloud.js +60 -0
- package/dist/{src → commonjs}/providers/providerHelper.d.ts +4 -4
- package/dist/{src → commonjs}/providers/providerHelper.d.ts.map +1 -1
- package/dist/commonjs/providers/providerHelper.js +108 -0
- package/dist/{src → commonjs}/providers/replicate.d.ts +2 -2
- package/dist/{src → commonjs}/providers/replicate.d.ts.map +1 -1
- package/dist/commonjs/providers/replicate.js +135 -0
- package/dist/{src → commonjs}/providers/sambanova.d.ts +3 -3
- package/dist/{src → commonjs}/providers/sambanova.d.ts.map +1 -1
- package/dist/commonjs/providers/sambanova.js +49 -0
- package/dist/{src → commonjs}/providers/together.d.ts +2 -2
- package/dist/{src → commonjs}/providers/together.d.ts.map +1 -1
- package/dist/commonjs/providers/together.js +71 -0
- package/dist/{src → commonjs}/snippets/getInferenceSnippets.d.ts +2 -2
- package/dist/{src → commonjs}/snippets/getInferenceSnippets.d.ts.map +1 -1
- package/dist/commonjs/snippets/getInferenceSnippets.js +312 -0
- package/dist/commonjs/snippets/index.js +5 -0
- package/dist/commonjs/snippets/templates.exported.js +81 -0
- package/dist/{src → commonjs}/tasks/audio/audioClassification.d.ts +2 -2
- package/dist/{src → commonjs}/tasks/audio/audioClassification.d.ts.map +1 -1
- package/dist/commonjs/tasks/audio/audioClassification.js +21 -0
- package/dist/{src → commonjs}/tasks/audio/audioToAudio.d.ts +2 -2
- package/dist/commonjs/tasks/audio/audioToAudio.d.ts.map +1 -0
- package/dist/commonjs/tasks/audio/audioToAudio.js +22 -0
- package/dist/{src → commonjs}/tasks/audio/automaticSpeechRecognition.d.ts +2 -2
- package/dist/commonjs/tasks/audio/automaticSpeechRecognition.d.ts.map +1 -0
- package/dist/commonjs/tasks/audio/automaticSpeechRecognition.js +25 -0
- package/dist/{src → commonjs}/tasks/audio/textToSpeech.d.ts +1 -1
- package/dist/commonjs/tasks/audio/textToSpeech.d.ts.map +1 -0
- package/dist/commonjs/tasks/audio/textToSpeech.js +19 -0
- package/dist/{src → commonjs}/tasks/audio/utils.d.ts +1 -1
- package/dist/commonjs/tasks/audio/utils.d.ts.map +1 -0
- package/dist/commonjs/tasks/audio/utils.js +12 -0
- package/dist/{src → commonjs}/tasks/custom/request.d.ts +1 -1
- package/dist/commonjs/tasks/custom/request.d.ts.map +1 -0
- package/dist/commonjs/tasks/custom/request.js +17 -0
- package/dist/{src → commonjs}/tasks/custom/streamingRequest.d.ts +1 -1
- package/dist/commonjs/tasks/custom/streamingRequest.d.ts.map +1 -0
- package/dist/commonjs/tasks/custom/streamingRequest.js +16 -0
- package/dist/{src → commonjs}/tasks/cv/imageClassification.d.ts +2 -2
- package/dist/commonjs/tasks/cv/imageClassification.d.ts.map +1 -0
- package/dist/commonjs/tasks/cv/imageClassification.js +21 -0
- package/dist/{src → commonjs}/tasks/cv/imageSegmentation.d.ts +2 -2
- package/dist/commonjs/tasks/cv/imageSegmentation.d.ts.map +1 -0
- package/dist/commonjs/tasks/cv/imageSegmentation.js +21 -0
- package/dist/{src → commonjs}/tasks/cv/imageToImage.d.ts +1 -1
- package/dist/commonjs/tasks/cv/imageToImage.d.ts.map +1 -0
- package/dist/commonjs/tasks/cv/imageToImage.js +20 -0
- package/dist/{src → commonjs}/tasks/cv/imageToText.d.ts +2 -2
- package/dist/commonjs/tasks/cv/imageToText.d.ts.map +1 -0
- package/dist/commonjs/tasks/cv/imageToText.js +20 -0
- package/dist/{src → commonjs}/tasks/cv/objectDetection.d.ts +2 -2
- package/dist/commonjs/tasks/cv/objectDetection.d.ts.map +1 -0
- package/dist/commonjs/tasks/cv/objectDetection.js +21 -0
- package/dist/{src → commonjs}/tasks/cv/textToImage.d.ts +1 -1
- package/dist/commonjs/tasks/cv/textToImage.d.ts.map +1 -0
- package/dist/commonjs/tasks/cv/textToImage.js +17 -0
- package/dist/{src → commonjs}/tasks/cv/textToVideo.d.ts +1 -1
- package/dist/commonjs/tasks/cv/textToVideo.d.ts.map +1 -0
- package/dist/commonjs/tasks/cv/textToVideo.js +17 -0
- package/dist/{src → commonjs}/tasks/cv/utils.d.ts +1 -1
- package/dist/commonjs/tasks/cv/utils.d.ts.map +1 -0
- package/dist/commonjs/tasks/cv/utils.js +7 -0
- package/dist/{src → commonjs}/tasks/cv/zeroShotImageClassification.d.ts +1 -1
- package/dist/commonjs/tasks/cv/zeroShotImageClassification.d.ts.map +1 -0
- package/dist/commonjs/tasks/cv/zeroShotImageClassification.js +39 -0
- package/dist/commonjs/tasks/index.d.ts +33 -0
- package/dist/commonjs/tasks/index.d.ts.map +1 -0
- package/dist/commonjs/tasks/index.js +54 -0
- package/dist/{src → commonjs}/tasks/multimodal/documentQuestionAnswering.d.ts +1 -1
- package/dist/commonjs/tasks/multimodal/documentQuestionAnswering.d.ts.map +1 -0
- package/dist/commonjs/tasks/multimodal/documentQuestionAnswering.js +27 -0
- package/dist/{src → commonjs}/tasks/multimodal/visualQuestionAnswering.d.ts +1 -1
- package/dist/commonjs/tasks/multimodal/visualQuestionAnswering.d.ts.map +1 -0
- package/dist/commonjs/tasks/multimodal/visualQuestionAnswering.js +27 -0
- package/dist/{src → commonjs}/tasks/nlp/chatCompletion.d.ts +1 -1
- package/dist/{src → commonjs}/tasks/nlp/chatCompletion.d.ts.map +1 -1
- package/dist/commonjs/tasks/nlp/chatCompletion.js +18 -0
- package/dist/{src → commonjs}/tasks/nlp/chatCompletionStream.d.ts +1 -1
- package/dist/{src → commonjs}/tasks/nlp/chatCompletionStream.d.ts.map +1 -1
- package/dist/commonjs/tasks/nlp/chatCompletionStream.js +17 -0
- package/dist/{src → commonjs}/tasks/nlp/featureExtraction.d.ts +1 -1
- package/dist/commonjs/tasks/nlp/featureExtraction.d.ts.map +1 -0
- package/dist/commonjs/tasks/nlp/featureExtraction.js +18 -0
- package/dist/{src → commonjs}/tasks/nlp/fillMask.d.ts +1 -1
- package/dist/commonjs/tasks/nlp/fillMask.d.ts.map +1 -0
- package/dist/commonjs/tasks/nlp/fillMask.js +18 -0
- package/dist/{src → commonjs}/tasks/nlp/questionAnswering.d.ts +1 -1
- package/dist/commonjs/tasks/nlp/questionAnswering.d.ts.map +1 -0
- package/dist/commonjs/tasks/nlp/questionAnswering.js +18 -0
- package/dist/{src → commonjs}/tasks/nlp/sentenceSimilarity.d.ts +1 -1
- package/dist/commonjs/tasks/nlp/sentenceSimilarity.d.ts.map +1 -0
- package/dist/commonjs/tasks/nlp/sentenceSimilarity.js +18 -0
- package/dist/{src → commonjs}/tasks/nlp/summarization.d.ts +1 -1
- package/dist/commonjs/tasks/nlp/summarization.d.ts.map +1 -0
- package/dist/commonjs/tasks/nlp/summarization.js +18 -0
- package/dist/{src → commonjs}/tasks/nlp/tableQuestionAnswering.d.ts +1 -1
- package/dist/{src → commonjs}/tasks/nlp/tableQuestionAnswering.d.ts.map +1 -1
- package/dist/commonjs/tasks/nlp/tableQuestionAnswering.js +18 -0
- package/dist/{src → commonjs}/tasks/nlp/textClassification.d.ts +1 -1
- package/dist/commonjs/tasks/nlp/textClassification.d.ts.map +1 -0
- package/dist/commonjs/tasks/nlp/textClassification.js +18 -0
- package/dist/{src → commonjs}/tasks/nlp/textGeneration.d.ts +1 -1
- package/dist/commonjs/tasks/nlp/textGeneration.d.ts.map +1 -0
- package/dist/commonjs/tasks/nlp/textGeneration.js +18 -0
- package/dist/{src → commonjs}/tasks/nlp/textGenerationStream.d.ts +1 -1
- package/dist/commonjs/tasks/nlp/textGenerationStream.d.ts.map +1 -0
- package/dist/commonjs/tasks/nlp/textGenerationStream.js +17 -0
- package/dist/{src → commonjs}/tasks/nlp/tokenClassification.d.ts +1 -1
- package/dist/{src → commonjs}/tasks/nlp/tokenClassification.d.ts.map +1 -1
- package/dist/commonjs/tasks/nlp/tokenClassification.js +18 -0
- package/dist/{src → commonjs}/tasks/nlp/translation.d.ts +1 -1
- package/dist/commonjs/tasks/nlp/translation.d.ts.map +1 -0
- package/dist/commonjs/tasks/nlp/translation.js +18 -0
- package/dist/{src → commonjs}/tasks/nlp/zeroShotClassification.d.ts +1 -1
- package/dist/{src → commonjs}/tasks/nlp/zeroShotClassification.d.ts.map +1 -1
- package/dist/commonjs/tasks/nlp/zeroShotClassification.js +18 -0
- package/dist/{src → commonjs}/tasks/tabular/tabularClassification.d.ts +1 -1
- package/dist/commonjs/tasks/tabular/tabularClassification.d.ts.map +1 -0
- package/dist/commonjs/tasks/tabular/tabularClassification.js +20 -0
- package/dist/{src → commonjs}/tasks/tabular/tabularRegression.d.ts +1 -1
- package/dist/commonjs/tasks/tabular/tabularRegression.d.ts.map +1 -0
- package/dist/commonjs/tasks/tabular/tabularRegression.js +20 -0
- package/dist/{src → commonjs}/types.d.ts +1 -1
- package/dist/{src → commonjs}/types.d.ts.map +1 -1
- package/dist/commonjs/types.js +23 -0
- package/dist/commonjs/utils/base64FromBytes.js +15 -0
- package/dist/commonjs/utils/delay.js +8 -0
- package/dist/commonjs/utils/distributive-omit.js +7 -0
- package/dist/commonjs/utils/isBackend.js +6 -0
- package/dist/commonjs/utils/isFrontend.js +5 -0
- package/dist/commonjs/utils/omit.js +13 -0
- package/dist/commonjs/utils/pick.js +13 -0
- package/dist/{src → commonjs}/utils/request.d.ts +2 -2
- package/dist/{src → commonjs}/utils/request.d.ts.map +1 -1
- package/dist/commonjs/utils/request.js +116 -0
- package/dist/commonjs/utils/toArray.js +9 -0
- package/dist/commonjs/utils/typedEntries.js +6 -0
- package/dist/commonjs/utils/typedInclude.js +6 -0
- package/dist/commonjs/vendor/fetch-event-source/parse.d.ts.map +1 -0
- package/dist/commonjs/vendor/fetch-event-source/parse.js +185 -0
- package/dist/commonjs/vendor/fetch-event-source/parse.spec.js +370 -0
- package/dist/esm/InferenceClient.d.ts +32 -0
- package/dist/esm/InferenceClient.d.ts.map +1 -0
- package/dist/esm/InferenceClient.js +44 -0
- package/dist/esm/config.d.ts +4 -0
- package/dist/esm/config.d.ts.map +1 -0
- package/dist/esm/config.js +3 -0
- package/dist/esm/index.d.ts +7 -0
- package/dist/esm/index.d.ts.map +1 -0
- package/dist/{src/index.d.ts → esm/index.js} +4 -5
- package/dist/esm/lib/InferenceOutputError.d.ts +4 -0
- package/dist/esm/lib/InferenceOutputError.d.ts.map +1 -0
- package/dist/esm/lib/InferenceOutputError.js +6 -0
- package/dist/esm/lib/getDefaultTask.d.ts +11 -0
- package/dist/esm/lib/getDefaultTask.d.ts.map +1 -0
- package/dist/esm/lib/getDefaultTask.js +45 -0
- package/dist/esm/lib/getInferenceProviderMapping.d.ts +25 -0
- package/dist/esm/lib/getInferenceProviderMapping.d.ts.map +1 -0
- package/dist/esm/lib/getInferenceProviderMapping.js +75 -0
- package/dist/esm/lib/getProviderHelper.d.ts +37 -0
- package/dist/esm/lib/getProviderHelper.d.ts.map +1 -0
- package/dist/esm/lib/getProviderHelper.js +131 -0
- package/dist/esm/lib/isUrl.d.ts +2 -0
- package/dist/esm/lib/isUrl.d.ts.map +1 -0
- package/dist/esm/lib/isUrl.js +3 -0
- package/dist/esm/lib/makeRequestOptions.d.ts +31 -0
- package/dist/esm/lib/makeRequestOptions.d.ts.map +1 -0
- package/dist/esm/lib/makeRequestOptions.js +157 -0
- package/dist/esm/package.d.ts +3 -0
- package/dist/esm/package.d.ts.map +1 -0
- package/dist/esm/package.js +3 -0
- package/dist/esm/package.json +3 -0
- package/dist/esm/providers/black-forest-labs.d.ts +15 -0
- package/dist/esm/providers/black-forest-labs.d.ts.map +1 -0
- package/dist/esm/providers/black-forest-labs.js +78 -0
- package/dist/esm/providers/cerebras.d.ts +21 -0
- package/dist/esm/providers/cerebras.d.ts.map +1 -0
- package/dist/esm/providers/cerebras.js +22 -0
- package/dist/esm/providers/cohere.d.ts +22 -0
- package/dist/esm/providers/cohere.d.ts.map +1 -0
- package/dist/esm/providers/cohere.js +25 -0
- package/dist/esm/providers/consts.d.ts +12 -0
- package/dist/esm/providers/consts.d.ts.map +1 -0
- package/dist/esm/providers/consts.js +32 -0
- package/dist/esm/providers/fal-ai.d.ts +42 -0
- package/dist/esm/providers/fal-ai.d.ts.map +1 -0
- package/dist/esm/providers/fal-ai.js +209 -0
- package/dist/esm/providers/featherless-ai.d.ts +22 -0
- package/dist/esm/providers/featherless-ai.d.ts.map +1 -0
- package/dist/esm/providers/featherless-ai.js +33 -0
- package/dist/esm/providers/fireworks-ai.d.ts +22 -0
- package/dist/esm/providers/fireworks-ai.d.ts.map +1 -0
- package/dist/esm/providers/fireworks-ai.js +25 -0
- package/dist/esm/providers/groq.d.ts +10 -0
- package/dist/esm/providers/groq.d.ts.map +1 -0
- package/dist/esm/providers/groq.js +34 -0
- package/dist/esm/providers/hf-inference.d.ts +131 -0
- package/dist/esm/providers/hf-inference.d.ts.map +1 -0
- package/dist/esm/providers/hf-inference.js +400 -0
- package/dist/esm/providers/hyperbolic.d.ts +48 -0
- package/dist/esm/providers/hyperbolic.d.ts.map +1 -0
- package/dist/esm/providers/hyperbolic.js +72 -0
- package/dist/esm/providers/nebius.d.ts +49 -0
- package/dist/esm/providers/nebius.d.ts.map +1 -0
- package/dist/esm/providers/nebius.js +63 -0
- package/dist/esm/providers/novita.d.ts +22 -0
- package/dist/esm/providers/novita.d.ts.map +1 -0
- package/dist/esm/providers/novita.js +67 -0
- package/dist/esm/providers/nscale.d.ts +35 -0
- package/dist/esm/providers/nscale.d.ts.map +1 -0
- package/dist/esm/providers/nscale.js +41 -0
- package/dist/esm/providers/openai.d.ts +8 -0
- package/dist/esm/providers/openai.d.ts.map +1 -0
- package/dist/esm/providers/openai.js +11 -0
- package/dist/esm/providers/ovhcloud.d.ts +38 -0
- package/dist/esm/providers/ovhcloud.d.ts.map +1 -0
- package/dist/esm/providers/ovhcloud.js +55 -0
- package/dist/esm/providers/providerHelper.d.ts +186 -0
- package/dist/esm/providers/providerHelper.d.ts.map +1 -0
- package/dist/esm/providers/providerHelper.js +102 -0
- package/dist/esm/providers/replicate.d.ts +25 -0
- package/dist/esm/providers/replicate.d.ts.map +1 -0
- package/dist/esm/providers/replicate.js +129 -0
- package/dist/esm/providers/sambanova.d.ts +14 -0
- package/dist/esm/providers/sambanova.d.ts.map +1 -0
- package/dist/esm/providers/sambanova.js +44 -0
- package/dist/esm/providers/together.d.ts +49 -0
- package/dist/esm/providers/together.d.ts.map +1 -0
- package/dist/esm/providers/together.js +65 -0
- package/dist/esm/snippets/getInferenceSnippets.d.ts +9 -0
- package/dist/esm/snippets/getInferenceSnippets.d.ts.map +1 -0
- package/dist/esm/snippets/getInferenceSnippets.js +309 -0
- package/dist/esm/snippets/index.d.ts +2 -0
- package/dist/esm/snippets/index.d.ts.map +1 -0
- package/dist/esm/snippets/index.js +1 -0
- package/dist/esm/snippets/templates.exported.d.ts +2 -0
- package/dist/esm/snippets/templates.exported.d.ts.map +1 -0
- package/dist/esm/snippets/templates.exported.js +78 -0
- package/dist/esm/tasks/audio/audioClassification.d.ts +10 -0
- package/dist/esm/tasks/audio/audioClassification.d.ts.map +1 -0
- package/dist/esm/tasks/audio/audioClassification.js +18 -0
- package/dist/esm/tasks/audio/audioToAudio.d.ts +29 -0
- package/dist/esm/tasks/audio/audioToAudio.d.ts.map +1 -0
- package/dist/esm/tasks/audio/audioToAudio.js +19 -0
- package/dist/esm/tasks/audio/automaticSpeechRecognition.d.ts +10 -0
- package/dist/esm/tasks/audio/automaticSpeechRecognition.d.ts.map +1 -0
- package/dist/esm/tasks/audio/automaticSpeechRecognition.js +22 -0
- package/dist/esm/tasks/audio/textToSpeech.d.ts +10 -0
- package/dist/esm/tasks/audio/textToSpeech.d.ts.map +1 -0
- package/dist/esm/tasks/audio/textToSpeech.js +16 -0
- package/dist/esm/tasks/audio/utils.d.ts +12 -0
- package/dist/esm/tasks/audio/utils.d.ts.map +1 -0
- package/dist/esm/tasks/audio/utils.js +9 -0
- package/dist/esm/tasks/custom/request.d.ts +10 -0
- package/dist/esm/tasks/custom/request.d.ts.map +1 -0
- package/dist/esm/tasks/custom/request.js +14 -0
- package/dist/esm/tasks/custom/streamingRequest.d.ts +10 -0
- package/dist/esm/tasks/custom/streamingRequest.d.ts.map +1 -0
- package/dist/esm/tasks/custom/streamingRequest.js +13 -0
- package/dist/esm/tasks/cv/imageClassification.d.ts +10 -0
- package/dist/esm/tasks/cv/imageClassification.d.ts.map +1 -0
- package/dist/esm/tasks/cv/imageClassification.js +18 -0
- package/dist/esm/tasks/cv/imageSegmentation.d.ts +10 -0
- package/dist/esm/tasks/cv/imageSegmentation.d.ts.map +1 -0
- package/dist/esm/tasks/cv/imageSegmentation.js +18 -0
- package/dist/esm/tasks/cv/imageToImage.d.ts +9 -0
- package/dist/esm/tasks/cv/imageToImage.d.ts.map +1 -0
- package/dist/esm/tasks/cv/imageToImage.js +17 -0
- package/dist/esm/tasks/cv/imageToText.d.ts +9 -0
- package/dist/esm/tasks/cv/imageToText.d.ts.map +1 -0
- package/dist/esm/tasks/cv/imageToText.js +17 -0
- package/dist/esm/tasks/cv/objectDetection.d.ts +10 -0
- package/dist/esm/tasks/cv/objectDetection.d.ts.map +1 -0
- package/dist/esm/tasks/cv/objectDetection.js +18 -0
- package/dist/esm/tasks/cv/textToImage.d.ts +18 -0
- package/dist/esm/tasks/cv/textToImage.d.ts.map +1 -0
- package/dist/esm/tasks/cv/textToImage.js +14 -0
- package/dist/esm/tasks/cv/textToVideo.d.ts +6 -0
- package/dist/esm/tasks/cv/textToVideo.d.ts.map +1 -0
- package/dist/esm/tasks/cv/textToVideo.js +14 -0
- package/dist/esm/tasks/cv/utils.d.ts +11 -0
- package/dist/esm/tasks/cv/utils.d.ts.map +1 -0
- package/dist/esm/tasks/cv/utils.js +4 -0
- package/dist/esm/tasks/cv/zeroShotImageClassification.d.ts +18 -0
- package/dist/esm/tasks/cv/zeroShotImageClassification.d.ts.map +1 -0
- package/dist/esm/tasks/cv/zeroShotImageClassification.js +36 -0
- package/dist/esm/tasks/index.d.ts +33 -0
- package/dist/esm/tasks/index.d.ts.map +1 -0
- package/dist/esm/tasks/index.js +38 -0
- package/dist/esm/tasks/multimodal/documentQuestionAnswering.d.ts +12 -0
- package/dist/esm/tasks/multimodal/documentQuestionAnswering.d.ts.map +1 -0
- package/dist/esm/tasks/multimodal/documentQuestionAnswering.js +24 -0
- package/dist/esm/tasks/multimodal/visualQuestionAnswering.d.ts +12 -0
- package/dist/esm/tasks/multimodal/visualQuestionAnswering.d.ts.map +1 -0
- package/dist/esm/tasks/multimodal/visualQuestionAnswering.js +24 -0
- package/dist/esm/tasks/nlp/chatCompletion.d.ts +7 -0
- package/dist/esm/tasks/nlp/chatCompletion.d.ts.map +1 -0
- package/dist/esm/tasks/nlp/chatCompletion.js +15 -0
- package/dist/esm/tasks/nlp/chatCompletionStream.d.ts +7 -0
- package/dist/esm/tasks/nlp/chatCompletionStream.d.ts.map +1 -0
- package/dist/esm/tasks/nlp/chatCompletionStream.js +14 -0
- package/dist/esm/tasks/nlp/featureExtraction.d.ts +17 -0
- package/dist/esm/tasks/nlp/featureExtraction.d.ts.map +1 -0
- package/dist/esm/tasks/nlp/featureExtraction.js +15 -0
- package/dist/esm/tasks/nlp/fillMask.d.ts +8 -0
- package/dist/esm/tasks/nlp/fillMask.d.ts.map +1 -0
- package/dist/esm/tasks/nlp/fillMask.js +15 -0
- package/dist/esm/tasks/nlp/questionAnswering.d.ts +8 -0
- package/dist/esm/tasks/nlp/questionAnswering.d.ts.map +1 -0
- package/dist/esm/tasks/nlp/questionAnswering.js +15 -0
- package/dist/esm/tasks/nlp/sentenceSimilarity.d.ts +8 -0
- package/dist/esm/tasks/nlp/sentenceSimilarity.d.ts.map +1 -0
- package/dist/esm/tasks/nlp/sentenceSimilarity.js +15 -0
- package/dist/esm/tasks/nlp/summarization.d.ts +8 -0
- package/dist/esm/tasks/nlp/summarization.d.ts.map +1 -0
- package/dist/esm/tasks/nlp/summarization.js +15 -0
- package/dist/esm/tasks/nlp/tableQuestionAnswering.d.ts +8 -0
- package/dist/esm/tasks/nlp/tableQuestionAnswering.d.ts.map +1 -0
- package/dist/esm/tasks/nlp/tableQuestionAnswering.js +15 -0
- package/dist/esm/tasks/nlp/textClassification.d.ts +8 -0
- package/dist/esm/tasks/nlp/textClassification.d.ts.map +1 -0
- package/dist/esm/tasks/nlp/textClassification.js +15 -0
- package/dist/esm/tasks/nlp/textGeneration.d.ts +8 -0
- package/dist/esm/tasks/nlp/textGeneration.d.ts.map +1 -0
- package/dist/esm/tasks/nlp/textGeneration.js +15 -0
- package/dist/esm/tasks/nlp/textGenerationStream.d.ts +81 -0
- package/dist/esm/tasks/nlp/textGenerationStream.d.ts.map +1 -0
- package/dist/esm/tasks/nlp/textGenerationStream.js +14 -0
- package/dist/esm/tasks/nlp/tokenClassification.d.ts +8 -0
- package/dist/esm/tasks/nlp/tokenClassification.d.ts.map +1 -0
- package/dist/esm/tasks/nlp/tokenClassification.js +15 -0
- package/dist/esm/tasks/nlp/translation.d.ts +8 -0
- package/dist/esm/tasks/nlp/translation.d.ts.map +1 -0
- package/dist/esm/tasks/nlp/translation.js +15 -0
- package/dist/esm/tasks/nlp/zeroShotClassification.d.ts +8 -0
- package/dist/esm/tasks/nlp/zeroShotClassification.d.ts.map +1 -0
- package/dist/esm/tasks/nlp/zeroShotClassification.js +15 -0
- package/dist/esm/tasks/tabular/tabularClassification.d.ts +20 -0
- package/dist/esm/tasks/tabular/tabularClassification.d.ts.map +1 -0
- package/dist/esm/tasks/tabular/tabularClassification.js +17 -0
- package/dist/esm/tasks/tabular/tabularRegression.d.ts +20 -0
- package/dist/esm/tasks/tabular/tabularRegression.d.ts.map +1 -0
- package/dist/esm/tasks/tabular/tabularRegression.js +17 -0
- package/dist/esm/types.d.ts +97 -0
- package/dist/esm/types.d.ts.map +1 -0
- package/dist/esm/types.js +20 -0
- package/dist/esm/utils/base64FromBytes.d.ts +2 -0
- package/dist/esm/utils/base64FromBytes.d.ts.map +1 -0
- package/dist/esm/utils/base64FromBytes.js +12 -0
- package/dist/esm/utils/delay.d.ts +2 -0
- package/dist/esm/utils/delay.d.ts.map +1 -0
- package/dist/esm/utils/delay.js +5 -0
- package/dist/esm/utils/distributive-omit.d.ts +9 -0
- package/dist/esm/utils/distributive-omit.d.ts.map +1 -0
- package/dist/esm/utils/distributive-omit.js +6 -0
- package/dist/esm/utils/isBackend.d.ts +2 -0
- package/dist/esm/utils/isBackend.d.ts.map +1 -0
- package/dist/esm/utils/isBackend.js +3 -0
- package/dist/esm/utils/isFrontend.d.ts +2 -0
- package/dist/esm/utils/isFrontend.d.ts.map +1 -0
- package/dist/esm/utils/isFrontend.js +2 -0
- package/dist/esm/utils/omit.d.ts +5 -0
- package/dist/esm/utils/omit.d.ts.map +1 -0
- package/dist/esm/utils/omit.js +10 -0
- package/dist/esm/utils/pick.d.ts +5 -0
- package/dist/esm/utils/pick.d.ts.map +1 -0
- package/dist/esm/utils/pick.js +10 -0
- package/dist/esm/utils/request.d.ts +28 -0
- package/dist/esm/utils/request.d.ts.map +1 -0
- package/dist/esm/utils/request.js +112 -0
- package/dist/esm/utils/toArray.d.ts +2 -0
- package/dist/esm/utils/toArray.d.ts.map +1 -0
- package/dist/esm/utils/toArray.js +6 -0
- package/dist/esm/utils/typedEntries.d.ts +4 -0
- package/dist/esm/utils/typedEntries.d.ts.map +1 -0
- package/dist/esm/utils/typedEntries.js +3 -0
- package/dist/esm/utils/typedInclude.d.ts +2 -0
- package/dist/esm/utils/typedInclude.d.ts.map +1 -0
- package/dist/esm/utils/typedInclude.js +3 -0
- package/dist/esm/vendor/fetch-event-source/parse.d.ts +69 -0
- package/dist/esm/vendor/fetch-event-source/parse.d.ts.map +1 -0
- package/dist/esm/vendor/fetch-event-source/parse.js +180 -0
- package/dist/esm/vendor/fetch-event-source/parse.spec.d.ts +2 -0
- package/dist/esm/vendor/fetch-event-source/parse.spec.d.ts.map +1 -0
- package/dist/esm/vendor/fetch-event-source/parse.spec.js +335 -0
- package/package.json +26 -12
- package/src/InferenceClient.ts +4 -4
- package/src/index.ts +4 -4
- package/src/lib/getDefaultTask.ts +2 -2
- package/src/lib/getInferenceProviderMapping.ts +5 -5
- package/src/lib/getProviderHelper.ts +19 -19
- package/src/lib/makeRequestOptions.ts +8 -8
- package/src/package.ts +3 -0
- package/src/providers/black-forest-labs.ts +5 -5
- package/src/providers/cerebras.ts +1 -1
- package/src/providers/cohere.ts +1 -1
- package/src/providers/consts.ts +3 -3
- package/src/providers/fal-ai.ts +9 -9
- package/src/providers/featherless-ai.ts +3 -3
- package/src/providers/fireworks-ai.ts +1 -1
- package/src/providers/groq.ts +1 -1
- package/src/providers/hf-inference.ts +11 -11
- package/src/providers/hyperbolic.ts +4 -4
- package/src/providers/nebius.ts +4 -4
- package/src/providers/novita.ts +5 -5
- package/src/providers/nscale.ts +4 -4
- package/src/providers/openai.ts +1 -1
- package/src/providers/ovhcloud.ts +4 -4
- package/src/providers/providerHelper.ts +7 -7
- package/src/providers/replicate.ts +5 -5
- package/src/providers/sambanova.ts +4 -4
- package/src/providers/together.ts +4 -4
- package/src/snippets/getInferenceSnippets.ts +7 -7
- package/src/tasks/audio/audioClassification.ts +6 -6
- package/src/tasks/audio/audioToAudio.ts +6 -6
- package/src/tasks/audio/automaticSpeechRecognition.ts +6 -6
- package/src/tasks/audio/textToSpeech.ts +4 -4
- package/src/tasks/audio/utils.ts +2 -2
- package/src/tasks/custom/request.ts +4 -4
- package/src/tasks/custom/streamingRequest.ts +4 -4
- package/src/tasks/cv/imageClassification.ts +5 -5
- package/src/tasks/cv/imageSegmentation.ts +5 -5
- package/src/tasks/cv/imageToImage.ts +4 -4
- package/src/tasks/cv/imageToText.ts +6 -6
- package/src/tasks/cv/objectDetection.ts +5 -5
- package/src/tasks/cv/textToImage.ts +5 -5
- package/src/tasks/cv/textToVideo.ts +8 -8
- package/src/tasks/cv/utils.ts +2 -2
- package/src/tasks/cv/zeroShotImageClassification.ts +5 -5
- package/src/tasks/index.ts +32 -32
- package/src/tasks/multimodal/documentQuestionAnswering.ts +5 -5
- package/src/tasks/multimodal/visualQuestionAnswering.ts +5 -5
- package/src/tasks/nlp/chatCompletion.ts +4 -4
- package/src/tasks/nlp/chatCompletionStream.ts +4 -4
- package/src/tasks/nlp/featureExtraction.ts +4 -4
- package/src/tasks/nlp/fillMask.ts +4 -4
- package/src/tasks/nlp/questionAnswering.ts +4 -4
- package/src/tasks/nlp/sentenceSimilarity.ts +4 -4
- package/src/tasks/nlp/summarization.ts +4 -4
- package/src/tasks/nlp/tableQuestionAnswering.ts +4 -4
- package/src/tasks/nlp/textClassification.ts +4 -4
- package/src/tasks/nlp/textGeneration.ts +5 -5
- package/src/tasks/nlp/textGenerationStream.ts +4 -4
- package/src/tasks/nlp/tokenClassification.ts +4 -4
- package/src/tasks/nlp/translation.ts +4 -4
- package/src/tasks/nlp/zeroShotClassification.ts +4 -4
- package/src/tasks/tabular/tabularClassification.ts +4 -4
- package/src/tasks/tabular/tabularRegression.ts +4 -4
- package/src/types.ts +1 -1
- package/src/utils/isFrontend.ts +1 -1
- package/src/utils/omit.ts +2 -2
- package/src/utils/request.ts +5 -5
- package/src/vendor/fetch-event-source/parse.spec.ts +1 -1
- package/src/vendor/fetch-event-source/parse.ts +6 -5
- package/dist/index.cjs +0 -2868
- package/dist/index.js +0 -2812
- package/dist/src/InferenceClient.d.ts.map +0 -1
- package/dist/src/index.d.ts.map +0 -1
- package/dist/src/providers/consts.d.ts.map +0 -1
- package/dist/src/providers/fireworks-ai.d.ts.map +0 -1
- package/dist/src/tasks/audio/audioToAudio.d.ts.map +0 -1
- package/dist/src/tasks/audio/automaticSpeechRecognition.d.ts.map +0 -1
- package/dist/src/tasks/audio/textToSpeech.d.ts.map +0 -1
- package/dist/src/tasks/audio/utils.d.ts.map +0 -1
- package/dist/src/tasks/custom/request.d.ts.map +0 -1
- package/dist/src/tasks/custom/streamingRequest.d.ts.map +0 -1
- package/dist/src/tasks/cv/imageClassification.d.ts.map +0 -1
- package/dist/src/tasks/cv/imageSegmentation.d.ts.map +0 -1
- package/dist/src/tasks/cv/imageToImage.d.ts.map +0 -1
- package/dist/src/tasks/cv/imageToText.d.ts.map +0 -1
- package/dist/src/tasks/cv/objectDetection.d.ts.map +0 -1
- package/dist/src/tasks/cv/textToImage.d.ts.map +0 -1
- package/dist/src/tasks/cv/textToVideo.d.ts.map +0 -1
- package/dist/src/tasks/cv/utils.d.ts.map +0 -1
- package/dist/src/tasks/cv/zeroShotImageClassification.d.ts.map +0 -1
- package/dist/src/tasks/index.d.ts +0 -33
- package/dist/src/tasks/index.d.ts.map +0 -1
- package/dist/src/tasks/multimodal/documentQuestionAnswering.d.ts.map +0 -1
- package/dist/src/tasks/multimodal/visualQuestionAnswering.d.ts.map +0 -1
- package/dist/src/tasks/nlp/featureExtraction.d.ts.map +0 -1
- package/dist/src/tasks/nlp/fillMask.d.ts.map +0 -1
- package/dist/src/tasks/nlp/questionAnswering.d.ts.map +0 -1
- package/dist/src/tasks/nlp/sentenceSimilarity.d.ts.map +0 -1
- package/dist/src/tasks/nlp/summarization.d.ts.map +0 -1
- package/dist/src/tasks/nlp/textClassification.d.ts.map +0 -1
- package/dist/src/tasks/nlp/textGeneration.d.ts.map +0 -1
- package/dist/src/tasks/nlp/textGenerationStream.d.ts.map +0 -1
- package/dist/src/tasks/nlp/translation.d.ts.map +0 -1
- package/dist/src/tasks/tabular/tabularClassification.d.ts.map +0 -1
- package/dist/src/tasks/tabular/tabularRegression.d.ts.map +0 -1
- package/dist/src/vendor/fetch-event-source/parse.d.ts.map +0 -1
- package/dist/test/InferenceClient.spec.d.ts +0 -2
- package/dist/test/InferenceClient.spec.d.ts.map +0 -1
- package/dist/test/expect-closeto.d.ts +0 -2
- package/dist/test/expect-closeto.d.ts.map +0 -1
- package/dist/test/test-files.d.ts +0 -2
- package/dist/test/test-files.d.ts.map +0 -1
- /package/dist/{src → commonjs}/config.d.ts +0 -0
- /package/dist/{src → commonjs}/config.d.ts.map +0 -0
- /package/dist/{src → commonjs}/lib/InferenceOutputError.d.ts +0 -0
- /package/dist/{src → commonjs}/lib/InferenceOutputError.d.ts.map +0 -0
- /package/dist/{src → commonjs}/lib/getDefaultTask.d.ts +0 -0
- /package/dist/{src → commonjs}/lib/getDefaultTask.d.ts.map +0 -0
- /package/dist/{src → commonjs}/lib/isUrl.d.ts +0 -0
- /package/dist/{src → commonjs}/lib/isUrl.d.ts.map +0 -0
- /package/dist/{src → commonjs}/snippets/index.d.ts +0 -0
- /package/dist/{src → commonjs}/snippets/index.d.ts.map +0 -0
- /package/dist/{src → commonjs}/snippets/templates.exported.d.ts +0 -0
- /package/dist/{src → commonjs}/snippets/templates.exported.d.ts.map +0 -0
- /package/dist/{src → commonjs}/utils/base64FromBytes.d.ts +0 -0
- /package/dist/{src → commonjs}/utils/base64FromBytes.d.ts.map +0 -0
- /package/dist/{src → commonjs}/utils/delay.d.ts +0 -0
- /package/dist/{src → commonjs}/utils/delay.d.ts.map +0 -0
- /package/dist/{src → commonjs}/utils/distributive-omit.d.ts +0 -0
- /package/dist/{src → commonjs}/utils/distributive-omit.d.ts.map +0 -0
- /package/dist/{src → commonjs}/utils/isBackend.d.ts +0 -0
- /package/dist/{src → commonjs}/utils/isBackend.d.ts.map +0 -0
- /package/dist/{src → commonjs}/utils/isFrontend.d.ts +0 -0
- /package/dist/{src → commonjs}/utils/isFrontend.d.ts.map +0 -0
- /package/dist/{src → commonjs}/utils/omit.d.ts +0 -0
- /package/dist/{src → commonjs}/utils/omit.d.ts.map +0 -0
- /package/dist/{src → commonjs}/utils/pick.d.ts +0 -0
- /package/dist/{src → commonjs}/utils/pick.d.ts.map +0 -0
- /package/dist/{src → commonjs}/utils/toArray.d.ts +0 -0
- /package/dist/{src → commonjs}/utils/toArray.d.ts.map +0 -0
- /package/dist/{src → commonjs}/utils/typedEntries.d.ts +0 -0
- /package/dist/{src → commonjs}/utils/typedEntries.d.ts.map +0 -0
- /package/dist/{src → commonjs}/utils/typedInclude.d.ts +0 -0
- /package/dist/{src → commonjs}/utils/typedInclude.d.ts.map +0 -0
- /package/dist/{src → commonjs}/vendor/fetch-event-source/parse.d.ts +0 -0
- /package/dist/{src → commonjs}/vendor/fetch-event-source/parse.spec.d.ts +0 -0
- /package/dist/{src → commonjs}/vendor/fetch-event-source/parse.spec.d.ts.map +0 -0
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { InferenceTask, Options, RequestArgs } from "../../types.js";
|
|
2
|
+
/**
|
|
3
|
+
* Primitive to make custom calls to the inference provider
|
|
4
|
+
* @deprecated Use specific task functions instead. This function will be removed in a future version.
|
|
5
|
+
*/
|
|
6
|
+
export declare function request<T>(args: RequestArgs, options?: Options & {
|
|
7
|
+
/** In most cases (unless we pass a endpointUrl) we know the task */
|
|
8
|
+
task?: InferenceTask;
|
|
9
|
+
}): Promise<T>;
|
|
10
|
+
//# sourceMappingURL=request.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"request.d.ts","sourceRoot":"","sources":["../../../../src/tasks/custom/request.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,aAAa,EAAE,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAG1E;;;GAGG;AACH,wBAAsB,OAAO,CAAC,CAAC,EAC9B,IAAI,EAAE,WAAW,EACjB,OAAO,CAAC,EAAE,OAAO,GAAG;IACnB,oEAAoE;IACpE,IAAI,CAAC,EAAE,aAAa,CAAC;CACrB,GACC,OAAO,CAAC,CAAC,CAAC,CAQZ"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { resolveProvider } from "../../lib/getInferenceProviderMapping.js";
|
|
2
|
+
import { getProviderHelper } from "../../lib/getProviderHelper.js";
|
|
3
|
+
import { innerRequest } from "../../utils/request.js";
|
|
4
|
+
/**
|
|
5
|
+
* Primitive to make custom calls to the inference provider
|
|
6
|
+
* @deprecated Use specific task functions instead. This function will be removed in a future version.
|
|
7
|
+
*/
|
|
8
|
+
export async function request(args, options) {
|
|
9
|
+
console.warn("The request method is deprecated and will be removed in a future version of huggingface.js. Use specific task functions instead.");
|
|
10
|
+
const provider = await resolveProvider(args.provider, args.model, args.endpointUrl);
|
|
11
|
+
const providerHelper = getProviderHelper(provider, options?.task);
|
|
12
|
+
const result = await innerRequest(args, providerHelper, options);
|
|
13
|
+
return result.data;
|
|
14
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { InferenceTask, Options, RequestArgs } from "../../types.js";
|
|
2
|
+
/**
|
|
3
|
+
* Primitive to make custom inference calls that expect server-sent events, and returns the response through a generator
|
|
4
|
+
* @deprecated Use specific task functions instead. This function will be removed in a future version.
|
|
5
|
+
*/
|
|
6
|
+
export declare function streamingRequest<T>(args: RequestArgs, options?: Options & {
|
|
7
|
+
/** In most cases (unless we pass a endpointUrl) we know the task */
|
|
8
|
+
task?: InferenceTask;
|
|
9
|
+
}): AsyncGenerator<T>;
|
|
10
|
+
//# sourceMappingURL=streamingRequest.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"streamingRequest.d.ts","sourceRoot":"","sources":["../../../../src/tasks/custom/streamingRequest.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,aAAa,EAAE,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAG1E;;;GAGG;AACH,wBAAuB,gBAAgB,CAAC,CAAC,EACxC,IAAI,EAAE,WAAW,EACjB,OAAO,CAAC,EAAE,OAAO,GAAG;IACnB,oEAAoE;IACpE,IAAI,CAAC,EAAE,aAAa,CAAC;CACrB,GACC,cAAc,CAAC,CAAC,CAAC,CAOnB"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { resolveProvider } from "../../lib/getInferenceProviderMapping.js";
|
|
2
|
+
import { getProviderHelper } from "../../lib/getProviderHelper.js";
|
|
3
|
+
import { innerStreamingRequest } from "../../utils/request.js";
|
|
4
|
+
/**
|
|
5
|
+
* Primitive to make custom inference calls that expect server-sent events, and returns the response through a generator
|
|
6
|
+
* @deprecated Use specific task functions instead. This function will be removed in a future version.
|
|
7
|
+
*/
|
|
8
|
+
export async function* streamingRequest(args, options) {
|
|
9
|
+
console.warn("The streamingRequest method is deprecated and will be removed in a future version of huggingface.js. Use specific task functions instead.");
|
|
10
|
+
const provider = await resolveProvider(args.provider, args.model, args.endpointUrl);
|
|
11
|
+
const providerHelper = getProviderHelper(provider, options?.task);
|
|
12
|
+
yield* innerStreamingRequest(args, providerHelper, options);
|
|
13
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { ImageClassificationInput, ImageClassificationOutput } from "@huggingface/tasks";
|
|
2
|
+
import type { BaseArgs, Options } from "../../types.js";
|
|
3
|
+
import { type LegacyImageInput } from "./utils.js";
|
|
4
|
+
export type ImageClassificationArgs = BaseArgs & (ImageClassificationInput | LegacyImageInput);
|
|
5
|
+
/**
|
|
6
|
+
* This task reads some image input and outputs the likelihood of classes.
|
|
7
|
+
* Recommended model: google/vit-base-patch16-224
|
|
8
|
+
*/
|
|
9
|
+
export declare function imageClassification(args: ImageClassificationArgs, options?: Options): Promise<ImageClassificationOutput>;
|
|
10
|
+
//# sourceMappingURL=imageClassification.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"imageClassification.d.ts","sourceRoot":"","sources":["../../../../src/tasks/cv/imageClassification.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,wBAAwB,EAAE,yBAAyB,EAAE,MAAM,oBAAoB,CAAC;AAG9F,OAAO,KAAK,EAAE,QAAQ,EAAE,OAAO,EAAE,MAAM,gBAAgB,CAAC;AAExD,OAAO,EAAkB,KAAK,gBAAgB,EAAE,MAAM,YAAY,CAAC;AAEnE,MAAM,MAAM,uBAAuB,GAAG,QAAQ,GAAG,CAAC,wBAAwB,GAAG,gBAAgB,CAAC,CAAC;AAE/F;;;GAGG;AACH,wBAAsB,mBAAmB,CACxC,IAAI,EAAE,uBAAuB,EAC7B,OAAO,CAAC,EAAE,OAAO,GACf,OAAO,CAAC,yBAAyB,CAAC,CASpC"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { resolveProvider } from "../../lib/getInferenceProviderMapping.js";
|
|
2
|
+
import { getProviderHelper } from "../../lib/getProviderHelper.js";
|
|
3
|
+
import { innerRequest } from "../../utils/request.js";
|
|
4
|
+
import { preparePayload } from "./utils.js";
|
|
5
|
+
/**
|
|
6
|
+
* This task reads some image input and outputs the likelihood of classes.
|
|
7
|
+
* Recommended model: google/vit-base-patch16-224
|
|
8
|
+
*/
|
|
9
|
+
export async function imageClassification(args, options) {
|
|
10
|
+
const provider = await resolveProvider(args.provider, args.model, args.endpointUrl);
|
|
11
|
+
const providerHelper = getProviderHelper(provider, "image-classification");
|
|
12
|
+
const payload = preparePayload(args);
|
|
13
|
+
const { data: res } = await innerRequest(payload, providerHelper, {
|
|
14
|
+
...options,
|
|
15
|
+
task: "image-classification",
|
|
16
|
+
});
|
|
17
|
+
return providerHelper.getResponse(res);
|
|
18
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { ImageSegmentationInput, ImageSegmentationOutput } from "@huggingface/tasks";
|
|
2
|
+
import type { BaseArgs, Options } from "../../types.js";
|
|
3
|
+
import { type LegacyImageInput } from "./utils.js";
|
|
4
|
+
export type ImageSegmentationArgs = BaseArgs & (ImageSegmentationInput | LegacyImageInput);
|
|
5
|
+
/**
|
|
6
|
+
* This task reads some image input and outputs the likelihood of classes & bounding boxes of detected objects.
|
|
7
|
+
* Recommended model: facebook/detr-resnet-50-panoptic
|
|
8
|
+
*/
|
|
9
|
+
export declare function imageSegmentation(args: ImageSegmentationArgs, options?: Options): Promise<ImageSegmentationOutput>;
|
|
10
|
+
//# sourceMappingURL=imageSegmentation.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"imageSegmentation.d.ts","sourceRoot":"","sources":["../../../../src/tasks/cv/imageSegmentation.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,sBAAsB,EAAE,uBAAuB,EAAE,MAAM,oBAAoB,CAAC;AAG1F,OAAO,KAAK,EAAE,QAAQ,EAAE,OAAO,EAAE,MAAM,gBAAgB,CAAC;AAExD,OAAO,EAAkB,KAAK,gBAAgB,EAAE,MAAM,YAAY,CAAC;AAEnE,MAAM,MAAM,qBAAqB,GAAG,QAAQ,GAAG,CAAC,sBAAsB,GAAG,gBAAgB,CAAC,CAAC;AAE3F;;;GAGG;AACH,wBAAsB,iBAAiB,CACtC,IAAI,EAAE,qBAAqB,EAC3B,OAAO,CAAC,EAAE,OAAO,GACf,OAAO,CAAC,uBAAuB,CAAC,CASlC"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { resolveProvider } from "../../lib/getInferenceProviderMapping.js";
|
|
2
|
+
import { getProviderHelper } from "../../lib/getProviderHelper.js";
|
|
3
|
+
import { innerRequest } from "../../utils/request.js";
|
|
4
|
+
import { preparePayload } from "./utils.js";
|
|
5
|
+
/**
|
|
6
|
+
* This task reads some image input and outputs the likelihood of classes & bounding boxes of detected objects.
|
|
7
|
+
* Recommended model: facebook/detr-resnet-50-panoptic
|
|
8
|
+
*/
|
|
9
|
+
export async function imageSegmentation(args, options) {
|
|
10
|
+
const provider = await resolveProvider(args.provider, args.model, args.endpointUrl);
|
|
11
|
+
const providerHelper = getProviderHelper(provider, "image-segmentation");
|
|
12
|
+
const payload = preparePayload(args);
|
|
13
|
+
const { data: res } = await innerRequest(payload, providerHelper, {
|
|
14
|
+
...options,
|
|
15
|
+
task: "image-segmentation",
|
|
16
|
+
});
|
|
17
|
+
return providerHelper.getResponse(res);
|
|
18
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { ImageToImageInput } from "@huggingface/tasks";
|
|
2
|
+
import type { BaseArgs, Options } from "../../types.js";
|
|
3
|
+
export type ImageToImageArgs = BaseArgs & ImageToImageInput;
|
|
4
|
+
/**
|
|
5
|
+
* This task reads some text input and outputs an image.
|
|
6
|
+
* Recommended model: lllyasviel/sd-controlnet-depth
|
|
7
|
+
*/
|
|
8
|
+
export declare function imageToImage(args: ImageToImageArgs, options?: Options): Promise<Blob>;
|
|
9
|
+
//# sourceMappingURL=imageToImage.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"imageToImage.d.ts","sourceRoot":"","sources":["../../../../src/tasks/cv/imageToImage.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,oBAAoB,CAAC;AAG5D,OAAO,KAAK,EAAE,QAAQ,EAAE,OAAO,EAAE,MAAM,gBAAgB,CAAC;AAGxD,MAAM,MAAM,gBAAgB,GAAG,QAAQ,GAAG,iBAAiB,CAAC;AAE5D;;;GAGG;AACH,wBAAsB,YAAY,CAAC,IAAI,EAAE,gBAAgB,EAAE,OAAO,CAAC,EAAE,OAAO,GAAG,OAAO,CAAC,IAAI,CAAC,CAS3F"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { resolveProvider } from "../../lib/getInferenceProviderMapping.js";
|
|
2
|
+
import { getProviderHelper } from "../../lib/getProviderHelper.js";
|
|
3
|
+
import { innerRequest } from "../../utils/request.js";
|
|
4
|
+
/**
|
|
5
|
+
* This task reads some text input and outputs an image.
|
|
6
|
+
* Recommended model: lllyasviel/sd-controlnet-depth
|
|
7
|
+
*/
|
|
8
|
+
export async function imageToImage(args, options) {
|
|
9
|
+
const provider = await resolveProvider(args.provider, args.model, args.endpointUrl);
|
|
10
|
+
const providerHelper = getProviderHelper(provider, "image-to-image");
|
|
11
|
+
const payload = await providerHelper.preparePayloadAsync(args);
|
|
12
|
+
const { data: res } = await innerRequest(payload, providerHelper, {
|
|
13
|
+
...options,
|
|
14
|
+
task: "image-to-image",
|
|
15
|
+
});
|
|
16
|
+
return providerHelper.getResponse(res);
|
|
17
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { ImageToTextInput, ImageToTextOutput } from "@huggingface/tasks";
|
|
2
|
+
import type { BaseArgs, Options } from "../../types.js";
|
|
3
|
+
import type { LegacyImageInput } from "./utils.js";
|
|
4
|
+
export type ImageToTextArgs = BaseArgs & (ImageToTextInput | LegacyImageInput);
|
|
5
|
+
/**
|
|
6
|
+
* This task reads some image input and outputs the text caption.
|
|
7
|
+
*/
|
|
8
|
+
export declare function imageToText(args: ImageToTextArgs, options?: Options): Promise<ImageToTextOutput>;
|
|
9
|
+
//# sourceMappingURL=imageToText.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"imageToText.d.ts","sourceRoot":"","sources":["../../../../src/tasks/cv/imageToText.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,iBAAiB,EAAE,MAAM,oBAAoB,CAAC;AAG9E,OAAO,KAAK,EAAE,QAAQ,EAAE,OAAO,EAAE,MAAM,gBAAgB,CAAC;AAExD,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,YAAY,CAAC;AAGnD,MAAM,MAAM,eAAe,GAAG,QAAQ,GAAG,CAAC,gBAAgB,GAAG,gBAAgB,CAAC,CAAC;AAC/E;;GAEG;AACH,wBAAsB,WAAW,CAAC,IAAI,EAAE,eAAe,EAAE,OAAO,CAAC,EAAE,OAAO,GAAG,OAAO,CAAC,iBAAiB,CAAC,CAUtG"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { resolveProvider } from "../../lib/getInferenceProviderMapping.js";
|
|
2
|
+
import { getProviderHelper } from "../../lib/getProviderHelper.js";
|
|
3
|
+
import { innerRequest } from "../../utils/request.js";
|
|
4
|
+
import { preparePayload } from "./utils.js";
|
|
5
|
+
/**
|
|
6
|
+
* This task reads some image input and outputs the text caption.
|
|
7
|
+
*/
|
|
8
|
+
export async function imageToText(args, options) {
|
|
9
|
+
const provider = await resolveProvider(args.provider, args.model, args.endpointUrl);
|
|
10
|
+
const providerHelper = getProviderHelper(provider, "image-to-text");
|
|
11
|
+
const payload = preparePayload(args);
|
|
12
|
+
const { data: res } = await innerRequest(payload, providerHelper, {
|
|
13
|
+
...options,
|
|
14
|
+
task: "image-to-text",
|
|
15
|
+
});
|
|
16
|
+
return providerHelper.getResponse(res[0]);
|
|
17
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { ObjectDetectionInput, ObjectDetectionOutput } from "@huggingface/tasks";
|
|
2
|
+
import type { BaseArgs, Options } from "../../types.js";
|
|
3
|
+
import { type LegacyImageInput } from "./utils.js";
|
|
4
|
+
export type ObjectDetectionArgs = BaseArgs & (ObjectDetectionInput | LegacyImageInput);
|
|
5
|
+
/**
|
|
6
|
+
* This task reads some image input and outputs the likelihood of classes & bounding boxes of detected objects.
|
|
7
|
+
* Recommended model: facebook/detr-resnet-50
|
|
8
|
+
*/
|
|
9
|
+
export declare function objectDetection(args: ObjectDetectionArgs, options?: Options): Promise<ObjectDetectionOutput>;
|
|
10
|
+
//# sourceMappingURL=objectDetection.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"objectDetection.d.ts","sourceRoot":"","sources":["../../../../src/tasks/cv/objectDetection.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,oBAAoB,EAAE,qBAAqB,EAAE,MAAM,oBAAoB,CAAC;AAGtF,OAAO,KAAK,EAAE,QAAQ,EAAE,OAAO,EAAE,MAAM,gBAAgB,CAAC;AAExD,OAAO,EAAkB,KAAK,gBAAgB,EAAE,MAAM,YAAY,CAAC;AAEnE,MAAM,MAAM,mBAAmB,GAAG,QAAQ,GAAG,CAAC,oBAAoB,GAAG,gBAAgB,CAAC,CAAC;AAEvF;;;GAGG;AACH,wBAAsB,eAAe,CAAC,IAAI,EAAE,mBAAmB,EAAE,OAAO,CAAC,EAAE,OAAO,GAAG,OAAO,CAAC,qBAAqB,CAAC,CASlH"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { resolveProvider } from "../../lib/getInferenceProviderMapping.js";
|
|
2
|
+
import { getProviderHelper } from "../../lib/getProviderHelper.js";
|
|
3
|
+
import { innerRequest } from "../../utils/request.js";
|
|
4
|
+
import { preparePayload } from "./utils.js";
|
|
5
|
+
/**
|
|
6
|
+
* This task reads some image input and outputs the likelihood of classes & bounding boxes of detected objects.
|
|
7
|
+
* Recommended model: facebook/detr-resnet-50
|
|
8
|
+
*/
|
|
9
|
+
export async function objectDetection(args, options) {
|
|
10
|
+
const provider = await resolveProvider(args.provider, args.model, args.endpointUrl);
|
|
11
|
+
const providerHelper = getProviderHelper(provider, "object-detection");
|
|
12
|
+
const payload = preparePayload(args);
|
|
13
|
+
const { data: res } = await innerRequest(payload, providerHelper, {
|
|
14
|
+
...options,
|
|
15
|
+
task: "object-detection",
|
|
16
|
+
});
|
|
17
|
+
return providerHelper.getResponse(res);
|
|
18
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import type { TextToImageInput } from "@huggingface/tasks";
|
|
2
|
+
import type { BaseArgs, Options } from "../../types.js";
|
|
3
|
+
export type TextToImageArgs = BaseArgs & TextToImageInput;
|
|
4
|
+
interface TextToImageOptions extends Options {
|
|
5
|
+
outputType?: "url" | "blob";
|
|
6
|
+
}
|
|
7
|
+
/**
|
|
8
|
+
* This task reads some text input and outputs an image.
|
|
9
|
+
* Recommended model: stabilityai/stable-diffusion-2
|
|
10
|
+
*/
|
|
11
|
+
export declare function textToImage(args: TextToImageArgs, options?: TextToImageOptions & {
|
|
12
|
+
outputType: "url";
|
|
13
|
+
}): Promise<string>;
|
|
14
|
+
export declare function textToImage(args: TextToImageArgs, options?: TextToImageOptions & {
|
|
15
|
+
outputType?: undefined | "blob";
|
|
16
|
+
}): Promise<Blob>;
|
|
17
|
+
export {};
|
|
18
|
+
//# sourceMappingURL=textToImage.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"textToImage.d.ts","sourceRoot":"","sources":["../../../../src/tasks/cv/textToImage.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AAI3D,OAAO,KAAK,EAAE,QAAQ,EAAE,OAAO,EAAE,MAAM,gBAAgB,CAAC;AAGxD,MAAM,MAAM,eAAe,GAAG,QAAQ,GAAG,gBAAgB,CAAC;AAE1D,UAAU,kBAAmB,SAAQ,OAAO;IAC3C,UAAU,CAAC,EAAE,KAAK,GAAG,MAAM,CAAC;CAC5B;AAED;;;GAGG;AACH,wBAAsB,WAAW,CAChC,IAAI,EAAE,eAAe,EACrB,OAAO,CAAC,EAAE,kBAAkB,GAAG;IAAE,UAAU,EAAE,KAAK,CAAA;CAAE,GAClD,OAAO,CAAC,MAAM,CAAC,CAAC;AACnB,wBAAsB,WAAW,CAChC,IAAI,EAAE,eAAe,EACrB,OAAO,CAAC,EAAE,kBAAkB,GAAG;IAAE,UAAU,CAAC,EAAE,SAAS,GAAG,MAAM,CAAA;CAAE,GAChE,OAAO,CAAC,IAAI,CAAC,CAAC"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { resolveProvider } from "../../lib/getInferenceProviderMapping.js";
|
|
2
|
+
import { getProviderHelper } from "../../lib/getProviderHelper.js";
|
|
3
|
+
import { makeRequestOptions } from "../../lib/makeRequestOptions.js";
|
|
4
|
+
import { innerRequest } from "../../utils/request.js";
|
|
5
|
+
export async function textToImage(args, options) {
|
|
6
|
+
const provider = await resolveProvider(args.provider, args.model, args.endpointUrl);
|
|
7
|
+
const providerHelper = getProviderHelper(provider, "text-to-image");
|
|
8
|
+
const { data: res } = await innerRequest(args, providerHelper, {
|
|
9
|
+
...options,
|
|
10
|
+
task: "text-to-image",
|
|
11
|
+
});
|
|
12
|
+
const { url, info } = await makeRequestOptions(args, providerHelper, { ...options, task: "text-to-image" });
|
|
13
|
+
return providerHelper.getResponse(res, url, info.headers, options?.outputType);
|
|
14
|
+
}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import type { TextToVideoInput } from "@huggingface/tasks";
|
|
2
|
+
import type { BaseArgs, Options } from "../../types.js";
|
|
3
|
+
export type TextToVideoArgs = BaseArgs & TextToVideoInput;
|
|
4
|
+
export type TextToVideoOutput = Blob;
|
|
5
|
+
export declare function textToVideo(args: TextToVideoArgs, options?: Options): Promise<TextToVideoOutput>;
|
|
6
|
+
//# sourceMappingURL=textToVideo.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"textToVideo.d.ts","sourceRoot":"","sources":["../../../../src/tasks/cv/textToVideo.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AAO3D,OAAO,KAAK,EAAE,QAAQ,EAAE,OAAO,EAAE,MAAM,gBAAgB,CAAC;AAGxD,MAAM,MAAM,eAAe,GAAG,QAAQ,GAAG,gBAAgB,CAAC;AAE1D,MAAM,MAAM,iBAAiB,GAAG,IAAI,CAAC;AAErC,wBAAsB,WAAW,CAAC,IAAI,EAAE,eAAe,EAAE,OAAO,CAAC,EAAE,OAAO,GAAG,OAAO,CAAC,iBAAiB,CAAC,CAatG"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { resolveProvider } from "../../lib/getInferenceProviderMapping.js";
|
|
2
|
+
import { getProviderHelper } from "../../lib/getProviderHelper.js";
|
|
3
|
+
import { makeRequestOptions } from "../../lib/makeRequestOptions.js";
|
|
4
|
+
import { innerRequest } from "../../utils/request.js";
|
|
5
|
+
export async function textToVideo(args, options) {
|
|
6
|
+
const provider = await resolveProvider(args.provider, args.model, args.endpointUrl);
|
|
7
|
+
const providerHelper = getProviderHelper(provider, "text-to-video");
|
|
8
|
+
const { data: response } = await innerRequest(args, providerHelper, {
|
|
9
|
+
...options,
|
|
10
|
+
task: "text-to-video",
|
|
11
|
+
});
|
|
12
|
+
const { url, info } = await makeRequestOptions(args, providerHelper, { ...options, task: "text-to-video" });
|
|
13
|
+
return providerHelper.getResponse(response, url, info.headers);
|
|
14
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { BaseArgs, RequestArgs } from "../../types.js";
|
|
2
|
+
/**
|
|
3
|
+
* @deprecated
|
|
4
|
+
*/
|
|
5
|
+
export interface LegacyImageInput {
|
|
6
|
+
data: Blob | ArrayBuffer;
|
|
7
|
+
}
|
|
8
|
+
export declare function preparePayload(args: BaseArgs & ({
|
|
9
|
+
inputs: Blob;
|
|
10
|
+
} | LegacyImageInput)): RequestArgs;
|
|
11
|
+
//# sourceMappingURL=utils.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../../src/tasks/cv/utils.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAG5D;;GAEG;AACH,MAAM,WAAW,gBAAgB;IAChC,IAAI,EAAE,IAAI,GAAG,WAAW,CAAC;CACzB;AAED,wBAAgB,cAAc,CAAC,IAAI,EAAE,QAAQ,GAAG,CAAC;IAAE,MAAM,EAAE,IAAI,CAAA;CAAE,GAAG,gBAAgB,CAAC,GAAG,WAAW,CAElG"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import type { ZeroShotImageClassificationInput, ZeroShotImageClassificationOutput } from "@huggingface/tasks";
|
|
2
|
+
import type { BaseArgs, Options } from "../../types.js";
|
|
3
|
+
/**
|
|
4
|
+
* @deprecated
|
|
5
|
+
*/
|
|
6
|
+
interface LegacyZeroShotImageClassificationInput {
|
|
7
|
+
inputs: {
|
|
8
|
+
image: Blob | ArrayBuffer;
|
|
9
|
+
};
|
|
10
|
+
}
|
|
11
|
+
export type ZeroShotImageClassificationArgs = BaseArgs & (ZeroShotImageClassificationInput | LegacyZeroShotImageClassificationInput);
|
|
12
|
+
/**
|
|
13
|
+
* Classify an image to specified classes.
|
|
14
|
+
* Recommended model: openai/clip-vit-large-patch14-336
|
|
15
|
+
*/
|
|
16
|
+
export declare function zeroShotImageClassification(args: ZeroShotImageClassificationArgs, options?: Options): Promise<ZeroShotImageClassificationOutput>;
|
|
17
|
+
export {};
|
|
18
|
+
//# sourceMappingURL=zeroShotImageClassification.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"zeroShotImageClassification.d.ts","sourceRoot":"","sources":["../../../../src/tasks/cv/zeroShotImageClassification.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gCAAgC,EAAE,iCAAiC,EAAE,MAAM,oBAAoB,CAAC;AAG9G,OAAO,KAAK,EAAE,QAAQ,EAAE,OAAO,EAAe,MAAM,gBAAgB,CAAC;AAIrE;;GAEG;AACH,UAAU,sCAAsC;IAC/C,MAAM,EAAE;QAAE,KAAK,EAAE,IAAI,GAAG,WAAW,CAAA;KAAE,CAAC;CACtC;AAED,MAAM,MAAM,+BAA+B,GAAG,QAAQ,GACrD,CAAC,gCAAgC,GAAG,sCAAsC,CAAC,CAAC;AAwB7E;;;GAGG;AACH,wBAAsB,2BAA2B,CAChD,IAAI,EAAE,+BAA+B,EACrC,OAAO,CAAC,EAAE,OAAO,GACf,OAAO,CAAC,iCAAiC,CAAC,CAS5C"}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { resolveProvider } from "../../lib/getInferenceProviderMapping.js";
|
|
2
|
+
import { getProviderHelper } from "../../lib/getProviderHelper.js";
|
|
3
|
+
import { base64FromBytes } from "../../utils/base64FromBytes.js";
|
|
4
|
+
import { innerRequest } from "../../utils/request.js";
|
|
5
|
+
async function preparePayload(args) {
|
|
6
|
+
if (args.inputs instanceof Blob) {
|
|
7
|
+
return {
|
|
8
|
+
...args,
|
|
9
|
+
inputs: {
|
|
10
|
+
image: base64FromBytes(new Uint8Array(await args.inputs.arrayBuffer())),
|
|
11
|
+
},
|
|
12
|
+
};
|
|
13
|
+
}
|
|
14
|
+
else {
|
|
15
|
+
return {
|
|
16
|
+
...args,
|
|
17
|
+
inputs: {
|
|
18
|
+
image: base64FromBytes(new Uint8Array(args.inputs.image instanceof ArrayBuffer ? args.inputs.image : await args.inputs.image.arrayBuffer())),
|
|
19
|
+
},
|
|
20
|
+
};
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* Classify an image to specified classes.
|
|
25
|
+
* Recommended model: openai/clip-vit-large-patch14-336
|
|
26
|
+
*/
|
|
27
|
+
export async function zeroShotImageClassification(args, options) {
|
|
28
|
+
const provider = await resolveProvider(args.provider, args.model, args.endpointUrl);
|
|
29
|
+
const providerHelper = getProviderHelper(provider, "zero-shot-image-classification");
|
|
30
|
+
const payload = await preparePayload(args);
|
|
31
|
+
const { data: res } = await innerRequest(payload, providerHelper, {
|
|
32
|
+
...options,
|
|
33
|
+
task: "zero-shot-image-classification",
|
|
34
|
+
});
|
|
35
|
+
return providerHelper.getResponse(res);
|
|
36
|
+
}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
export * from "./custom/request.js";
|
|
2
|
+
export * from "./custom/streamingRequest.js";
|
|
3
|
+
export * from "./audio/audioClassification.js";
|
|
4
|
+
export * from "./audio/audioToAudio.js";
|
|
5
|
+
export * from "./audio/automaticSpeechRecognition.js";
|
|
6
|
+
export * from "./audio/textToSpeech.js";
|
|
7
|
+
export * from "./cv/imageClassification.js";
|
|
8
|
+
export * from "./cv/imageSegmentation.js";
|
|
9
|
+
export * from "./cv/imageToImage.js";
|
|
10
|
+
export * from "./cv/imageToText.js";
|
|
11
|
+
export * from "./cv/objectDetection.js";
|
|
12
|
+
export * from "./cv/textToImage.js";
|
|
13
|
+
export * from "./cv/textToVideo.js";
|
|
14
|
+
export * from "./cv/zeroShotImageClassification.js";
|
|
15
|
+
export * from "./nlp/chatCompletion.js";
|
|
16
|
+
export * from "./nlp/chatCompletionStream.js";
|
|
17
|
+
export * from "./nlp/featureExtraction.js";
|
|
18
|
+
export * from "./nlp/fillMask.js";
|
|
19
|
+
export * from "./nlp/questionAnswering.js";
|
|
20
|
+
export * from "./nlp/sentenceSimilarity.js";
|
|
21
|
+
export * from "./nlp/summarization.js";
|
|
22
|
+
export * from "./nlp/tableQuestionAnswering.js";
|
|
23
|
+
export * from "./nlp/textClassification.js";
|
|
24
|
+
export * from "./nlp/textGeneration.js";
|
|
25
|
+
export * from "./nlp/textGenerationStream.js";
|
|
26
|
+
export * from "./nlp/tokenClassification.js";
|
|
27
|
+
export * from "./nlp/translation.js";
|
|
28
|
+
export * from "./nlp/zeroShotClassification.js";
|
|
29
|
+
export * from "./multimodal/documentQuestionAnswering.js";
|
|
30
|
+
export * from "./multimodal/visualQuestionAnswering.js";
|
|
31
|
+
export * from "./tabular/tabularClassification.js";
|
|
32
|
+
export * from "./tabular/tabularRegression.js";
|
|
33
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/tasks/index.ts"],"names":[],"mappings":"AACA,cAAc,qBAAqB,CAAC;AACpC,cAAc,8BAA8B,CAAC;AAG7C,cAAc,gCAAgC,CAAC;AAC/C,cAAc,yBAAyB,CAAC;AACxC,cAAc,uCAAuC,CAAC;AACtD,cAAc,yBAAyB,CAAC;AAGxC,cAAc,6BAA6B,CAAC;AAC5C,cAAc,2BAA2B,CAAC;AAC1C,cAAc,sBAAsB,CAAC;AACrC,cAAc,qBAAqB,CAAC;AACpC,cAAc,yBAAyB,CAAC;AACxC,cAAc,qBAAqB,CAAC;AACpC,cAAc,qBAAqB,CAAC;AACpC,cAAc,qCAAqC,CAAC;AAGpD,cAAc,yBAAyB,CAAC;AACxC,cAAc,+BAA+B,CAAC;AAC9C,cAAc,4BAA4B,CAAC;AAC3C,cAAc,mBAAmB,CAAC;AAClC,cAAc,4BAA4B,CAAC;AAC3C,cAAc,6BAA6B,CAAC;AAC5C,cAAc,wBAAwB,CAAC;AACvC,cAAc,iCAAiC,CAAC;AAChD,cAAc,6BAA6B,CAAC;AAC5C,cAAc,yBAAyB,CAAC;AACxC,cAAc,+BAA+B,CAAC;AAC9C,cAAc,8BAA8B,CAAC;AAC7C,cAAc,sBAAsB,CAAC;AACrC,cAAc,iCAAiC,CAAC;AAGhD,cAAc,2CAA2C,CAAC;AAC1D,cAAc,yCAAyC,CAAC;AAGxD,cAAc,oCAAoC,CAAC;AACnD,cAAc,gCAAgC,CAAC"}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
// Custom tasks with arbitrary inputs and outputs
|
|
2
|
+
export * from "./custom/request.js";
|
|
3
|
+
export * from "./custom/streamingRequest.js";
|
|
4
|
+
// Audio tasks
|
|
5
|
+
export * from "./audio/audioClassification.js";
|
|
6
|
+
export * from "./audio/audioToAudio.js";
|
|
7
|
+
export * from "./audio/automaticSpeechRecognition.js";
|
|
8
|
+
export * from "./audio/textToSpeech.js";
|
|
9
|
+
// Computer Vision tasks
|
|
10
|
+
export * from "./cv/imageClassification.js";
|
|
11
|
+
export * from "./cv/imageSegmentation.js";
|
|
12
|
+
export * from "./cv/imageToImage.js";
|
|
13
|
+
export * from "./cv/imageToText.js";
|
|
14
|
+
export * from "./cv/objectDetection.js";
|
|
15
|
+
export * from "./cv/textToImage.js";
|
|
16
|
+
export * from "./cv/textToVideo.js";
|
|
17
|
+
export * from "./cv/zeroShotImageClassification.js";
|
|
18
|
+
// Natural Language Processing tasks
|
|
19
|
+
export * from "./nlp/chatCompletion.js";
|
|
20
|
+
export * from "./nlp/chatCompletionStream.js";
|
|
21
|
+
export * from "./nlp/featureExtraction.js";
|
|
22
|
+
export * from "./nlp/fillMask.js";
|
|
23
|
+
export * from "./nlp/questionAnswering.js";
|
|
24
|
+
export * from "./nlp/sentenceSimilarity.js";
|
|
25
|
+
export * from "./nlp/summarization.js";
|
|
26
|
+
export * from "./nlp/tableQuestionAnswering.js";
|
|
27
|
+
export * from "./nlp/textClassification.js";
|
|
28
|
+
export * from "./nlp/textGeneration.js";
|
|
29
|
+
export * from "./nlp/textGenerationStream.js";
|
|
30
|
+
export * from "./nlp/tokenClassification.js";
|
|
31
|
+
export * from "./nlp/translation.js";
|
|
32
|
+
export * from "./nlp/zeroShotClassification.js";
|
|
33
|
+
// Multimodal tasks
|
|
34
|
+
export * from "./multimodal/documentQuestionAnswering.js";
|
|
35
|
+
export * from "./multimodal/visualQuestionAnswering.js";
|
|
36
|
+
// Tabular tasks
|
|
37
|
+
export * from "./tabular/tabularClassification.js";
|
|
38
|
+
export * from "./tabular/tabularRegression.js";
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { DocumentQuestionAnsweringInput, DocumentQuestionAnsweringInputData, DocumentQuestionAnsweringOutput } from "@huggingface/tasks";
|
|
2
|
+
import type { BaseArgs, Options } from "../../types.js";
|
|
3
|
+
export type DocumentQuestionAnsweringArgs = BaseArgs & DocumentQuestionAnsweringInput & {
|
|
4
|
+
inputs: DocumentQuestionAnsweringInputData & {
|
|
5
|
+
image: Blob;
|
|
6
|
+
};
|
|
7
|
+
};
|
|
8
|
+
/**
|
|
9
|
+
* Answers a question on a document image. Recommended model: impira/layoutlm-document-qa.
|
|
10
|
+
*/
|
|
11
|
+
export declare function documentQuestionAnswering(args: DocumentQuestionAnsweringArgs, options?: Options): Promise<DocumentQuestionAnsweringOutput[number]>;
|
|
12
|
+
//# sourceMappingURL=documentQuestionAnswering.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"documentQuestionAnswering.d.ts","sourceRoot":"","sources":["../../../../src/tasks/multimodal/documentQuestionAnswering.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACX,8BAA8B,EAC9B,kCAAkC,EAClC,+BAA+B,EAC/B,MAAM,oBAAoB,CAAC;AAG5B,OAAO,KAAK,EAAE,QAAQ,EAAE,OAAO,EAAe,MAAM,gBAAgB,CAAC;AAKrE,MAAM,MAAM,6BAA6B,GAAG,QAAQ,GACnD,8BAA8B,GAAG;IAAE,MAAM,EAAE,kCAAkC,GAAG;QAAE,KAAK,EAAE,IAAI,CAAA;KAAE,CAAA;CAAE,CAAC;AAEnG;;GAEG;AACH,wBAAsB,yBAAyB,CAC9C,IAAI,EAAE,6BAA6B,EACnC,OAAO,CAAC,EAAE,OAAO,GACf,OAAO,CAAC,+BAA+B,CAAC,MAAM,CAAC,CAAC,CAoBlD"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { resolveProvider } from "../../lib/getInferenceProviderMapping.js";
|
|
2
|
+
import { getProviderHelper } from "../../lib/getProviderHelper.js";
|
|
3
|
+
import { base64FromBytes } from "../../utils/base64FromBytes.js";
|
|
4
|
+
import { innerRequest } from "../../utils/request.js";
|
|
5
|
+
/**
|
|
6
|
+
* Answers a question on a document image. Recommended model: impira/layoutlm-document-qa.
|
|
7
|
+
*/
|
|
8
|
+
export async function documentQuestionAnswering(args, options) {
|
|
9
|
+
const provider = await resolveProvider(args.provider, args.model, args.endpointUrl);
|
|
10
|
+
const providerHelper = getProviderHelper(provider, "document-question-answering");
|
|
11
|
+
const reqArgs = {
|
|
12
|
+
...args,
|
|
13
|
+
inputs: {
|
|
14
|
+
question: args.inputs.question,
|
|
15
|
+
// convert Blob or ArrayBuffer to base64
|
|
16
|
+
image: base64FromBytes(new Uint8Array(await args.inputs.image.arrayBuffer())),
|
|
17
|
+
},
|
|
18
|
+
};
|
|
19
|
+
const { data: res } = await innerRequest(reqArgs, providerHelper, {
|
|
20
|
+
...options,
|
|
21
|
+
task: "document-question-answering",
|
|
22
|
+
});
|
|
23
|
+
return providerHelper.getResponse(res);
|
|
24
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { VisualQuestionAnsweringInput, VisualQuestionAnsweringInputData, VisualQuestionAnsweringOutput } from "@huggingface/tasks";
|
|
2
|
+
import type { BaseArgs, Options } from "../../types.js";
|
|
3
|
+
export type VisualQuestionAnsweringArgs = BaseArgs & VisualQuestionAnsweringInput & {
|
|
4
|
+
inputs: VisualQuestionAnsweringInputData & {
|
|
5
|
+
image: Blob;
|
|
6
|
+
};
|
|
7
|
+
};
|
|
8
|
+
/**
|
|
9
|
+
* Answers a question on an image. Recommended model: dandelin/vilt-b32-finetuned-vqa.
|
|
10
|
+
*/
|
|
11
|
+
export declare function visualQuestionAnswering(args: VisualQuestionAnsweringArgs, options?: Options): Promise<VisualQuestionAnsweringOutput[number]>;
|
|
12
|
+
//# sourceMappingURL=visualQuestionAnswering.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"visualQuestionAnswering.d.ts","sourceRoot":"","sources":["../../../../src/tasks/multimodal/visualQuestionAnswering.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACX,4BAA4B,EAC5B,gCAAgC,EAChC,6BAA6B,EAC7B,MAAM,oBAAoB,CAAC;AAG5B,OAAO,KAAK,EAAE,QAAQ,EAAE,OAAO,EAAe,MAAM,gBAAgB,CAAC;AAKrE,MAAM,MAAM,2BAA2B,GAAG,QAAQ,GACjD,4BAA4B,GAAG;IAAE,MAAM,EAAE,gCAAgC,GAAG;QAAE,KAAK,EAAE,IAAI,CAAA;KAAE,CAAA;CAAE,CAAC;AAE/F;;GAEG;AACH,wBAAsB,uBAAuB,CAC5C,IAAI,EAAE,2BAA2B,EACjC,OAAO,CAAC,EAAE,OAAO,GACf,OAAO,CAAC,6BAA6B,CAAC,MAAM,CAAC,CAAC,CAiBhD"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { resolveProvider } from "../../lib/getInferenceProviderMapping.js";
|
|
2
|
+
import { getProviderHelper } from "../../lib/getProviderHelper.js";
|
|
3
|
+
import { base64FromBytes } from "../../utils/base64FromBytes.js";
|
|
4
|
+
import { innerRequest } from "../../utils/request.js";
|
|
5
|
+
/**
|
|
6
|
+
* Answers a question on an image. Recommended model: dandelin/vilt-b32-finetuned-vqa.
|
|
7
|
+
*/
|
|
8
|
+
export async function visualQuestionAnswering(args, options) {
|
|
9
|
+
const provider = await resolveProvider(args.provider, args.model, args.endpointUrl);
|
|
10
|
+
const providerHelper = getProviderHelper(provider, "visual-question-answering");
|
|
11
|
+
const reqArgs = {
|
|
12
|
+
...args,
|
|
13
|
+
inputs: {
|
|
14
|
+
question: args.inputs.question,
|
|
15
|
+
// convert Blob or ArrayBuffer to base64
|
|
16
|
+
image: base64FromBytes(new Uint8Array(await args.inputs.image.arrayBuffer())),
|
|
17
|
+
},
|
|
18
|
+
};
|
|
19
|
+
const { data: res } = await innerRequest(reqArgs, providerHelper, {
|
|
20
|
+
...options,
|
|
21
|
+
task: "visual-question-answering",
|
|
22
|
+
});
|
|
23
|
+
return providerHelper.getResponse(res);
|
|
24
|
+
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { ChatCompletionInput, ChatCompletionOutput } from "@huggingface/tasks";
|
|
2
|
+
import type { BaseArgs, Options } from "../../types.js";
|
|
3
|
+
/**
|
|
4
|
+
* Use the chat completion endpoint to generate a response to a prompt, using OpenAI message completion API no stream
|
|
5
|
+
*/
|
|
6
|
+
export declare function chatCompletion(args: BaseArgs & ChatCompletionInput, options?: Options): Promise<ChatCompletionOutput>;
|
|
7
|
+
//# sourceMappingURL=chatCompletion.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"chatCompletion.d.ts","sourceRoot":"","sources":["../../../../src/tasks/nlp/chatCompletion.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,mBAAmB,EAAE,oBAAoB,EAAE,MAAM,oBAAoB,CAAC;AAGpF,OAAO,KAAK,EAAE,QAAQ,EAAE,OAAO,EAAE,MAAM,gBAAgB,CAAC;AAGxD;;GAEG;AACH,wBAAsB,cAAc,CACnC,IAAI,EAAE,QAAQ,GAAG,mBAAmB,EACpC,OAAO,CAAC,EAAE,OAAO,GACf,OAAO,CAAC,oBAAoB,CAAC,CAQ/B"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { resolveProvider } from "../../lib/getInferenceProviderMapping.js";
|
|
2
|
+
import { getProviderHelper } from "../../lib/getProviderHelper.js";
|
|
3
|
+
import { innerRequest } from "../../utils/request.js";
|
|
4
|
+
/**
|
|
5
|
+
* Use the chat completion endpoint to generate a response to a prompt, using OpenAI message completion API no stream
|
|
6
|
+
*/
|
|
7
|
+
export async function chatCompletion(args, options) {
|
|
8
|
+
const provider = await resolveProvider(args.provider, args.model, args.endpointUrl);
|
|
9
|
+
const providerHelper = getProviderHelper(provider, "conversational");
|
|
10
|
+
const { data: response } = await innerRequest(args, providerHelper, {
|
|
11
|
+
...options,
|
|
12
|
+
task: "conversational",
|
|
13
|
+
});
|
|
14
|
+
return providerHelper.getResponse(response);
|
|
15
|
+
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { ChatCompletionInput, ChatCompletionStreamOutput } from "@huggingface/tasks";
|
|
2
|
+
import type { BaseArgs, Options } from "../../types.js";
|
|
3
|
+
/**
|
|
4
|
+
* Use to continue text from a prompt. Same as `textGeneration` but returns generator that can be read one token at a time
|
|
5
|
+
*/
|
|
6
|
+
export declare function chatCompletionStream(args: BaseArgs & ChatCompletionInput, options?: Options): AsyncGenerator<ChatCompletionStreamOutput>;
|
|
7
|
+
//# sourceMappingURL=chatCompletionStream.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"chatCompletionStream.d.ts","sourceRoot":"","sources":["../../../../src/tasks/nlp/chatCompletionStream.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,mBAAmB,EAAE,0BAA0B,EAAE,MAAM,oBAAoB,CAAC;AAG1F,OAAO,KAAK,EAAE,QAAQ,EAAE,OAAO,EAAE,MAAM,gBAAgB,CAAC;AAGxD;;GAEG;AACH,wBAAuB,oBAAoB,CAC1C,IAAI,EAAE,QAAQ,GAAG,mBAAmB,EACpC,OAAO,CAAC,EAAE,OAAO,GACf,cAAc,CAAC,0BAA0B,CAAC,CAO5C"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { resolveProvider } from "../../lib/getInferenceProviderMapping.js";
|
|
2
|
+
import { getProviderHelper } from "../../lib/getProviderHelper.js";
|
|
3
|
+
import { innerStreamingRequest } from "../../utils/request.js";
|
|
4
|
+
/**
|
|
5
|
+
* Use to continue text from a prompt. Same as `textGeneration` but returns generator that can be read one token at a time
|
|
6
|
+
*/
|
|
7
|
+
export async function* chatCompletionStream(args, options) {
|
|
8
|
+
const provider = await resolveProvider(args.provider, args.model, args.endpointUrl);
|
|
9
|
+
const providerHelper = getProviderHelper(provider, "conversational");
|
|
10
|
+
yield* innerStreamingRequest(args, providerHelper, {
|
|
11
|
+
...options,
|
|
12
|
+
task: "conversational",
|
|
13
|
+
});
|
|
14
|
+
}
|