Huggingface.js documentation
@huggingface/inference
@huggingface/inference
Namespaces
Classes
- HfInference
- InferenceClient
- InferenceClientEndpoint
- InferenceClientError
- InferenceClientHubApiError
- InferenceClientInputError
- InferenceClientProviderApiError
- InferenceClientProviderOutputError
- InferenceClientRoutingError
Interfaces
- AudioToAudioOutput
- AudioToAudioOutputElem
- BaseArgs
- BodyParams
- HeaderParams
- InferenceProviderMappingEntry
- Logger
- Options
- TextGenerationInput
- TextGenerationOutput
- TextGenerationStreamBestOfSequence
- TextGenerationStreamDetails
- TextGenerationStreamOutput
- TextGenerationStreamPrefillToken
- TextGenerationStreamToken
- UrlParams
Type Aliases
AudioClassificationArgs
Ƭ AudioClassificationArgs: BaseArgs & AudioClassificationInput | LegacyAudioInput
Defined in
inference/src/tasks/audio/audioClassification.ts:9
AudioToAudioArgs
Ƭ AudioToAudioArgs: BaseArgs & { inputs: Blob } | LegacyAudioInput
Defined in
inference/src/tasks/audio/audioToAudio.ts:8
AuthMethod
Ƭ AuthMethod: "none" | "hf-token" | "credentials-include" | "provider-key"
Defined in
AutomaticSpeechRecognitionArgs
Ƭ AutomaticSpeechRecognitionArgs: BaseArgs & AutomaticSpeechRecognitionInput | LegacyAudioInput
Defined in
inference/src/tasks/audio/automaticSpeechRecognition.ts:8
DocumentQuestionAnsweringArgs
Ƭ DocumentQuestionAnsweringArgs: BaseArgs & DocumentQuestionAnsweringInput & { inputs: DocumentQuestionAnsweringInputData & { image: Blob } }
Defined in
inference/src/tasks/multimodal/documentQuestionAnswering.ts:13
FeatureExtractionArgs
Ƭ FeatureExtractionArgs: BaseArgs & FeatureExtractionInput & FeatureExtractionOAICompatInput
Defined in
inference/src/tasks/nlp/featureExtraction.ts:12
FeatureExtractionOutput
Ƭ FeatureExtractionOutput: (number | number[] | number[][])[]
Returned values are a multidimensional array of floats (dimension depending on if you sent a string or a list of string, and if the automatic reduction, usually mean_pooling for instance was applied for you or not. This should be explained on the model’s README).
Defined in
inference/src/tasks/nlp/featureExtraction.ts:17
FillMaskArgs
Ƭ FillMaskArgs: BaseArgs & FillMaskInput
Defined in
inference/src/tasks/nlp/fillMask.ts:7
ImageClassificationArgs
Ƭ ImageClassificationArgs: BaseArgs & ImageClassificationInput | LegacyImageInput
Defined in
inference/src/tasks/cv/imageClassification.ts:8
ImageSegmentationArgs
Ƭ ImageSegmentationArgs: BaseArgs & ImageSegmentationInput
Defined in
inference/src/tasks/cv/imageSegmentation.ts:8
ImageToImageArgs
Ƭ ImageToImageArgs: BaseArgs & ImageToImageInput
Defined in
inference/src/tasks/cv/imageToImage.ts:8
ImageToTextArgs
Ƭ ImageToTextArgs: BaseArgs & ImageToTextInput | LegacyImageInput
Defined in
inference/src/tasks/cv/imageToText.ts:9
ImageToVideoArgs
Ƭ ImageToVideoArgs: BaseArgs & ImageToVideoInput
Defined in
inference/src/tasks/cv/imageToVideo.ts:8
InferenceProvider
Ƭ InferenceProvider: typeof INFERENCE_PROVIDERS[number]
Defined in
InferenceProviderOrPolicy
Ƭ InferenceProviderOrPolicy: typeof PROVIDERS_OR_POLICIES[number]
Defined in
InferenceTask
Ƭ InferenceTask: Exclude\<PipelineType, "other"> | "conversational"
Defined in
ModelId
Ƭ ModelId: string
HF model id, like “meta-llama/Llama-3.3-70B-Instruct”
Defined in
ObjectDetectionArgs
Ƭ ObjectDetectionArgs: BaseArgs & ObjectDetectionInput | LegacyImageInput
Defined in
inference/src/tasks/cv/objectDetection.ts:8
QuestionAnsweringArgs
Ƭ QuestionAnsweringArgs: BaseArgs & QuestionAnsweringInput
Defined in
inference/src/tasks/nlp/questionAnswering.ts:8
RequestArgs
Ƭ RequestArgs: BaseArgs & { data: Blob | ArrayBuffer } | { inputs: unknown } | { prompt: string } | { text: string } | { audio_url: string } | ChatCompletionInput & { parameters?: Record\<string, unknown> }
Defined in
SentenceSimilarityArgs
Ƭ SentenceSimilarityArgs: BaseArgs & SentenceSimilarityInput
Defined in
inference/src/tasks/nlp/sentenceSimilarity.ts:7
SummarizationArgs
Ƭ SummarizationArgs: BaseArgs & SummarizationInput
Defined in
inference/src/tasks/nlp/summarization.ts:7
TableQuestionAnsweringArgs
Ƭ TableQuestionAnsweringArgs: BaseArgs & TableQuestionAnsweringInput
Defined in
inference/src/tasks/nlp/tableQuestionAnswering.ts:7
TabularClassificationArgs
Ƭ TabularClassificationArgs: BaseArgs & { inputs: { data: Record\<string, string[]> } }
Defined in
inference/src/tasks/tabular/tabularClassification.ts:6
TabularClassificationOutput
Ƭ TabularClassificationOutput: number[]
A list of predicted labels for each row
Defined in
inference/src/tasks/tabular/tabularClassification.ts:18
TabularRegressionArgs
Ƭ TabularRegressionArgs: BaseArgs & { inputs: { data: Record\<string, string[]> } }
Defined in
inference/src/tasks/tabular/tabularRegression.ts:6
TabularRegressionOutput
Ƭ TabularRegressionOutput: number[]
a list of predicted values for each row
Defined in
inference/src/tasks/tabular/tabularRegression.ts:18
TextClassificationArgs
Ƭ TextClassificationArgs: BaseArgs & TextClassificationInput
Defined in
inference/src/tasks/nlp/textClassification.ts:7
TextGenerationStreamFinishReason
Ƭ TextGenerationStreamFinishReason: "length" | "eos_token" | "stop_sequence"
Defined in
inference/src/tasks/nlp/textGenerationStream.ts:48
TextToImageArgs
Ƭ TextToImageArgs: BaseArgs & TextToImageInput
Defined in
inference/src/tasks/cv/textToImage.ts:8
TextToVideoArgs
Ƭ TextToVideoArgs: BaseArgs & TextToVideoInput
Defined in
inference/src/tasks/cv/textToVideo.ts:11
TextToVideoOutput
Ƭ TextToVideoOutput: Blob
Defined in
inference/src/tasks/cv/textToVideo.ts:13
TokenClassificationArgs
Ƭ TokenClassificationArgs: BaseArgs & TokenClassificationInput
Defined in
inference/src/tasks/nlp/tokenClassification.ts:7
TranslationArgs
Ƭ TranslationArgs: BaseArgs & TranslationInput
Defined in
inference/src/tasks/nlp/translation.ts:7
VisualQuestionAnsweringArgs
Ƭ VisualQuestionAnsweringArgs: BaseArgs & VisualQuestionAnsweringInput & { inputs: VisualQuestionAnsweringInputData & { image: Blob } }
Defined in
inference/src/tasks/multimodal/visualQuestionAnswering.ts:13
ZeroShotClassificationArgs
Ƭ ZeroShotClassificationArgs: BaseArgs & ZeroShotClassificationInput
Defined in
inference/src/tasks/nlp/zeroShotClassification.ts:7
ZeroShotImageClassificationArgs
Ƭ ZeroShotImageClassificationArgs: BaseArgs & ZeroShotImageClassificationInput | LegacyZeroShotImageClassificationInput
Defined in
inference/src/tasks/cv/zeroShotImageClassification.ts:15
Variables
INFERENCE _ PROVIDERS
• Const INFERENCE_PROVIDERS: readonly ["baseten", "black-forest-labs", "cerebras", "clarifai", "cohere", "fal-ai", "featherless-ai", "fireworks-ai", "groq", "hf-inference", "hyperbolic", "nebius", "novita", "nscale", "openai", "ovhcloud", "publicai", "replicate", "sambanova", "scaleway", "together", "wavespeed", "zai-org"]
Defined in
PROVIDERS
• Const PROVIDERS: Record\<InferenceProvider, Partial\<Record\<InferenceTask, TaskProviderHelper>>>
Defined in
inference/src/lib/getProviderHelper.ts:60
PROVIDERS _ HUB _ ORGS
• Const PROVIDERS_HUB_ORGS: Record\<InferenceProvider, string>
The org namespace on the HF Hub i.e. hf.co/…
Whenever possible, InferenceProvider should == org namespace
Defined in
PROVIDERS _ OR _ POLICIES
• Const PROVIDERS_OR_POLICIES: readonly ["baseten", "black-forest-labs", "cerebras", "clarifai", "cohere", "fal-ai", "featherless-ai", "fireworks-ai", "groq", "hf-inference", "hyperbolic", "nebius", "novita", "nscale", "openai", "ovhcloud", "publicai", "replicate", "sambanova", "scaleway", "together", "wavespeed", "zai-org", "auto"]
Defined in
Functions
audioClassification
▸ audioClassification(args, options?): Promise\<AudioClassificationOutput>
This task reads some audio input and outputs the likelihood of classes. Recommended model: superb/hubert-large-superb-er
Parameters
| Name | Type |
|---|---|
args | AudioClassificationArgs |
options? | Options |
Returns
Promise\<AudioClassificationOutput>
Defined in
inference/src/tasks/audio/audioClassification.ts:15
audioToAudio
▸ audioToAudio(args, options?): Promise\<AudioToAudioOutput[]>
This task reads some audio input and outputs one or multiple audio files. Example model: speechbrain/sepformer-wham does audio source separation.
Parameters
| Name | Type |
|---|---|
args | AudioToAudioArgs |
options? | Options |
Returns
Promise\<AudioToAudioOutput[]>
Defined in
inference/src/tasks/audio/audioToAudio.ts:39
automaticSpeechRecognition
▸ automaticSpeechRecognition(args, options?): Promise\<AutomaticSpeechRecognitionOutput>
This task reads some audio input and outputs the said words within the audio files. Recommended model (english language): facebook/wav2vec2-large-960h-lv60-self
Parameters
| Name | Type |
|---|---|
args | AutomaticSpeechRecognitionArgs |
options? | Options |
Returns
Promise\<AutomaticSpeechRecognitionOutput>
Defined in
inference/src/tasks/audio/automaticSpeechRecognition.ts:13
chatCompletion
▸ chatCompletion(args, options?): Promise\<ChatCompletionOutput>
Use the chat completion endpoint to generate a response to a prompt, using OpenAI message completion API no stream
Parameters
| Name | Type |
|---|---|
args | BaseArgs & ChatCompletionInput |
options? | Options |
Returns
Promise\<ChatCompletionOutput>
Defined in
inference/src/tasks/nlp/chatCompletion.ts:12
chatCompletionStream
▸ chatCompletionStream(args, options?): AsyncGenerator\<ChatCompletionStreamOutput>
Use to continue text from a prompt. Same as textGeneration but returns generator that can be read one token at a time
Parameters
| Name | Type |
|---|---|
args | BaseArgs & ChatCompletionInput |
options? | Options |
Returns
AsyncGenerator\<ChatCompletionStreamOutput>
Defined in
inference/src/tasks/nlp/chatCompletionStream.ts:10
documentQuestionAnswering
▸ documentQuestionAnswering(args, options?): Promise\<DocumentQuestionAnsweringOutput[number]>
Answers a question on a document image. Recommended model: impira/layoutlm-document-qa.
Parameters
| Name | Type |
|---|---|
args | DocumentQuestionAnsweringArgs |
options? | Options |
Returns
Promise\<DocumentQuestionAnsweringOutput[number]>
Defined in
inference/src/tasks/multimodal/documentQuestionAnswering.ts:19
featureExtraction
▸ featureExtraction(args, options?): Promise\<FeatureExtractionOutput>
This task reads some text and outputs raw float values, that are usually consumed as part of a semantic database/semantic search.
Parameters
| Name | Type |
|---|---|
args | FeatureExtractionArgs |
options? | Options |
Returns
Promise\<FeatureExtractionOutput>
Defined in
inference/src/tasks/nlp/featureExtraction.ts:22
fillMask
▸ fillMask(args, options?): Promise\<FillMaskOutput>
Tries to fill in a hole with a missing word (token to be precise). That’s the base task for BERT models.
Parameters
| Name | Type |
|---|---|
args | FillMaskArgs |
options? | Options |
Returns
Promise\<FillMaskOutput>
Defined in
inference/src/tasks/nlp/fillMask.ts:12
getProviderHelper
▸ getProviderHelper(provider, task): TextToImageTaskHelper & TaskProviderHelper
Get provider helper instance by name and task
Parameters
| Name | Type |
|---|---|
provider | "baseten" | "black-forest-labs" | "cerebras" | "clarifai" | "cohere" | "fal-ai" | "featherless-ai" | "fireworks-ai" | "groq" | "hf-inference" | "hyperbolic" | "nebius" | "novita" | "nscale" | "openai" | "ovhcloud" | "publicai" | "replicate" | "sambanova" | "scaleway" | "together" | "wavespeed" | "zai-org" | "auto" |
task | "text-to-image" |
Returns
TextToImageTaskHelper & TaskProviderHelper
Defined in
inference/src/lib/getProviderHelper.ts:191
▸ getProviderHelper(provider, task): ConversationalTaskHelper & TaskProviderHelper
Parameters
| Name | Type |
|---|---|
provider | "baseten" | "black-forest-labs" | "cerebras" | "clarifai" | "cohere" | "fal-ai" | "featherless-ai" | "fireworks-ai" | "groq" | "hf-inference" | "hyperbolic" | "nebius" | "novita" | "nscale" | "openai" | "ovhcloud" | "publicai" | "replicate" | "sambanova" | "scaleway" | "together" | "wavespeed" | "zai-org" | "auto" |
task | "conversational" |
Returns
ConversationalTaskHelper & TaskProviderHelper
Defined in
inference/src/lib/getProviderHelper.ts:195
▸ getProviderHelper(provider, task): TextGenerationTaskHelper & TaskProviderHelper
Parameters
| Name | Type |
|---|---|
provider | "baseten" | "black-forest-labs" | "cerebras" | "clarifai" | "cohere" | "fal-ai" | "featherless-ai" | "fireworks-ai" | "groq" | "hf-inference" | "hyperbolic" | "nebius" | "novita" | "nscale" | "openai" | "ovhcloud" | "publicai" | "replicate" | "sambanova" | "scaleway" | "together" | "wavespeed" | "zai-org" | "auto" |
task | "text-generation" |
Returns
TextGenerationTaskHelper & TaskProviderHelper
Defined in
inference/src/lib/getProviderHelper.ts:199
▸ getProviderHelper(provider, task): TextToSpeechTaskHelper & TaskProviderHelper
Parameters
| Name | Type |
|---|---|
provider | "baseten" | "black-forest-labs" | "cerebras" | "clarifai" | "cohere" | "fal-ai" | "featherless-ai" | "fireworks-ai" | "groq" | "hf-inference" | "hyperbolic" | "nebius" | "novita" | "nscale" | "openai" | "ovhcloud" | "publicai" | "replicate" | "sambanova" | "scaleway" | "together" | "wavespeed" | "zai-org" | "auto" |
task | "text-to-speech" |
Returns
TextToSpeechTaskHelper & TaskProviderHelper
Defined in
inference/src/lib/getProviderHelper.ts:203
▸ getProviderHelper(provider, task): TextToAudioTaskHelper & TaskProviderHelper
Parameters
| Name | Type |
|---|---|
provider | "baseten" | "black-forest-labs" | "cerebras" | "clarifai" | "cohere" | "fal-ai" | "featherless-ai" | "fireworks-ai" | "groq" | "hf-inference" | "hyperbolic" | "nebius" | "novita" | "nscale" | "openai" | "ovhcloud" | "publicai" | "replicate" | "sambanova" | "scaleway" | "together" | "wavespeed" | "zai-org" | "auto" |
task | "text-to-audio" |
Returns
TextToAudioTaskHelper & TaskProviderHelper
Defined in
inference/src/lib/getProviderHelper.ts:207
▸ getProviderHelper(provider, task): AutomaticSpeechRecognitionTaskHelper & TaskProviderHelper
Parameters
| Name | Type |
|---|---|
provider | "baseten" | "black-forest-labs" | "cerebras" | "clarifai" | "cohere" | "fal-ai" | "featherless-ai" | "fireworks-ai" | "groq" | "hf-inference" | "hyperbolic" | "nebius" | "novita" | "nscale" | "openai" | "ovhcloud" | "publicai" | "replicate" | "sambanova" | "scaleway" | "together" | "wavespeed" | "zai-org" | "auto" |
task | "automatic-speech-recognition" |
Returns
AutomaticSpeechRecognitionTaskHelper & TaskProviderHelper
Defined in
inference/src/lib/getProviderHelper.ts:211
▸ getProviderHelper(provider, task): TextToVideoTaskHelper & TaskProviderHelper
Parameters
| Name | Type |
|---|---|
provider | "baseten" | "black-forest-labs" | "cerebras" | "clarifai" | "cohere" | "fal-ai" | "featherless-ai" | "fireworks-ai" | "groq" | "hf-inference" | "hyperbolic" | "nebius" | "novita" | "nscale" | "openai" | "ovhcloud" | "publicai" | "replicate" | "sambanova" | "scaleway" | "together" | "wavespeed" | "zai-org" | "auto" |
task | "text-to-video" |
Returns
TextToVideoTaskHelper & TaskProviderHelper
Defined in
inference/src/lib/getProviderHelper.ts:215
▸ getProviderHelper(provider, task): TextClassificationTaskHelper & TaskProviderHelper
Parameters
| Name | Type |
|---|---|
provider | "baseten" | "black-forest-labs" | "cerebras" | "clarifai" | "cohere" | "fal-ai" | "featherless-ai" | "fireworks-ai" | "groq" | "hf-inference" | "hyperbolic" | "nebius" | "novita" | "nscale" | "openai" | "ovhcloud" | "publicai" | "replicate" | "sambanova" | "scaleway" | "together" | "wavespeed" | "zai-org" | "auto" |
task | "text-classification" |
Returns
TextClassificationTaskHelper & TaskProviderHelper
Defined in
inference/src/lib/getProviderHelper.ts:219
▸ getProviderHelper(provider, task): QuestionAnsweringTaskHelper & TaskProviderHelper
Parameters
| Name | Type |
|---|---|
provider | "baseten" | "black-forest-labs" | "cerebras" | "clarifai" | "cohere" | "fal-ai" | "featherless-ai" | "fireworks-ai" | "groq" | "hf-inference" | "hyperbolic" | "nebius" | "novita" | "nscale" | "openai" | "ovhcloud" | "publicai" | "replicate" | "sambanova" | "scaleway" | "together" | "wavespeed" | "zai-org" | "auto" |
task | "question-answering" |
Returns
QuestionAnsweringTaskHelper & TaskProviderHelper
Defined in
inference/src/lib/getProviderHelper.ts:223
▸ getProviderHelper(provider, task): AudioClassificationTaskHelper & TaskProviderHelper
Parameters
| Name | Type |
|---|---|
provider | "baseten" | "black-forest-labs" | "cerebras" | "clarifai" | "cohere" | "fal-ai" | "featherless-ai" | "fireworks-ai" | "groq" | "hf-inference" | "hyperbolic" | "nebius" | "novita" | "nscale" | "openai" | "ovhcloud" | "publicai" | "replicate" | "sambanova" | "scaleway" | "together" | "wavespeed" | "zai-org" | "auto" |
task | "audio-classification" |
Returns
AudioClassificationTaskHelper & TaskProviderHelper
Defined in
inference/src/lib/getProviderHelper.ts:227
▸ getProviderHelper(provider, task): AudioToAudioTaskHelper & TaskProviderHelper
Parameters
| Name | Type |
|---|---|
provider | "baseten" | "black-forest-labs" | "cerebras" | "clarifai" | "cohere" | "fal-ai" | "featherless-ai" | "fireworks-ai" | "groq" | "hf-inference" | "hyperbolic" | "nebius" | "novita" | "nscale" | "openai" | "ovhcloud" | "publicai" | "replicate" | "sambanova" | "scaleway" | "together" | "wavespeed" | "zai-org" | "auto" |
task | "audio-to-audio" |
Returns
AudioToAudioTaskHelper & TaskProviderHelper
Defined in
inference/src/lib/getProviderHelper.ts:231
▸ getProviderHelper(provider, task): FillMaskTaskHelper & TaskProviderHelper
Parameters
| Name | Type |
|---|---|
provider | "baseten" | "black-forest-labs" | "cerebras" | "clarifai" | "cohere" | "fal-ai" | "featherless-ai" | "fireworks-ai" | "groq" | "hf-inference" | "hyperbolic" | "nebius" | "novita" | "nscale" | "openai" | "ovhcloud" | "publicai" | "replicate" | "sambanova" | "scaleway" | "together" | "wavespeed" | "zai-org" | "auto" |
task | "fill-mask" |
Returns
FillMaskTaskHelper & TaskProviderHelper
Defined in
inference/src/lib/getProviderHelper.ts:235
▸ getProviderHelper(provider, task): FeatureExtractionTaskHelper & TaskProviderHelper
Parameters
| Name | Type |
|---|---|
provider | "baseten" | "black-forest-labs" | "cerebras" | "clarifai" | "cohere" | "fal-ai" | "featherless-ai" | "fireworks-ai" | "groq" | "hf-inference" | "hyperbolic" | "nebius" | "novita" | "nscale" | "openai" | "ovhcloud" | "publicai" | "replicate" | "sambanova" | "scaleway" | "together" | "wavespeed" | "zai-org" | "auto" |
task | "feature-extraction" |
Returns
FeatureExtractionTaskHelper & TaskProviderHelper
Defined in
inference/src/lib/getProviderHelper.ts:239
▸ getProviderHelper(provider, task): ImageClassificationTaskHelper & TaskProviderHelper
Parameters
| Name | Type |
|---|---|
provider | "baseten" | "black-forest-labs" | "cerebras" | "clarifai" | "cohere" | "fal-ai" | "featherless-ai" | "fireworks-ai" | "groq" | "hf-inference" | "hyperbolic" | "nebius" | "novita" | "nscale" | "openai" | "ovhcloud" | "publicai" | "replicate" | "sambanova" | "scaleway" | "together" | "wavespeed" | "zai-org" | "auto" |
task | "image-classification" |
Returns
ImageClassificationTaskHelper & TaskProviderHelper
Defined in
inference/src/lib/getProviderHelper.ts:243
▸ getProviderHelper(provider, task): ImageSegmentationTaskHelper & TaskProviderHelper
Parameters
| Name | Type |
|---|---|
provider | "baseten" | "black-forest-labs" | "cerebras" | "clarifai" | "cohere" | "fal-ai" | "featherless-ai" | "fireworks-ai" | "groq" | "hf-inference" | "hyperbolic" | "nebius" | "novita" | "nscale" | "openai" | "ovhcloud" | "publicai" | "replicate" | "sambanova" | "scaleway" | "together" | "wavespeed" | "zai-org" | "auto" |
task | "image-segmentation" |
Returns
ImageSegmentationTaskHelper & TaskProviderHelper
Defined in
inference/src/lib/getProviderHelper.ts:247
▸ getProviderHelper(provider, task): DocumentQuestionAnsweringTaskHelper & TaskProviderHelper
Parameters
| Name | Type |
|---|---|
provider | "baseten" | "black-forest-labs" | "cerebras" | "clarifai" | "cohere" | "fal-ai" | "featherless-ai" | "fireworks-ai" | "groq" | "hf-inference" | "hyperbolic" | "nebius" | "novita" | "nscale" | "openai" | "ovhcloud" | "publicai" | "replicate" | "sambanova" | "scaleway" | "together" | "wavespeed" | "zai-org" | "auto" |
task | "document-question-answering" |
Returns
DocumentQuestionAnsweringTaskHelper & TaskProviderHelper
Defined in
inference/src/lib/getProviderHelper.ts:251
▸ getProviderHelper(provider, task): ImageToTextTaskHelper & TaskProviderHelper
Parameters
| Name | Type |
|---|---|
provider | "baseten" | "black-forest-labs" | "cerebras" | "clarifai" | "cohere" | "fal-ai" | "featherless-ai" | "fireworks-ai" | "groq" | "hf-inference" | "hyperbolic" | "nebius" | "novita" | "nscale" | "openai" | "ovhcloud" | "publicai" | "replicate" | "sambanova" | "scaleway" | "together" | "wavespeed" | "zai-org" | "auto" |
task | "image-to-text" |
Returns
ImageToTextTaskHelper & TaskProviderHelper
Defined in
inference/src/lib/getProviderHelper.ts:255
▸ getProviderHelper(provider, task): ObjectDetectionTaskHelper & TaskProviderHelper
Parameters
| Name | Type |
|---|---|
provider | "baseten" | "black-forest-labs" | "cerebras" | "clarifai" | "cohere" | "fal-ai" | "featherless-ai" | "fireworks-ai" | "groq" | "hf-inference" | "hyperbolic" | "nebius" | "novita" | "nscale" | "openai" | "ovhcloud" | "publicai" | "replicate" | "sambanova" | "scaleway" | "together" | "wavespeed" | "zai-org" | "auto" |
task | "object-detection" |
Returns
ObjectDetectionTaskHelper & TaskProviderHelper
Defined in
inference/src/lib/getProviderHelper.ts:259
▸ getProviderHelper(provider, task): ZeroShotImageClassificationTaskHelper & TaskProviderHelper
Parameters
| Name | Type |
|---|---|
provider | "baseten" | "black-forest-labs" | "cerebras" | "clarifai" | "cohere" | "fal-ai" | "featherless-ai" | "fireworks-ai" | "groq" | "hf-inference" | "hyperbolic" | "nebius" | "novita" | "nscale" | "openai" | "ovhcloud" | "publicai" | "replicate" | "sambanova" | "scaleway" | "together" | "wavespeed" | "zai-org" | "auto" |
task | "zero-shot-image-classification" |
Returns
ZeroShotImageClassificationTaskHelper & TaskProviderHelper
Defined in
inference/src/lib/getProviderHelper.ts:263
▸ getProviderHelper(provider, task): ZeroShotClassificationTaskHelper & TaskProviderHelper
Parameters
| Name | Type |
|---|---|
provider | "baseten" | "black-forest-labs" | "cerebras" | "clarifai" | "cohere" | "fal-ai" | "featherless-ai" | "fireworks-ai" | "groq" | "hf-inference" | "hyperbolic" | "nebius" | "novita" | "nscale" | "openai" | "ovhcloud" | "publicai" | "replicate" | "sambanova" | "scaleway" | "together" | "wavespeed" | "zai-org" | "auto" |
task | "zero-shot-classification" |
Returns
ZeroShotClassificationTaskHelper & TaskProviderHelper
Defined in
inference/src/lib/getProviderHelper.ts:267
▸ getProviderHelper(provider, task): ImageToImageTaskHelper & TaskProviderHelper
Parameters
| Name | Type |
|---|---|
provider | "baseten" | "black-forest-labs" | "cerebras" | "clarifai" | "cohere" | "fal-ai" | "featherless-ai" | "fireworks-ai" | "groq" | "hf-inference" | "hyperbolic" | "nebius" | "novita" | "nscale" | "openai" | "ovhcloud" | "publicai" | "replicate" | "sambanova" | "scaleway" | "together" | "wavespeed" | "zai-org" | "auto" |
task | "image-to-image" |
Returns
ImageToImageTaskHelper & TaskProviderHelper
Defined in
inference/src/lib/getProviderHelper.ts:271
▸ getProviderHelper(provider, task): ImageToVideoTaskHelper & TaskProviderHelper
Parameters
| Name | Type |
|---|---|
provider | "baseten" | "black-forest-labs" | "cerebras" | "clarifai" | "cohere" | "fal-ai" | "featherless-ai" | "fireworks-ai" | "groq" | "hf-inference" | "hyperbolic" | "nebius" | "novita" | "nscale" | "openai" | "ovhcloud" | "publicai" | "replicate" | "sambanova" | "scaleway" | "together" | "wavespeed" | "zai-org" | "auto" |
task | "image-to-video" |
Returns
ImageToVideoTaskHelper & TaskProviderHelper
Defined in
inference/src/lib/getProviderHelper.ts:275
▸ getProviderHelper(provider, task): SentenceSimilarityTaskHelper & TaskProviderHelper
Parameters
| Name | Type |
|---|---|
provider | "baseten" | "black-forest-labs" | "cerebras" | "clarifai" | "cohere" | "fal-ai" | "featherless-ai" | "fireworks-ai" | "groq" | "hf-inference" | "hyperbolic" | "nebius" | "novita" | "nscale" | "openai" | "ovhcloud" | "publicai" | "replicate" | "sambanova" | "scaleway" | "together" | "wavespeed" | "zai-org" | "auto" |
task | "sentence-similarity" |
Returns
SentenceSimilarityTaskHelper & TaskProviderHelper
Defined in
inference/src/lib/getProviderHelper.ts:279
▸ getProviderHelper(provider, task): TableQuestionAnsweringTaskHelper & TaskProviderHelper
Parameters
| Name | Type |
|---|---|
provider | "baseten" | "black-forest-labs" | "cerebras" | "clarifai" | "cohere" | "fal-ai" | "featherless-ai" | "fireworks-ai" | "groq" | "hf-inference" | "hyperbolic" | "nebius" | "novita" | "nscale" | "openai" | "ovhcloud" | "publicai" | "replicate" | "sambanova" | "scaleway" | "together" | "wavespeed" | "zai-org" | "auto" |
task | "table-question-answering" |
Returns
TableQuestionAnsweringTaskHelper & TaskProviderHelper
Defined in
inference/src/lib/getProviderHelper.ts:283
▸ getProviderHelper(provider, task): TabularClassificationTaskHelper & TaskProviderHelper
Parameters
| Name | Type |
|---|---|
provider | "baseten" | "black-forest-labs" | "cerebras" | "clarifai" | "cohere" | "fal-ai" | "featherless-ai" | "fireworks-ai" | "groq" | "hf-inference" | "hyperbolic" | "nebius" | "novita" | "nscale" | "openai" | "ovhcloud" | "publicai" | "replicate" | "sambanova" | "scaleway" | "together" | "wavespeed" | "zai-org" | "auto" |
task | "tabular-classification" |
Returns
TabularClassificationTaskHelper & TaskProviderHelper
Defined in
inference/src/lib/getProviderHelper.ts:287
▸ getProviderHelper(provider, task): TabularRegressionTaskHelper & TaskProviderHelper
Parameters
| Name | Type |
|---|---|
provider | "baseten" | "black-forest-labs" | "cerebras" | "clarifai" | "cohere" | "fal-ai" | "featherless-ai" | "fireworks-ai" | "groq" | "hf-inference" | "hyperbolic" | "nebius" | "novita" | "nscale" | "openai" | "ovhcloud" | "publicai" | "replicate" | "sambanova" | "scaleway" | "together" | "wavespeed" | "zai-org" | "auto" |
task | "tabular-regression" |
Returns
TabularRegressionTaskHelper & TaskProviderHelper
Defined in
inference/src/lib/getProviderHelper.ts:291
▸ getProviderHelper(provider, task): TokenClassificationTaskHelper & TaskProviderHelper
Parameters
| Name | Type |
|---|---|
provider | "baseten" | "black-forest-labs" | "cerebras" | "clarifai" | "cohere" | "fal-ai" | "featherless-ai" | "fireworks-ai" | "groq" | "hf-inference" | "hyperbolic" | "nebius" | "novita" | "nscale" | "openai" | "ovhcloud" | "publicai" | "replicate" | "sambanova" | "scaleway" | "together" | "wavespeed" | "zai-org" | "auto" |
task | "token-classification" |
Returns
TokenClassificationTaskHelper & TaskProviderHelper
Defined in
inference/src/lib/getProviderHelper.ts:295
▸ getProviderHelper(provider, task): TranslationTaskHelper & TaskProviderHelper
Parameters
| Name | Type |
|---|---|
provider | "baseten" | "black-forest-labs" | "cerebras" | "clarifai" | "cohere" | "fal-ai" | "featherless-ai" | "fireworks-ai" | "groq" | "hf-inference" | "hyperbolic" | "nebius" | "novita" | "nscale" | "openai" | "ovhcloud" | "publicai" | "replicate" | "sambanova" | "scaleway" | "together" | "wavespeed" | "zai-org" | "auto" |
task | "translation" |
Returns
TranslationTaskHelper & TaskProviderHelper
Defined in
inference/src/lib/getProviderHelper.ts:299
▸ getProviderHelper(provider, task): SummarizationTaskHelper & TaskProviderHelper
Parameters
| Name | Type |
|---|---|
provider | "baseten" | "black-forest-labs" | "cerebras" | "clarifai" | "cohere" | "fal-ai" | "featherless-ai" | "fireworks-ai" | "groq" | "hf-inference" | "hyperbolic" | "nebius" | "novita" | "nscale" | "openai" | "ovhcloud" | "publicai" | "replicate" | "sambanova" | "scaleway" | "together" | "wavespeed" | "zai-org" | "auto" |
task | "summarization" |
Returns
SummarizationTaskHelper & TaskProviderHelper
Defined in
inference/src/lib/getProviderHelper.ts:303
▸ getProviderHelper(provider, task): VisualQuestionAnsweringTaskHelper & TaskProviderHelper
Parameters
| Name | Type |
|---|---|
provider | "baseten" | "black-forest-labs" | "cerebras" | "clarifai" | "cohere" | "fal-ai" | "featherless-ai" | "fireworks-ai" | "groq" | "hf-inference" | "hyperbolic" | "nebius" | "novita" | "nscale" | "openai" | "ovhcloud" | "publicai" | "replicate" | "sambanova" | "scaleway" | "together" | "wavespeed" | "zai-org" | "auto" |
task | "visual-question-answering" |
Returns
VisualQuestionAnsweringTaskHelper & TaskProviderHelper
Defined in
inference/src/lib/getProviderHelper.ts:307
▸ getProviderHelper(provider, task): TaskProviderHelper
Parameters
| Name | Type |
|---|---|
provider | "baseten" | "black-forest-labs" | "cerebras" | "clarifai" | "cohere" | "fal-ai" | "featherless-ai" | "fireworks-ai" | "groq" | "hf-inference" | "hyperbolic" | "nebius" | "novita" | "nscale" | "openai" | "ovhcloud" | "publicai" | "replicate" | "sambanova" | "scaleway" | "together" | "wavespeed" | "zai-org" | "auto" |
task | undefined | InferenceTask |
Returns
TaskProviderHelper
Defined in
inference/src/lib/getProviderHelper.ts:311
imageClassification
▸ imageClassification(args, options?): Promise\<ImageClassificationOutput>
This task reads some image input and outputs the likelihood of classes. Recommended model: google/vit-base-patch16-224
Parameters
| Name | Type |
|---|---|
args | ImageClassificationArgs |
options? | Options |
Returns
Promise\<ImageClassificationOutput>
Defined in
inference/src/tasks/cv/imageClassification.ts:14
imageSegmentation
▸ imageSegmentation(args, options?): Promise\<ImageSegmentationOutput>
This task reads some image input and outputs the likelihood of classes & bounding boxes of detected objects. Recommended model: facebook/detr-resnet-50-panoptic
Parameters
| Name | Type |
|---|---|
args | ImageSegmentationArgs |
options? | Options |
Returns
Promise\<ImageSegmentationOutput>
Defined in
inference/src/tasks/cv/imageSegmentation.ts:14
imageToImage
▸ imageToImage(args, options?): Promise\<Blob>
This task reads some text input and outputs an image. Recommended model: lllyasviel/sd-controlnet-depth
Parameters
| Name | Type |
|---|---|
args | ImageToImageArgs |
options? | Options |
Returns
Promise\<Blob>
Defined in
inference/src/tasks/cv/imageToImage.ts:14
imageToText
▸ imageToText(args, options?): Promise\<ImageToTextOutput>
This task reads some image input and outputs the text caption.
Parameters
| Name | Type |
|---|---|
args | ImageToTextArgs |
options? | Options |
Returns
Promise\<ImageToTextOutput>
Defined in
inference/src/tasks/cv/imageToText.ts:13
imageToVideo
▸ imageToVideo(args, options?): Promise\<Blob>
This task reads some text input and outputs an image. Recommended model: Wan-AI/Wan2.1-I2V-14B-720P
Parameters
| Name | Type |
|---|---|
args | ImageToVideoArgs |
options? | Options |
Returns
Promise\<Blob>
Defined in
inference/src/tasks/cv/imageToVideo.ts:14
makeRequestOptions
▸ makeRequestOptions(args, providerHelper, options?): Promise\<{ info: RequestInit ; url: string }>
Helper that prepares request arguments. This async version handle the model ID resolution step.
Parameters
| Name | Type |
|---|---|
args | RequestArgs & { data?: Blob | ArrayBuffer ; stream?: boolean } |
providerHelper | TaskProviderHelper |
options? | Options & { task?: InferenceTask } |
Returns
Promise\<{ info: RequestInit ; url: string }>
Defined in
inference/src/lib/makeRequestOptions.ts:19
makeRequestOptionsFromResolvedModel
▸ makeRequestOptionsFromResolvedModel(resolvedModel, providerHelper, args, mapping, options?): Object
Helper that prepares request arguments. - for internal use only This sync version skips the model ID resolution step
Parameters
| Name | Type |
|---|---|
resolvedModel | string |
providerHelper | TaskProviderHelper |
args | RequestArgs & { data?: Blob | ArrayBuffer ; stream?: boolean } |
mapping | undefined | InferenceProviderMappingEntry |
options? | Options & { task?: InferenceTask } |
Returns
Object
| Name | Type |
|---|---|
info | RequestInit |
url | string |
Defined in
inference/src/lib/makeRequestOptions.ts:105
objectDetection
▸ objectDetection(args, options?): Promise\<ObjectDetectionOutput>
This task reads some image input and outputs the likelihood of classes & bounding boxes of detected objects. Recommended model: facebook/detr-resnet-50
Parameters
| Name | Type |
|---|---|
args | ObjectDetectionArgs |
options? | Options |
Returns
Promise\<ObjectDetectionOutput>
Defined in
inference/src/tasks/cv/objectDetection.ts:14
questionAnswering
▸ questionAnswering(args, options?): Promise\<QuestionAnsweringOutput[number]>
Want to have a nice know-it-all bot that can answer any question?. Recommended model: deepset/roberta-base-squad2
Parameters
| Name | Type |
|---|---|
args | QuestionAnsweringArgs |
options? | Options |
Returns
Promise\<QuestionAnsweringOutput[number]>
Defined in
inference/src/tasks/nlp/questionAnswering.ts:13
request
▸ request\<T>(args, options?): Promise\<T>
Primitive to make custom calls to the inference provider
Type parameters
| Name |
|---|
T |
Parameters
| Name | Type |
|---|---|
args | RequestArgs |
options? | Options & { task?: InferenceTask } |
Returns
Promise\<T>
Deprecated
Use specific task functions instead. This function will be removed in a future version.
Defined in
inference/src/tasks/custom/request.ts:11
sentenceSimilarity
▸ sentenceSimilarity(args, options?): Promise\<SentenceSimilarityOutput>
Calculate the semantic similarity between one text and a list of other sentences by comparing their embeddings.
Parameters
| Name | Type |
|---|---|
args | SentenceSimilarityArgs |
options? | Options |
Returns
Promise\<SentenceSimilarityOutput>
Defined in
inference/src/tasks/nlp/sentenceSimilarity.ts:12
setLogger
▸ setLogger(logger): void
Parameters
| Name | Type |
|---|---|
logger | Logger |
Returns
void
Defined in
streamingRequest
▸ streamingRequest\<T>(args, options?): AsyncGenerator\<T>
Primitive to make custom inference calls that expect server-sent events, and returns the response through a generator
Type parameters
| Name |
|---|
T |
Parameters
| Name | Type |
|---|---|
args | RequestArgs |
options? | Options & { task?: InferenceTask } |
Returns
AsyncGenerator\<T>
Deprecated
Use specific task functions instead. This function will be removed in a future version.
Defined in
inference/src/tasks/custom/streamingRequest.ts:11
summarization
▸ summarization(args, options?): Promise\<SummarizationOutput>
This task is well known to summarize longer text into shorter text. Be careful, some models have a maximum length of input. That means that the summary cannot handle full books for instance. Be careful when choosing your model.
Parameters
| Name | Type |
|---|---|
args | SummarizationArgs |
options? | Options |
Returns
Promise\<SummarizationOutput>
Defined in
inference/src/tasks/nlp/summarization.ts:12
tableQuestionAnswering
▸ tableQuestionAnswering(args, options?): Promise\<TableQuestionAnsweringOutput[number]>
Don’t know SQL? Don’t want to dive into a large spreadsheet? Ask questions in plain english! Recommended model: google/tapas-base-finetuned-wtq.
Parameters
| Name | Type |
|---|---|
args | TableQuestionAnsweringArgs |
options? | Options |
Returns
Promise\<TableQuestionAnsweringOutput[number]>
Defined in
inference/src/tasks/nlp/tableQuestionAnswering.ts:12
tabularClassification
▸ tabularClassification(args, options?): Promise\<TabularClassificationOutput>
Predicts target label for a given set of features in tabular form. Typically, you will want to train a classification model on your training data and use it with your new data of the same format. Example model: vvmnnnkv/wine-quality
Parameters
| Name | Type |
|---|---|
args | TabularClassificationArgs |
options? | Options |
Returns
Promise\<TabularClassificationOutput>
Defined in
inference/src/tasks/tabular/tabularClassification.ts:25
tabularRegression
▸ tabularRegression(args, options?): Promise\<TabularRegressionOutput>
Predicts target value for a given set of features in tabular form. Typically, you will want to train a regression model on your training data and use it with your new data of the same format. Example model: scikit-learn/Fish-Weight
Parameters
| Name | Type |
|---|---|
args | TabularRegressionArgs |
options? | Options |
Returns
Promise\<TabularRegressionOutput>
Defined in
inference/src/tasks/tabular/tabularRegression.ts:25
textClassification
▸ textClassification(args, options?): Promise\<TextClassificationOutput>
Usually used for sentiment-analysis this will output the likelihood of classes of an input. Recommended model: distilbert-base-uncased-finetuned-sst-2-english
Parameters
| Name | Type |
|---|---|
args | TextClassificationArgs |
options? | Options |
Returns
Promise\<TextClassificationOutput>
Defined in
inference/src/tasks/nlp/textClassification.ts:12
textGeneration
▸ textGeneration(args, options?): Promise\<TextGenerationOutput>
Use to continue text from a prompt. This is a very generic task. Recommended model: gpt2 (it’s a simple model, but fun to play with).
Parameters
| Name | Type |
|---|---|
args | BaseArgs & TextGenerationInput |
options? | Options |
Returns
Promise\<TextGenerationOutput>
Defined in
inference/src/tasks/nlp/textGeneration.ts:13
textGenerationStream
▸ textGenerationStream(args, options?): AsyncGenerator\<TextGenerationStreamOutput>
Use to continue text from a prompt. Same as textGeneration but returns generator that can be read one token at a time
Parameters
| Name | Type |
|---|---|
args | BaseArgs & TextGenerationInput |
options? | Options |
Returns
AsyncGenerator\<TextGenerationStreamOutput>
Defined in
inference/src/tasks/nlp/textGenerationStream.ts:90
textToImage
▸ textToImage(args, options?): Promise\<string>
This task reads some text input and outputs an image. Recommended model: stabilityai/stable-diffusion-2
Parameters
| Name | Type |
|---|---|
args | TextToImageArgs |
options? | TextToImageOptions & { outputType: "url" } |
Returns
Promise\<string>
Defined in
inference/src/tasks/cv/textToImage.ts:18
▸ textToImage(args, options?): Promise\<Blob>
Parameters
| Name | Type |
|---|---|
args | TextToImageArgs |
options? | TextToImageOptions & { outputType?: "blob" } |
Returns
Promise\<Blob>
Defined in
inference/src/tasks/cv/textToImage.ts:22
▸ textToImage(args, options?): Promise\<Record\<string, unknown>>
Parameters
| Name | Type |
|---|---|
args | TextToImageArgs |
options? | TextToImageOptions & { outputType?: "json" } |
Returns
Promise\<Record\<string, unknown>>
Defined in
inference/src/tasks/cv/textToImage.ts:26
textToSpeech
▸ textToSpeech(args, options?): Promise\<Blob>
This task synthesize an audio of a voice pronouncing a given text. Recommended model: espnet/kan-bayashi_ljspeech_vits
Parameters
| Name | Type |
|---|---|
args | TextToSpeechArgs |
options? | Options |
Returns
Promise\<Blob>
Defined in
inference/src/tasks/audio/textToSpeech.ts:15
textToVideo
▸ textToVideo(args, options?): Promise\<TextToVideoOutput>
Parameters
| Name | Type |
|---|---|
args | TextToVideoArgs |
options? | Options |
Returns
Promise\<TextToVideoOutput>
Defined in
inference/src/tasks/cv/textToVideo.ts:15
tokenClassification
▸ tokenClassification(args, options?): Promise\<TokenClassificationOutput>
Usually used for sentence parsing, either grammatical, or Named Entity Recognition (NER) to understand keywords contained within text. Recommended model: dbmdz/bert-large-cased-finetuned-conll03-english
Parameters
| Name | Type |
|---|---|
args | TokenClassificationArgs |
options? | Options |
Returns
Promise\<TokenClassificationOutput>
Defined in
inference/src/tasks/nlp/tokenClassification.ts:12
translation
▸ translation(args, options?): Promise\<TranslationOutput>
This task is well known to translate text from one language to another. Recommended model: Helsinki-NLP/opus-mt-ru-en.
Parameters
| Name | Type |
|---|---|
args | TranslationArgs |
options? | Options |
Returns
Promise\<TranslationOutput>
Defined in
inference/src/tasks/nlp/translation.ts:11
visualQuestionAnswering
▸ visualQuestionAnswering(args, options?): Promise\<VisualQuestionAnsweringOutput[number]>
Answers a question on an image. Recommended model: dandelin/vilt-b32-finetuned-vqa.
Parameters
| Name | Type |
|---|---|
args | VisualQuestionAnsweringArgs |
options? | Options |
Returns
Promise\<VisualQuestionAnsweringOutput[number]>
Defined in
inference/src/tasks/multimodal/visualQuestionAnswering.ts:19
zeroShotClassification
▸ zeroShotClassification(args, options?): Promise\<ZeroShotClassificationOutput>
This task is super useful to try out classification with zero code, you simply pass a sentence/paragraph and the possible labels for that sentence, and you get a result. Recommended model: facebook/bart-large-mnli.
Parameters
| Name | Type |
|---|---|
args | ZeroShotClassificationArgs |
options? | Options |
Returns
Promise\<ZeroShotClassificationOutput>
Defined in
inference/src/tasks/nlp/zeroShotClassification.ts:12
zeroShotImageClassification
▸ zeroShotImageClassification(args, options?): Promise\<ZeroShotImageClassificationOutput>
Classify an image to specified classes. Recommended model: openai/clip-vit-large-patch14-336
Parameters
| Name | Type |
|---|---|
args | ZeroShotImageClassificationArgs |
options? | Options |
Returns
Promise\<ZeroShotImageClassificationOutput>
Defined in
inference/src/tasks/cv/zeroShotImageClassification.ts:44
Update on GitHub