@huggingface/inference 3.13.2 → 3.15.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/README.md +2 -1
- 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 +169 -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 +44 -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 +7 -8
- package/dist/commonjs/providers/novita.d.ts.map +1 -0
- package/dist/commonjs/providers/novita.js +119 -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 +132 -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 +39 -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 +21 -0
- package/dist/esm/providers/novita.d.ts.map +1 -0
- package/dist/esm/providers/novita.js +113 -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 +20 -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 +11 -5
- 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 +85 -27
- 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 +9 -9
- 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/providers/novita.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
|
@@ -1,17 +1,17 @@
|
|
|
1
|
-
import * as BlackForestLabs from "../providers/black-forest-labs";
|
|
2
|
-
import * as Cerebras from "../providers/cerebras";
|
|
3
|
-
import * as Cohere from "../providers/cohere";
|
|
4
|
-
import * as FalAI from "../providers/fal-ai";
|
|
5
|
-
import * as FeatherlessAI from "../providers/featherless-ai";
|
|
6
|
-
import * as Fireworks from "../providers/fireworks-ai";
|
|
7
|
-
import * as Groq from "../providers/groq";
|
|
8
|
-
import * as HFInference from "../providers/hf-inference";
|
|
9
|
-
import * as Hyperbolic from "../providers/hyperbolic";
|
|
10
|
-
import * as Nebius from "../providers/nebius";
|
|
11
|
-
import * as Novita from "../providers/novita";
|
|
12
|
-
import * as Nscale from "../providers/nscale";
|
|
13
|
-
import * as OpenAI from "../providers/openai";
|
|
14
|
-
import * as OvhCloud from "../providers/ovhcloud";
|
|
1
|
+
import * as BlackForestLabs from "../providers/black-forest-labs.js";
|
|
2
|
+
import * as Cerebras from "../providers/cerebras.js";
|
|
3
|
+
import * as Cohere from "../providers/cohere.js";
|
|
4
|
+
import * as FalAI from "../providers/fal-ai.js";
|
|
5
|
+
import * as FeatherlessAI from "../providers/featherless-ai.js";
|
|
6
|
+
import * as Fireworks from "../providers/fireworks-ai.js";
|
|
7
|
+
import * as Groq from "../providers/groq.js";
|
|
8
|
+
import * as HFInference from "../providers/hf-inference.js";
|
|
9
|
+
import * as Hyperbolic from "../providers/hyperbolic.js";
|
|
10
|
+
import * as Nebius from "../providers/nebius.js";
|
|
11
|
+
import * as Novita from "../providers/novita.js";
|
|
12
|
+
import * as Nscale from "../providers/nscale.js";
|
|
13
|
+
import * as OpenAI from "../providers/openai.js";
|
|
14
|
+
import * as OvhCloud from "../providers/ovhcloud.js";
|
|
15
15
|
import type {
|
|
16
16
|
AudioClassificationTaskHelper,
|
|
17
17
|
AudioToAudioTaskHelper,
|
|
@@ -43,11 +43,11 @@ import type {
|
|
|
43
43
|
VisualQuestionAnsweringTaskHelper,
|
|
44
44
|
ZeroShotClassificationTaskHelper,
|
|
45
45
|
ZeroShotImageClassificationTaskHelper,
|
|
46
|
-
} from "../providers/providerHelper";
|
|
47
|
-
import * as Replicate from "../providers/replicate";
|
|
48
|
-
import * as Sambanova from "../providers/sambanova";
|
|
49
|
-
import * as Together from "../providers/together";
|
|
50
|
-
import type { InferenceProvider, InferenceProviderOrPolicy, InferenceTask } from "../types";
|
|
46
|
+
} from "../providers/providerHelper.js";
|
|
47
|
+
import * as Replicate from "../providers/replicate.js";
|
|
48
|
+
import * as Sambanova from "../providers/sambanova.js";
|
|
49
|
+
import * as Together from "../providers/together.js";
|
|
50
|
+
import type { InferenceProvider, InferenceProviderOrPolicy, InferenceTask } from "../types.js";
|
|
51
51
|
|
|
52
52
|
export const PROVIDERS: Record<InferenceProvider, Partial<Record<InferenceTask, TaskProviderHelper>>> = {
|
|
53
53
|
"black-forest-labs": {
|
|
@@ -120,6 +120,7 @@ export const PROVIDERS: Record<InferenceProvider, Partial<Record<InferenceTask,
|
|
|
120
120
|
novita: {
|
|
121
121
|
conversational: new Novita.NovitaConversationalTask(),
|
|
122
122
|
"text-generation": new Novita.NovitaTextGenerationTask(),
|
|
123
|
+
"text-to-video": new Novita.NovitaTextToVideoTask(),
|
|
123
124
|
},
|
|
124
125
|
nscale: {
|
|
125
126
|
"text-to-image": new Nscale.NscaleTextToImageTask(),
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import type { InferenceTask, Options, RequestArgs } from "../types";
|
|
4
|
-
import type { InferenceProviderModelMapping } from "./getInferenceProviderMapping";
|
|
5
|
-
import { getInferenceProviderMapping } from "./getInferenceProviderMapping";
|
|
6
|
-
import type { getProviderHelper } from "./getProviderHelper";
|
|
7
|
-
import { isUrl } from "./isUrl";
|
|
1
|
+
import { HF_HEADER_X_BILL_TO, HF_HUB_URL } from "../config.js";
|
|
2
|
+
import { PACKAGE_NAME, PACKAGE_VERSION } from "../package.js";
|
|
3
|
+
import type { InferenceTask, Options, RequestArgs } from "../types.js";
|
|
4
|
+
import type { InferenceProviderModelMapping } from "./getInferenceProviderMapping.js";
|
|
5
|
+
import { getInferenceProviderMapping } from "./getInferenceProviderMapping.js";
|
|
6
|
+
import type { getProviderHelper } from "./getProviderHelper.js";
|
|
7
|
+
import { isUrl } from "./isUrl.js";
|
|
8
8
|
|
|
9
9
|
/**
|
|
10
10
|
* Lazy-loaded from huggingface.co/api/tasks when needed
|
|
@@ -158,7 +158,7 @@ export function makeRequestOptionsFromResolvedModel(
|
|
|
158
158
|
|
|
159
159
|
// Add user-agent to headers
|
|
160
160
|
// e.g. @huggingface/inference/3.1.3
|
|
161
|
-
const ownUserAgent = `${
|
|
161
|
+
const ownUserAgent = `${PACKAGE_NAME}/${PACKAGE_VERSION}`;
|
|
162
162
|
const userAgent = [ownUserAgent, typeof navigator !== "undefined" ? navigator.userAgent : undefined]
|
|
163
163
|
.filter((x) => x !== undefined)
|
|
164
164
|
.join(" ");
|
package/src/package.ts
ADDED
|
@@ -14,11 +14,11 @@
|
|
|
14
14
|
*
|
|
15
15
|
* Thanks!
|
|
16
16
|
*/
|
|
17
|
-
import { InferenceOutputError } from "../lib/InferenceOutputError";
|
|
18
|
-
import type { BodyParams, HeaderParams, UrlParams } from "../types";
|
|
19
|
-
import { delay } from "../utils/delay";
|
|
20
|
-
import { omit } from "../utils/omit";
|
|
21
|
-
import { TaskProviderHelper, type TextToImageTaskHelper } from "./providerHelper";
|
|
17
|
+
import { InferenceOutputError } from "../lib/InferenceOutputError.js";
|
|
18
|
+
import type { BodyParams, HeaderParams, UrlParams } from "../types.js";
|
|
19
|
+
import { delay } from "../utils/delay.js";
|
|
20
|
+
import { omit } from "../utils/omit.js";
|
|
21
|
+
import { TaskProviderHelper, type TextToImageTaskHelper } from "./providerHelper.js";
|
|
22
22
|
|
|
23
23
|
const BLACK_FOREST_LABS_AI_API_BASE_URL = "https://api.us1.bfl.ai";
|
|
24
24
|
interface BlackForestLabsResponse {
|
package/src/providers/cohere.ts
CHANGED
package/src/providers/consts.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import type { InferenceProviderModelMapping } from "../lib/getInferenceProviderMapping";
|
|
2
|
-
import type { InferenceProvider } from "../types";
|
|
3
|
-
import { type ModelId } from "../types";
|
|
1
|
+
import type { InferenceProviderModelMapping } from "../lib/getInferenceProviderMapping.js";
|
|
2
|
+
import type { InferenceProvider } from "../types.js";
|
|
3
|
+
import { type ModelId } from "../types.js";
|
|
4
4
|
|
|
5
5
|
/**
|
|
6
6
|
* If you want to try to run inference for a new model locally before it's registered on huggingface.co
|
package/src/providers/fal-ai.ts
CHANGED
|
@@ -14,22 +14,22 @@
|
|
|
14
14
|
*
|
|
15
15
|
* Thanks!
|
|
16
16
|
*/
|
|
17
|
-
import { base64FromBytes } from "../utils/base64FromBytes";
|
|
17
|
+
import { base64FromBytes } from "../utils/base64FromBytes.js";
|
|
18
18
|
|
|
19
19
|
import type { AutomaticSpeechRecognitionOutput } from "@huggingface/tasks";
|
|
20
|
-
import { InferenceOutputError } from "../lib/InferenceOutputError";
|
|
21
|
-
import { isUrl } from "../lib/isUrl";
|
|
22
|
-
import type { BodyParams, HeaderParams, ModelId, RequestArgs, UrlParams } from "../types";
|
|
23
|
-
import { delay } from "../utils/delay";
|
|
24
|
-
import { omit } from "../utils/omit";
|
|
20
|
+
import { InferenceOutputError } from "../lib/InferenceOutputError.js";
|
|
21
|
+
import { isUrl } from "../lib/isUrl.js";
|
|
22
|
+
import type { BodyParams, HeaderParams, ModelId, RequestArgs, UrlParams } from "../types.js";
|
|
23
|
+
import { delay } from "../utils/delay.js";
|
|
24
|
+
import { omit } from "../utils/omit.js";
|
|
25
25
|
import {
|
|
26
26
|
type AutomaticSpeechRecognitionTaskHelper,
|
|
27
27
|
TaskProviderHelper,
|
|
28
28
|
type TextToImageTaskHelper,
|
|
29
29
|
type TextToVideoTaskHelper,
|
|
30
|
-
} from "./providerHelper";
|
|
31
|
-
import { HF_HUB_URL } from "../config";
|
|
32
|
-
import type { AutomaticSpeechRecognitionArgs } from "../tasks/audio/automaticSpeechRecognition";
|
|
30
|
+
} from "./providerHelper.js";
|
|
31
|
+
import { HF_HUB_URL } from "../config.js";
|
|
32
|
+
import type { AutomaticSpeechRecognitionArgs } from "../tasks/audio/automaticSpeechRecognition.js";
|
|
33
33
|
|
|
34
34
|
export interface FalAiQueueOutput {
|
|
35
35
|
request_id: string;
|
|
@@ -4,9 +4,10 @@ import type {
|
|
|
4
4
|
TextGenerationOutput,
|
|
5
5
|
TextGenerationOutputFinishReason,
|
|
6
6
|
} from "@huggingface/tasks";
|
|
7
|
-
import { InferenceOutputError } from "../lib/InferenceOutputError";
|
|
8
|
-
import type { BodyParams } from "../types";
|
|
9
|
-
import { BaseConversationalTask, BaseTextGenerationTask } from "./providerHelper";
|
|
7
|
+
import { InferenceOutputError } from "../lib/InferenceOutputError.js";
|
|
8
|
+
import type { BodyParams } from "../types.js";
|
|
9
|
+
import { BaseConversationalTask, BaseTextGenerationTask } from "./providerHelper.js";
|
|
10
|
+
import { omit } from "../utils/omit.js";
|
|
10
11
|
|
|
11
12
|
interface FeatherlessAITextCompletionOutput extends Omit<ChatCompletionOutput, "choices"> {
|
|
12
13
|
choices: Array<{
|
|
@@ -33,9 +34,14 @@ export class FeatherlessAITextGenerationTask extends BaseTextGenerationTask {
|
|
|
33
34
|
|
|
34
35
|
override preparePayload(params: BodyParams<TextGenerationInput>): Record<string, unknown> {
|
|
35
36
|
return {
|
|
36
|
-
...params.args,
|
|
37
|
-
...params.args.parameters,
|
|
38
37
|
model: params.model,
|
|
38
|
+
...omit(params.args, ["inputs", "parameters"]),
|
|
39
|
+
...(params.args.parameters
|
|
40
|
+
? {
|
|
41
|
+
max_tokens: params.args.parameters.max_new_tokens,
|
|
42
|
+
...omit(params.args.parameters, "max_new_tokens"),
|
|
43
|
+
}
|
|
44
|
+
: undefined),
|
|
39
45
|
prompt: params.args.inputs,
|
|
40
46
|
};
|
|
41
47
|
}
|
package/src/providers/groq.ts
CHANGED
|
@@ -33,11 +33,11 @@ import type {
|
|
|
33
33
|
ZeroShotClassificationOutput,
|
|
34
34
|
ZeroShotImageClassificationOutput,
|
|
35
35
|
} from "@huggingface/tasks";
|
|
36
|
-
import { HF_ROUTER_URL } from "../config";
|
|
37
|
-
import { InferenceOutputError } from "../lib/InferenceOutputError";
|
|
38
|
-
import type { TabularClassificationOutput } from "../tasks/tabular/tabularClassification";
|
|
39
|
-
import type { BodyParams, RequestArgs, UrlParams } from "../types";
|
|
40
|
-
import { toArray } from "../utils/toArray";
|
|
36
|
+
import { HF_ROUTER_URL } from "../config.js";
|
|
37
|
+
import { InferenceOutputError } from "../lib/InferenceOutputError.js";
|
|
38
|
+
import type { TabularClassificationOutput } from "../tasks/tabular/tabularClassification.js";
|
|
39
|
+
import type { BodyParams, RequestArgs, UrlParams } from "../types.js";
|
|
40
|
+
import { toArray } from "../utils/toArray.js";
|
|
41
41
|
import type {
|
|
42
42
|
AudioClassificationTaskHelper,
|
|
43
43
|
AudioToAudioTaskHelper,
|
|
@@ -67,13 +67,13 @@ import type {
|
|
|
67
67
|
VisualQuestionAnsweringTaskHelper,
|
|
68
68
|
ZeroShotClassificationTaskHelper,
|
|
69
69
|
ZeroShotImageClassificationTaskHelper,
|
|
70
|
-
} from "./providerHelper";
|
|
70
|
+
} from "./providerHelper.js";
|
|
71
71
|
|
|
72
|
-
import { TaskProviderHelper } from "./providerHelper";
|
|
73
|
-
import { base64FromBytes } from "../utils/base64FromBytes";
|
|
74
|
-
import type { ImageToImageArgs } from "../tasks/cv/imageToImage";
|
|
75
|
-
import type { AutomaticSpeechRecognitionArgs } from "../tasks/audio/automaticSpeechRecognition";
|
|
76
|
-
import { omit } from "../utils/omit";
|
|
72
|
+
import { TaskProviderHelper } from "./providerHelper.js";
|
|
73
|
+
import { base64FromBytes } from "../utils/base64FromBytes.js";
|
|
74
|
+
import type { ImageToImageArgs } from "../tasks/cv/imageToImage.js";
|
|
75
|
+
import type { AutomaticSpeechRecognitionArgs } from "../tasks/audio/automaticSpeechRecognition.js";
|
|
76
|
+
import { omit } from "../utils/omit.js";
|
|
77
77
|
interface Base64ImageGeneration {
|
|
78
78
|
data: Array<{
|
|
79
79
|
b64_json: string;
|
|
@@ -15,15 +15,15 @@
|
|
|
15
15
|
* Thanks!
|
|
16
16
|
*/
|
|
17
17
|
import type { ChatCompletionOutput, TextGenerationOutput } from "@huggingface/tasks";
|
|
18
|
-
import { InferenceOutputError } from "../lib/InferenceOutputError";
|
|
19
|
-
import type { BodyParams, UrlParams } from "../types";
|
|
20
|
-
import { omit } from "../utils/omit";
|
|
18
|
+
import { InferenceOutputError } from "../lib/InferenceOutputError.js";
|
|
19
|
+
import type { BodyParams, UrlParams } from "../types.js";
|
|
20
|
+
import { omit } from "../utils/omit.js";
|
|
21
21
|
import {
|
|
22
22
|
BaseConversationalTask,
|
|
23
23
|
BaseTextGenerationTask,
|
|
24
24
|
TaskProviderHelper,
|
|
25
25
|
type TextToImageTaskHelper,
|
|
26
|
-
} from "./providerHelper";
|
|
26
|
+
} from "./providerHelper.js";
|
|
27
27
|
|
|
28
28
|
const HYPERBOLIC_API_BASE_URL = "https://api.hyperbolic.xyz";
|
|
29
29
|
|
package/src/providers/nebius.ts
CHANGED
|
@@ -15,16 +15,16 @@
|
|
|
15
15
|
* Thanks!
|
|
16
16
|
*/
|
|
17
17
|
import type { FeatureExtractionOutput } from "@huggingface/tasks";
|
|
18
|
-
import { InferenceOutputError } from "../lib/InferenceOutputError";
|
|
19
|
-
import type { BodyParams } from "../types";
|
|
20
|
-
import { omit } from "../utils/omit";
|
|
18
|
+
import { InferenceOutputError } from "../lib/InferenceOutputError.js";
|
|
19
|
+
import type { BodyParams } from "../types.js";
|
|
20
|
+
import { omit } from "../utils/omit.js";
|
|
21
21
|
import {
|
|
22
22
|
BaseConversationalTask,
|
|
23
23
|
BaseTextGenerationTask,
|
|
24
24
|
TaskProviderHelper,
|
|
25
25
|
type FeatureExtractionTaskHelper,
|
|
26
26
|
type TextToImageTaskHelper,
|
|
27
|
-
} from "./providerHelper";
|
|
27
|
+
} from "./providerHelper.js";
|
|
28
28
|
|
|
29
29
|
const NEBIUS_API_BASE_URL = "https://api.studio.nebius.ai";
|
|
30
30
|
|
package/src/providers/novita.ts
CHANGED
|
@@ -14,23 +14,25 @@
|
|
|
14
14
|
*
|
|
15
15
|
* Thanks!
|
|
16
16
|
*/
|
|
17
|
-
import { InferenceOutputError } from "../lib/InferenceOutputError";
|
|
18
|
-
import { isUrl } from "../lib/isUrl";
|
|
19
|
-
import type {
|
|
20
|
-
import {
|
|
17
|
+
import { InferenceOutputError } from "../lib/InferenceOutputError.js";
|
|
18
|
+
import { isUrl } from "../lib/isUrl.js";
|
|
19
|
+
import type { TextToVideoArgs } from "../tasks/index.js";
|
|
20
|
+
import type { BodyParams, UrlParams } from "../types.js";
|
|
21
|
+
import { delay } from "../utils/delay.js";
|
|
22
|
+
import { omit } from "../utils/omit.js";
|
|
21
23
|
import {
|
|
22
24
|
BaseConversationalTask,
|
|
23
25
|
BaseTextGenerationTask,
|
|
24
26
|
TaskProviderHelper,
|
|
25
27
|
type TextToVideoTaskHelper,
|
|
26
|
-
} from "./providerHelper";
|
|
28
|
+
} from "./providerHelper.js";
|
|
27
29
|
|
|
28
30
|
const NOVITA_API_BASE_URL = "https://api.novita.ai";
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
};
|
|
31
|
+
|
|
32
|
+
export interface NovitaAsyncAPIOutput {
|
|
33
|
+
task_id: string;
|
|
33
34
|
}
|
|
35
|
+
|
|
34
36
|
export class NovitaTextGenerationTask extends BaseTextGenerationTask {
|
|
35
37
|
constructor() {
|
|
36
38
|
super("novita", NOVITA_API_BASE_URL);
|
|
@@ -50,38 +52,94 @@ export class NovitaConversationalTask extends BaseConversationalTask {
|
|
|
50
52
|
return "/v3/openai/chat/completions";
|
|
51
53
|
}
|
|
52
54
|
}
|
|
55
|
+
|
|
53
56
|
export class NovitaTextToVideoTask extends TaskProviderHelper implements TextToVideoTaskHelper {
|
|
54
57
|
constructor() {
|
|
55
58
|
super("novita", NOVITA_API_BASE_URL);
|
|
56
59
|
}
|
|
57
60
|
|
|
58
|
-
makeRoute(params: UrlParams): string {
|
|
59
|
-
return `/v3/
|
|
61
|
+
override makeRoute(params: UrlParams): string {
|
|
62
|
+
return `/v3/async/${params.model}`;
|
|
60
63
|
}
|
|
61
64
|
|
|
62
|
-
preparePayload(params: BodyParams): Record<string, unknown> {
|
|
65
|
+
override preparePayload(params: BodyParams<TextToVideoArgs>): Record<string, unknown> {
|
|
66
|
+
const { num_inference_steps, ...restParameters } = params.args.parameters ?? {};
|
|
63
67
|
return {
|
|
64
68
|
...omit(params.args, ["inputs", "parameters"]),
|
|
65
|
-
...
|
|
69
|
+
...restParameters,
|
|
70
|
+
steps: num_inference_steps,
|
|
66
71
|
prompt: params.args.inputs,
|
|
67
72
|
};
|
|
68
73
|
}
|
|
69
|
-
override async getResponse(response: NovitaOutput): Promise<Blob> {
|
|
70
|
-
const isValidOutput =
|
|
71
|
-
typeof response === "object" &&
|
|
72
|
-
!!response &&
|
|
73
|
-
"video" in response &&
|
|
74
|
-
typeof response.video === "object" &&
|
|
75
|
-
!!response.video &&
|
|
76
|
-
"video_url" in response.video &&
|
|
77
|
-
typeof response.video.video_url === "string" &&
|
|
78
|
-
isUrl(response.video.video_url);
|
|
79
74
|
|
|
80
|
-
|
|
81
|
-
|
|
75
|
+
override async getResponse(
|
|
76
|
+
response: NovitaAsyncAPIOutput,
|
|
77
|
+
url?: string,
|
|
78
|
+
headers?: Record<string, string>
|
|
79
|
+
): Promise<Blob> {
|
|
80
|
+
if (!url || !headers) {
|
|
81
|
+
throw new InferenceOutputError("URL and headers are required for text-to-video task");
|
|
82
82
|
}
|
|
83
|
+
const taskId = response.task_id;
|
|
84
|
+
if (!taskId) {
|
|
85
|
+
throw new InferenceOutputError("No task ID found in the response");
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
const parsedUrl = new URL(url);
|
|
89
|
+
const baseUrl = `${parsedUrl.protocol}//${parsedUrl.host}${
|
|
90
|
+
parsedUrl.host === "router.huggingface.co" ? "/novita" : ""
|
|
91
|
+
}`;
|
|
92
|
+
const resultUrl = `${baseUrl}/v3/async/task-result?task_id=${taskId}`;
|
|
93
|
+
|
|
94
|
+
let status = "";
|
|
95
|
+
let taskResult: unknown;
|
|
83
96
|
|
|
84
|
-
|
|
85
|
-
|
|
97
|
+
while (status !== "TASK_STATUS_SUCCEED" && status !== "TASK_STATUS_FAILED") {
|
|
98
|
+
await delay(500);
|
|
99
|
+
const resultResponse = await fetch(resultUrl, { headers });
|
|
100
|
+
if (!resultResponse.ok) {
|
|
101
|
+
throw new InferenceOutputError("Failed to fetch task result");
|
|
102
|
+
}
|
|
103
|
+
try {
|
|
104
|
+
taskResult = await resultResponse.json();
|
|
105
|
+
if (
|
|
106
|
+
taskResult &&
|
|
107
|
+
typeof taskResult === "object" &&
|
|
108
|
+
"task" in taskResult &&
|
|
109
|
+
taskResult.task &&
|
|
110
|
+
typeof taskResult.task === "object" &&
|
|
111
|
+
"status" in taskResult.task &&
|
|
112
|
+
typeof taskResult.task.status === "string"
|
|
113
|
+
) {
|
|
114
|
+
status = taskResult.task.status;
|
|
115
|
+
} else {
|
|
116
|
+
throw new InferenceOutputError("Failed to get task status");
|
|
117
|
+
}
|
|
118
|
+
} catch (error) {
|
|
119
|
+
throw new InferenceOutputError("Failed to parse task result");
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
if (status === "TASK_STATUS_FAILED") {
|
|
124
|
+
throw new InferenceOutputError("Task failed");
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
if (
|
|
128
|
+
typeof taskResult === "object" &&
|
|
129
|
+
!!taskResult &&
|
|
130
|
+
"videos" in taskResult &&
|
|
131
|
+
typeof taskResult.videos === "object" &&
|
|
132
|
+
!!taskResult.videos &&
|
|
133
|
+
Array.isArray(taskResult.videos) &&
|
|
134
|
+
taskResult.videos.length > 0 &&
|
|
135
|
+
"video_url" in taskResult.videos[0] &&
|
|
136
|
+
typeof taskResult.videos[0].video_url === "string" &&
|
|
137
|
+
isUrl(taskResult.videos[0].video_url)
|
|
138
|
+
) {
|
|
139
|
+
const urlResponse = await fetch(taskResult.videos[0].video_url);
|
|
140
|
+
return await urlResponse.blob();
|
|
141
|
+
} else {
|
|
142
|
+
throw new InferenceOutputError("Expected { videos: [{ video_url: string }] }");
|
|
143
|
+
}
|
|
86
144
|
}
|
|
87
145
|
}
|
package/src/providers/nscale.ts
CHANGED
|
@@ -15,10 +15,10 @@
|
|
|
15
15
|
* Thanks!
|
|
16
16
|
*/
|
|
17
17
|
import type { TextToImageInput } from "@huggingface/tasks";
|
|
18
|
-
import { InferenceOutputError } from "../lib/InferenceOutputError";
|
|
19
|
-
import type { BodyParams } from "../types";
|
|
20
|
-
import { omit } from "../utils/omit";
|
|
21
|
-
import { BaseConversationalTask, TaskProviderHelper, type TextToImageTaskHelper } from "./providerHelper";
|
|
18
|
+
import { InferenceOutputError } from "../lib/InferenceOutputError.js";
|
|
19
|
+
import type { BodyParams } from "../types.js";
|
|
20
|
+
import { omit } from "../utils/omit.js";
|
|
21
|
+
import { BaseConversationalTask, TaskProviderHelper, type TextToImageTaskHelper } from "./providerHelper.js";
|
|
22
22
|
|
|
23
23
|
const NSCALE_API_BASE_URL = "https://inference.api.nscale.com";
|
|
24
24
|
|
package/src/providers/openai.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Special case: provider configuration for a private models provider (OpenAI in this case).
|
|
3
3
|
*/
|
|
4
|
-
import { BaseConversationalTask } from "./providerHelper";
|
|
4
|
+
import { BaseConversationalTask } from "./providerHelper.js";
|
|
5
5
|
|
|
6
6
|
const OPENAI_API_BASE_URL = "https://api.openai.com";
|
|
7
7
|
|
|
@@ -15,11 +15,11 @@
|
|
|
15
15
|
* Thanks!
|
|
16
16
|
*/
|
|
17
17
|
|
|
18
|
-
import { BaseConversationalTask, BaseTextGenerationTask } from "./providerHelper";
|
|
18
|
+
import { BaseConversationalTask, BaseTextGenerationTask } from "./providerHelper.js";
|
|
19
19
|
import type { ChatCompletionOutput, TextGenerationOutput, TextGenerationOutputFinishReason } from "@huggingface/tasks";
|
|
20
|
-
import { InferenceOutputError } from "../lib/InferenceOutputError";
|
|
21
|
-
import type { BodyParams } from "../types";
|
|
22
|
-
import { omit } from "../utils/omit";
|
|
20
|
+
import { InferenceOutputError } from "../lib/InferenceOutputError.js";
|
|
21
|
+
import type { BodyParams } from "../types.js";
|
|
22
|
+
import { omit } from "../utils/omit.js";
|
|
23
23
|
import type { TextGenerationInput } from "@huggingface/tasks";
|
|
24
24
|
|
|
25
25
|
const OVHCLOUD_API_BASE_URL = "https://oai.endpoints.kepler.ai.cloud.ovh.net";
|
|
@@ -45,13 +45,13 @@ import type {
|
|
|
45
45
|
ZeroShotImageClassificationInput,
|
|
46
46
|
ZeroShotImageClassificationOutput,
|
|
47
47
|
} from "@huggingface/tasks";
|
|
48
|
-
import { HF_ROUTER_URL } from "../config";
|
|
49
|
-
import { InferenceOutputError } from "../lib/InferenceOutputError";
|
|
50
|
-
import type { AudioToAudioOutput } from "../tasks/audio/audioToAudio";
|
|
51
|
-
import type { BaseArgs, BodyParams, HeaderParams, InferenceProvider, RequestArgs, UrlParams } from "../types";
|
|
52
|
-
import { toArray } from "../utils/toArray";
|
|
53
|
-
import type { ImageToImageArgs } from "../tasks/cv/imageToImage";
|
|
54
|
-
import type { AutomaticSpeechRecognitionArgs } from "../tasks/audio/automaticSpeechRecognition";
|
|
48
|
+
import { HF_ROUTER_URL } from "../config.js";
|
|
49
|
+
import { InferenceOutputError } from "../lib/InferenceOutputError.js";
|
|
50
|
+
import type { AudioToAudioOutput } from "../tasks/audio/audioToAudio.js";
|
|
51
|
+
import type { BaseArgs, BodyParams, HeaderParams, InferenceProvider, RequestArgs, UrlParams } from "../types.js";
|
|
52
|
+
import { toArray } from "../utils/toArray.js";
|
|
53
|
+
import type { ImageToImageArgs } from "../tasks/cv/imageToImage.js";
|
|
54
|
+
import type { AutomaticSpeechRecognitionArgs } from "../tasks/audio/automaticSpeechRecognition.js";
|
|
55
55
|
|
|
56
56
|
/**
|
|
57
57
|
* Base class for task-specific provider helpers
|
|
@@ -14,11 +14,11 @@
|
|
|
14
14
|
*
|
|
15
15
|
* Thanks!
|
|
16
16
|
*/
|
|
17
|
-
import { InferenceOutputError } from "../lib/InferenceOutputError";
|
|
18
|
-
import { isUrl } from "../lib/isUrl";
|
|
19
|
-
import type { BodyParams, HeaderParams, UrlParams } from "../types";
|
|
20
|
-
import { omit } from "../utils/omit";
|
|
21
|
-
import { TaskProviderHelper, type TextToImageTaskHelper, type TextToVideoTaskHelper } from "./providerHelper";
|
|
17
|
+
import { InferenceOutputError } from "../lib/InferenceOutputError.js";
|
|
18
|
+
import { isUrl } from "../lib/isUrl.js";
|
|
19
|
+
import type { BodyParams, HeaderParams, UrlParams } from "../types.js";
|
|
20
|
+
import { omit } from "../utils/omit.js";
|
|
21
|
+
import { TaskProviderHelper, type TextToImageTaskHelper, type TextToVideoTaskHelper } from "./providerHelper.js";
|
|
22
22
|
export interface ReplicateOutput {
|
|
23
23
|
output?: string | string[];
|
|
24
24
|
}
|
|
@@ -14,12 +14,12 @@
|
|
|
14
14
|
*
|
|
15
15
|
* Thanks!
|
|
16
16
|
*/
|
|
17
|
-
import { InferenceOutputError } from "../lib/InferenceOutputError";
|
|
17
|
+
import { InferenceOutputError } from "../lib/InferenceOutputError.js";
|
|
18
18
|
|
|
19
19
|
import type { FeatureExtractionOutput } from "@huggingface/tasks";
|
|
20
|
-
import type { BodyParams } from "../types";
|
|
21
|
-
import type { FeatureExtractionTaskHelper } from "./providerHelper";
|
|
22
|
-
import { BaseConversationalTask, TaskProviderHelper } from "./providerHelper";
|
|
20
|
+
import type { BodyParams } from "../types.js";
|
|
21
|
+
import type { FeatureExtractionTaskHelper } from "./providerHelper.js";
|
|
22
|
+
import { BaseConversationalTask, TaskProviderHelper } from "./providerHelper.js";
|
|
23
23
|
|
|
24
24
|
export class SambanovaConversationalTask extends BaseConversationalTask {
|
|
25
25
|
constructor() {
|
|
@@ -15,15 +15,15 @@
|
|
|
15
15
|
* Thanks!
|
|
16
16
|
*/
|
|
17
17
|
import type { ChatCompletionOutput, TextGenerationOutput, TextGenerationOutputFinishReason } from "@huggingface/tasks";
|
|
18
|
-
import { InferenceOutputError } from "../lib/InferenceOutputError";
|
|
19
|
-
import type { BodyParams } from "../types";
|
|
20
|
-
import { omit } from "../utils/omit";
|
|
18
|
+
import { InferenceOutputError } from "../lib/InferenceOutputError.js";
|
|
19
|
+
import type { BodyParams } from "../types.js";
|
|
20
|
+
import { omit } from "../utils/omit.js";
|
|
21
21
|
import {
|
|
22
22
|
BaseConversationalTask,
|
|
23
23
|
BaseTextGenerationTask,
|
|
24
24
|
TaskProviderHelper,
|
|
25
25
|
type TextToImageTaskHelper,
|
|
26
|
-
} from "./providerHelper";
|
|
26
|
+
} from "./providerHelper.js";
|
|
27
27
|
|
|
28
28
|
const TOGETHER_API_BASE_URL = "https://api.together.xyz";
|
|
29
29
|
|
|
@@ -6,13 +6,13 @@ import {
|
|
|
6
6
|
getModelInputSnippet,
|
|
7
7
|
inferenceSnippetLanguages,
|
|
8
8
|
} from "@huggingface/tasks";
|
|
9
|
-
import type { PipelineType, WidgetType } from "@huggingface/tasks
|
|
10
|
-
import type { ChatCompletionInputMessage, GenerationParameters } from "@huggingface/tasks
|
|
11
|
-
import type { InferenceProviderModelMapping } from "../lib/getInferenceProviderMapping";
|
|
12
|
-
import { getProviderHelper } from "../lib/getProviderHelper";
|
|
13
|
-
import { makeRequestOptionsFromResolvedModel } from "../lib/makeRequestOptions";
|
|
14
|
-
import type { InferenceProviderOrPolicy, InferenceTask, RequestArgs } from "../types";
|
|
15
|
-
import { templates } from "./templates.exported";
|
|
9
|
+
import type { PipelineType, WidgetType } from "@huggingface/tasks";
|
|
10
|
+
import type { ChatCompletionInputMessage, GenerationParameters } from "@huggingface/tasks";
|
|
11
|
+
import type { InferenceProviderModelMapping } from "../lib/getInferenceProviderMapping.js";
|
|
12
|
+
import { getProviderHelper } from "../lib/getProviderHelper.js";
|
|
13
|
+
import { makeRequestOptionsFromResolvedModel } from "../lib/makeRequestOptions.js";
|
|
14
|
+
import type { InferenceProviderOrPolicy, InferenceTask, RequestArgs } from "../types.js";
|
|
15
|
+
import { templates } from "./templates.exported.js";
|
|
16
16
|
|
|
17
17
|
export type InferenceSnippetOptions = { streaming?: boolean; billTo?: string } & Record<string, unknown>;
|
|
18
18
|
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import type { AudioClassificationInput, AudioClassificationOutput } from "@huggingface/tasks";
|
|
2
|
-
import { resolveProvider } from "../../lib/getInferenceProviderMapping";
|
|
3
|
-
import { getProviderHelper } from "../../lib/getProviderHelper";
|
|
4
|
-
import type { BaseArgs, Options } from "../../types";
|
|
5
|
-
import { innerRequest } from "../../utils/request";
|
|
6
|
-
import type { LegacyAudioInput } from "./utils";
|
|
7
|
-
import { preparePayload } from "./utils";
|
|
2
|
+
import { resolveProvider } from "../../lib/getInferenceProviderMapping.js";
|
|
3
|
+
import { getProviderHelper } from "../../lib/getProviderHelper.js";
|
|
4
|
+
import type { BaseArgs, Options } from "../../types.js";
|
|
5
|
+
import { innerRequest } from "../../utils/request.js";
|
|
6
|
+
import type { LegacyAudioInput } from "./utils.js";
|
|
7
|
+
import { preparePayload } from "./utils.js";
|
|
8
8
|
|
|
9
9
|
export type AudioClassificationArgs = BaseArgs & (AudioClassificationInput | LegacyAudioInput);
|
|
10
10
|
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { resolveProvider } from "../../lib/getInferenceProviderMapping";
|
|
2
|
-
import { getProviderHelper } from "../../lib/getProviderHelper";
|
|
3
|
-
import type { BaseArgs, Options } from "../../types";
|
|
4
|
-
import { innerRequest } from "../../utils/request";
|
|
5
|
-
import type { LegacyAudioInput } from "./utils";
|
|
6
|
-
import { preparePayload } from "./utils";
|
|
1
|
+
import { resolveProvider } from "../../lib/getInferenceProviderMapping.js";
|
|
2
|
+
import { getProviderHelper } from "../../lib/getProviderHelper.js";
|
|
3
|
+
import type { BaseArgs, Options } from "../../types.js";
|
|
4
|
+
import { innerRequest } from "../../utils/request.js";
|
|
5
|
+
import type { LegacyAudioInput } from "./utils.js";
|
|
6
|
+
import { preparePayload } from "./utils.js";
|
|
7
7
|
|
|
8
8
|
export type AudioToAudioArgs =
|
|
9
9
|
| (BaseArgs & {
|