Huggingface.js 文件

@huggingface/inference

Hugging Face's logo
加入 Hugging Face 社群

並獲得增強的文件體驗

開始使用

@huggingface/inference

名稱空間

介面

類型別名

AudioClassificationArgs

Ƭ AudioClassificationArgs: BaseArgs & AudioClassificationInput | LegacyAudioInput

定義於

inference/src/tasks/audio/audioClassification.ts:9


AudioToAudioArgs

Ƭ AudioToAudioArgs: BaseArgs & { inputs: Blob } | LegacyAudioInput

定義於

inference/src/tasks/audio/audioToAudio.ts:8


AuthMethod

Ƭ AuthMethod: "none" | "hf-token" | "credentials-include" | "provider-key"

定義於

inference/src/types.ts:131


AutomaticSpeechRecognitionArgs

Ƭ AutomaticSpeechRecognitionArgs: BaseArgs & AutomaticSpeechRecognitionInput | LegacyAudioInput

定義於

inference/src/tasks/audio/automaticSpeechRecognition.ts:9


DocumentQuestionAnsweringArgs

Ƭ DocumentQuestionAnsweringArgs: BaseArgs & DocumentQuestionAnsweringInput & { inputs: DocumentQuestionAnsweringInputData & { image: Blob } }

定義於

inference/src/tasks/multimodal/documentQuestionAnswering.ts:13


FeatureExtractionArgs

Ƭ FeatureExtractionArgs: BaseArgs & FeatureExtractionInput & FeatureExtractionOAICompatInput

定義於

inference/src/tasks/nlp/featureExtraction.ts:12


FeatureExtractionOutput

Ƭ FeatureExtractionOutput: (number | number[] | number[][])[]

返回值為浮點型多維陣列(維度取決於您傳送的是字串還是字串列表,以及是否對您應用了自動降維,例如 mean_pooling。這應該在模型的 README 中解釋)。

定義於

inference/src/tasks/nlp/featureExtraction.ts:17


FillMaskArgs

Ƭ FillMaskArgs: BaseArgs & FillMaskInput

定義於

inference/src/tasks/nlp/fillMask.ts:7


ImageClassificationArgs

Ƭ ImageClassificationArgs: BaseArgs & ImageClassificationInput | LegacyImageInput

定義於

inference/src/tasks/cv/imageClassification.ts:8


ImageSegmentationArgs

Ƭ ImageSegmentationArgs: BaseArgs & ImageSegmentationInput

定義於

inference/src/tasks/cv/imageSegmentation.ts:8


ImageToImageArgs

Ƭ ImageToImageArgs: BaseArgs & ImageToImageInput

定義於

inference/src/tasks/cv/imageToImage.ts:8


ImageToTextArgs

Ƭ ImageToTextArgs: BaseArgs & ImageToTextInput | LegacyImageInput

定義於

inference/src/tasks/cv/imageToText.ts:9


ImageToVideoArgs

Ƭ ImageToVideoArgs: BaseArgs & ImageToVideoInput

定義於

inference/src/tasks/cv/imageToVideo.ts:8


InferenceProvider

Ƭ InferenceProvider: typeof INFERENCE_PROVIDERS[number]

定義於

inference/src/types.ts:69


InferenceProviderOrPolicy

Ƭ InferenceProviderOrPolicy: typeof PROVIDERS_OR_POLICIES[number]

定義於

inference/src/types.ts:71


InferenceTask

Ƭ InferenceTask: Exclude\<PipelineType, "other"> | "conversational"

定義於

inference/src/types.ts:45


ModelId

Ƭ ModelId: string

HF 模型 ID,例如“meta-llama/Llama-3.3-70B-Instruct”

定義於

inference/src/types.ts:6


ObjectDetectionArgs

Ƭ ObjectDetectionArgs: BaseArgs & ObjectDetectionInput | LegacyImageInput

定義於

inference/src/tasks/cv/objectDetection.ts:8


QuestionAnsweringArgs

Ƭ QuestionAnsweringArgs: BaseArgs & QuestionAnsweringInput

定義於

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> }

定義於

inference/src/types.ts:119


SentenceSimilarityArgs

Ƭ SentenceSimilarityArgs: BaseArgs & SentenceSimilarityInput

定義於

inference/src/tasks/nlp/sentenceSimilarity.ts:7


SummarizationArgs

Ƭ SummarizationArgs: BaseArgs & SummarizationInput

定義於

inference/src/tasks/nlp/summarization.ts:7


TableQuestionAnsweringArgs

Ƭ TableQuestionAnsweringArgs: BaseArgs & TableQuestionAnsweringInput

定義於

inference/src/tasks/nlp/tableQuestionAnswering.ts:7


TabularClassificationArgs

Ƭ TabularClassificationArgs: BaseArgs & { inputs: { data: Record\<string, string[]> } }

定義於

inference/src/tasks/tabular/tabularClassification.ts:6


TabularClassificationOutput

Ƭ TabularClassificationOutput: number[]

每行的預測標籤列表

定義於

inference/src/tasks/tabular/tabularClassification.ts:18


TabularRegressionArgs

Ƭ TabularRegressionArgs: BaseArgs & { inputs: { data: Record\<string, string[]> } }

定義於

inference/src/tasks/tabular/tabularRegression.ts:6


TabularRegressionOutput

Ƭ TabularRegressionOutput: number[]

每行的預測值列表

定義於

inference/src/tasks/tabular/tabularRegression.ts:18


TextClassificationArgs

Ƭ TextClassificationArgs: BaseArgs & TextClassificationInput

定義於

inference/src/tasks/nlp/textClassification.ts:7


TextGenerationStreamFinishReason

Ƭ TextGenerationStreamFinishReason: "length" | "eos_token" | "stop_sequence"

定義於

inference/src/tasks/nlp/textGenerationStream.ts:48


TextToImageArgs

Ƭ TextToImageArgs: BaseArgs & TextToImageInput

定義於

inference/src/tasks/cv/textToImage.ts:8


TextToVideoArgs

Ƭ TextToVideoArgs: BaseArgs & TextToVideoInput

定義於

inference/src/tasks/cv/textToVideo.ts:11


TextToVideoOutput

Ƭ TextToVideoOutput: Blob

定義於

inference/src/tasks/cv/textToVideo.ts:13


TokenClassificationArgs

Ƭ TokenClassificationArgs: BaseArgs & TokenClassificationInput

定義於

inference/src/tasks/nlp/tokenClassification.ts:7


TranslationArgs

Ƭ TranslationArgs: BaseArgs & TranslationInput

定義於

inference/src/tasks/nlp/translation.ts:7


VisualQuestionAnsweringArgs

Ƭ VisualQuestionAnsweringArgs: BaseArgs & VisualQuestionAnsweringInput & { inputs: VisualQuestionAnsweringInputData & { image: Blob } }

定義於

inference/src/tasks/multimodal/visualQuestionAnswering.ts:13


ZeroShotClassificationArgs

Ƭ ZeroShotClassificationArgs: BaseArgs & ZeroShotClassificationInput

定義於

inference/src/tasks/nlp/zeroShotClassification.ts:7


ZeroShotImageClassificationArgs

Ƭ ZeroShotImageClassificationArgs: BaseArgs & ZeroShotImageClassificationInput | LegacyZeroShotImageClassificationInput

定義於

inference/src/tasks/cv/zeroShotImageClassification.ts:15

變數

INFERENCE _ PROVIDERS

Const INFERENCE_PROVIDERS: 只讀 ["black-forest-labs", "cerebras", "cohere", "fal-ai", "featherless-ai", "fireworks-ai", "groq", "hf-inference", "hyperbolic", "nebius", "novita", "nscale", "openai", "ovhcloud", "replicate", "sambanova", "together"]

定義於

inference/src/types.ts:47


PROVIDERS

Const PROVIDERS: Record\<InferenceProvider, Partial\<Record\<InferenceTask, TaskProviderHelper>>>

定義於

inference/src/lib/getProviderHelper.ts:54


PROVIDERS _ OR _ POLICIES

Const PROVIDERS_OR_POLICIES: 只讀 ["black-forest-labs", "cerebras", "cohere", "fal-ai", "featherless-ai", "fireworks-ai", "groq", "hf-inference", "hyperbolic", "nebius", ""novita", "nscale", "openai", "ovhcloud", "replicate", "sambanova", "together", "auto"]

定義於

inference/src/types.ts:67

函式

audioClassification

audioClassification(args, options?): Promise\<AudioClassificationOutput>

此任務讀取音訊輸入並輸出類別的可能性。推薦模型:superb/hubert-large-superb-er

引數

名稱 型別
args AudioClassificationArgs
options? Options

返回值

Promise\<AudioClassificationOutput>

定義於

inference/src/tasks/audio/audioClassification.ts:15


audioToAudio

audioToAudio(args, options?): Promise\<AudioToAudioOutput[]>

此任務讀取音訊輸入並輸出一個或多個音訊檔案。示例模型:speechbrain/sepformer-wham 進行音訊源分離。

引數

名稱 型別
args AudioToAudioArgs
options? Options

返回值

Promise\<AudioToAudioOutput[]>

定義於

inference/src/tasks/audio/audioToAudio.ts:39


automaticSpeechRecognition

automaticSpeechRecognition(args, options?): Promise\<AutomaticSpeechRecognitionOutput>

此任務讀取音訊輸入並輸出音訊檔案中的口語單詞。推薦模型(英語):facebook/wav2vec2-large-960h-lv60-self

引數

名稱 型別
args AutomaticSpeechRecognitionArgs
options? Options

返回值

Promise\<AutomaticSpeechRecognitionOutput>

定義於

inference/src/tasks/audio/automaticSpeechRecognition.ts:14


chatCompletion

chatCompletion(args, options?): Promise\<ChatCompletionOutput>

使用聊天完成端點生成對提示的響應,使用 OpenAI 訊息完成 API,無流

引數

名稱 型別
args BaseArgs & ChatCompletionInput
options? Options

返回值

Promise\<ChatCompletionOutput>

定義於

inference/src/tasks/nlp/chatCompletion.ts:10


chatCompletionStream

chatCompletionStream(args, options?): AsyncGenerator\<ChatCompletionStreamOutput>

用於從提示繼續文字。與 textGeneration 相同,但返回一個可一次讀取一個 token 的生成器

引數

名稱 型別
args BaseArgs & ChatCompletionInput
options? Options

返回值

AsyncGenerator\<ChatCompletionStreamOutput>

定義於

inference/src/tasks/nlp/chatCompletionStream.ts:10


documentQuestionAnswering

documentQuestionAnswering(args, options?): Promise\<DocumentQuestionAnsweringOutput[number]>

回答文件影像上的問題。推薦模型:impira/layoutlm-document-qa。

引數

名稱 型別
args DocumentQuestionAnsweringArgs
options? Options

返回值

Promise\<DocumentQuestionAnsweringOutput[number]>

定義於

inference/src/tasks/multimodal/documentQuestionAnswering.ts:19


featureExtraction

featureExtraction(args, options?): Promise\<FeatureExtractionOutput>

此任務讀取一些文字並輸出原始浮點值,這些值通常作為語義資料庫/語義搜尋的一部分被使用。

引數

名稱 型別
args FeatureExtractionArgs
options? Options

返回值

Promise\<FeatureExtractionOutput>

定義於

inference/src/tasks/nlp/featureExtraction.ts:22


fillMask

fillMask(args, options?): Promise\<FillMaskOutput>

嘗試用缺失的單詞(準確地說是標記)填充空白。這是 BERT 模型的基本任務。

引數

名稱 型別
args FillMaskArgs
options? Options

返回

Promise\<FillMaskOutput>

定義於

inference/src/tasks/nlp/fillMask.ts:12


getProviderHelper

getProviderHelper(provider, task): TextToImageTaskHelper & TaskProviderHelper

透過名稱和任務獲取提供者輔助例項

引數

名稱 型別
提供者 "black-forest-labs" | "cerebras" | "cohere" | "fal-ai" | "featherless-ai" | "fireworks-ai" | "groq" | "hf-inference" | "hyperbolic" | "nebius" | "novita" | "nscale" | "openai" | "ovhcloud" | "replicate" | "sambanova" | "together" | "auto"
任務 "text-to-image"

返回

TextToImageTaskHelper & TaskProviderHelper

定義於

inference/src/lib/getProviderHelper.ts:161

getProviderHelper(provider, task): ConversationalTaskHelper & TaskProviderHelper

引數

名稱 型別
提供者 "black-forest-labs" | "cerebras" | "cohere" | "fal-ai" | "featherless-ai" | "fireworks-ai" | "groq" | "hf-inference" | "hyperbolic" | "nebius" | "novita" | "nscale" | "openai" | "ovhcloud" | "replicate" | "sambanova" | "together" | "auto"
任務 "conversational"

返回

ConversationalTaskHelper & TaskProviderHelper

定義於

inference/src/lib/getProviderHelper.ts:165

getProviderHelper(provider, task): TextGenerationTaskHelper & TaskProviderHelper

引數

名稱 型別
提供者 "black-forest-labs" | "cerebras" | "cohere" | "fal-ai" | "featherless-ai" | "fireworks-ai" | "groq" | "hf-inference" | "hyperbolic" | "nebius" | "novita" | "nscale" | "openai" | "ovhcloud" | "replicate" | "sambanova" | "together" | "auto"
任務 "text-generation"

返回

TextGenerationTaskHelper & TaskProviderHelper

定義於

inference/src/lib/getProviderHelper.ts:169

getProviderHelper(provider, task): TextToSpeechTaskHelper & TaskProviderHelper

引數

名稱 型別
提供者 "black-forest-labs" | "cerebras" | "cohere" | "fal-ai" | "featherless-ai" | "fireworks-ai" | "groq" | "hf-inference" | "hyperbolic" | "nebius" | "novita" | "nscale" | "openai" | "ovhcloud" | "replicate" | "sambanova" | "together" | "auto"
任務 "text-to-speech"

返回

TextToSpeechTaskHelper & TaskProviderHelper

定義於

inference/src/lib/getProviderHelper.ts:173

getProviderHelper(provider, task): TextToAudioTaskHelper & TaskProviderHelper

引數

名稱 型別
提供者 "black-forest-labs" | "cerebras" | "cohere" | "fal-ai" | "featherless-ai" | "fireworks-ai" | "groq" | "hf-inference" | "hyperbolic" | "nebius" | "novita" | "nscale" | "openai" | "ovhcloud" | "replicate" | "sambanova" | "together" | "auto"
任務 "text-to-audio"

返回

TextToAudioTaskHelper & TaskProviderHelper

定義於

inference/src/lib/getProviderHelper.ts:177

getProviderHelper(provider, task): AutomaticSpeechRecognitionTaskHelper & TaskProviderHelper

引數

名稱 型別
提供者 "black-forest-labs" | "cerebras" | "cohere" | "fal-ai" | "featherless-ai" | "fireworks-ai" | "groq" | "hf-inference" | "hyperbolic" | "nebius" | "novita" | "nscale" | "openai" | "ovhcloud" | "replicate" | "sambanova" | "together" | "auto"
任務 "automatic-speech-recognition"

返回

AutomaticSpeechRecognitionTaskHelper & TaskProviderHelper

定義於

inference/src/lib/getProviderHelper.ts:181

getProviderHelper(provider, task): TextToVideoTaskHelper & TaskProviderHelper

引數

名稱 型別
提供者 "black-forest-labs" | "cerebras" | "cohere" | "fal-ai" | "featherless-ai" | "fireworks-ai" | "groq" | "hf-inference" | "hyperbolic" | "nebius" | "novita" | "nscale" | "openai" | "ovhcloud" | "replicate" | "sambanova" | "together" | "auto"
任務 "text-to-video"

返回

TextToVideoTaskHelper & TaskProviderHelper

定義於

inference/src/lib/getProviderHelper.ts:185

getProviderHelper(provider, task): TextClassificationTaskHelper & TaskProviderHelper

引數

名稱 型別
提供者 "black-forest-labs" | "cerebras" | "cohere" | "fal-ai" | "featherless-ai" | "fireworks-ai" | "groq" | "hf-inference" | "hyperbolic" | "nebius" | "novita" | "nscale" | "openai" | "ovhcloud" | "replicate" | "sambanova" | "together" | "auto"
任務 "text-classification"

返回

TextClassificationTaskHelper & TaskProviderHelper

定義於

inference/src/lib/getProviderHelper.ts:189

getProviderHelper(provider, task): QuestionAnsweringTaskHelper & TaskProviderHelper

引數

名稱 型別
提供者 "black-forest-labs" | "cerebras" | "cohere" | "fal-ai" | "featherless-ai" | "fireworks-ai" | "groq" | "hf-inference" | "hyperbolic" | "nebius" | "novita" | "nscale" | "openai" | "ovhcloud" | "replicate" | "sambanova" | "together" | "auto"
任務 "question-answering"

返回

QuestionAnsweringTaskHelper & TaskProviderHelper

定義於

inference/src/lib/getProviderHelper.ts:193

getProviderHelper(provider, task): AudioClassificationTaskHelper & TaskProviderHelper

引數

名稱 型別
提供者 "black-forest-labs" | "cerebras" | "cohere" | "fal-ai" | "featherless-ai" | "fireworks-ai" | "groq" | "hf-inference" | "hyperbolic" | "nebius" | "novita" | "nscale" | "openai" | "ovhcloud" | "replicate" | "sambanova" | "together" | "auto"
任務 "audio-classification"

返回

AudioClassificationTaskHelper & TaskProviderHelper

定義於

inference/src/lib/getProviderHelper.ts:197

getProviderHelper(provider, task): AudioToAudioTaskHelper & TaskProviderHelper

引數

名稱 型別
提供者 "black-forest-labs" | "cerebras" | "cohere" | "fal-ai" | "featherless-ai" | "fireworks-ai" | "groq" | "hf-inference" | "hyperbolic" | "nebius" | "novita" | "nscale" | "openai" | "ovhcloud" | "replicate" | "sambanova" | "together" | "auto"
任務 "audio-to-audio"

返回

AudioToAudioTaskHelper & TaskProviderHelper

定義於

inference/src/lib/getProviderHelper.ts:201

getProviderHelper(provider, task): FillMaskTaskHelper & TaskProviderHelper

引數

名稱 型別
提供者 "black-forest-labs" | "cerebras" | "cohere" | "fal-ai" | "featherless-ai" | "fireworks-ai" | "groq" | "hf-inference" | "hyperbolic" | "nebius" | "novita" | "nscale" | "openai" | "ovhcloud" | "replicate" | "sambanova" | "together" | "auto"
任務 "fill-mask"

返回

FillMaskTaskHelper & TaskProviderHelper

定義於

inference/src/lib/getProviderHelper.ts:205

getProviderHelper(provider, task): FeatureExtractionTaskHelper & TaskProviderHelper

引數

名稱 型別
提供者 "black-forest-labs" | "cerebras" | "cohere" | "fal-ai" | "featherless-ai" | "fireworks-ai" | "groq" | "hf-inference" | "hyperbolic" | "nebius" | "novita" | "nscale" | "openai" | "ovhcloud" | "replicate" | "sambanova" | "together" | "auto"
任務 "feature-extraction"

返回

FeatureExtractionTaskHelper & TaskProviderHelper

定義於

inference/src/lib/getProviderHelper.ts:209

getProviderHelper(provider, task): ImageClassificationTaskHelper & TaskProviderHelper

引數

名稱 型別
提供者 "black-forest-labs" | "cerebras" | "cohere" | "fal-ai" | "featherless-ai" | "fireworks-ai" | "groq" | "hf-inference" | "hyperbolic" | "nebius" | "novita" | "nscale" | "openai" | "ovhcloud" | "replicate" | "sambanova" | "together" | "auto"
任務 "image-classification"

返回

ImageClassificationTaskHelper & TaskProviderHelper

定義於

inference/src/lib/getProviderHelper.ts:213

getProviderHelper(provider, task): ImageSegmentationTaskHelper & TaskProviderHelper

引數

名稱 型別
提供者 "black-forest-labs" | "cerebras" | "cohere" | "fal-ai" | "featherless-ai" | "fireworks-ai" | "groq" | "hf-inference" | "hyperbolic" | "nebius" | "novita" | "nscale" | "openai" | "ovhcloud" | "replicate" | "sambanova" | "together" | "auto"
任務 "image-segmentation"

返回

ImageSegmentationTaskHelper & TaskProviderHelper

定義於

inference/src/lib/getProviderHelper.ts:217

getProviderHelper(provider, task): DocumentQuestionAnsweringTaskHelper & TaskProviderHelper

引數

名稱 型別
提供者 "black-forest-labs" | "cerebras" | "cohere" | "fal-ai" | "featherless-ai" | "fireworks-ai" | "groq" | "hf-inference" | "hyperbolic" | "nebius" | "novita" | "nscale" | "openai" | "ovhcloud" | "replicate" | "sambanova" | "together" | "auto"
任務 "document-question-answering"

返回

DocumentQuestionAnsweringTaskHelper & TaskProviderHelper

定義於

inference/src/lib/getProviderHelper.ts:221

getProviderHelper(provider, task): ImageToTextTaskHelper & TaskProviderHelper

引數

名稱 型別
提供者 "black-forest-labs" | "cerebras" | "cohere" | "fal-ai" | "featherless-ai" | "fireworks-ai" | "groq" | "hf-inference" | "hyperbolic" | "nebius" | "novita" | "nscale" | "openai" | "ovhcloud" | "replicate" | "sambanova" | "together" | "auto"
任務 "image-to-text"

返回

ImageToTextTaskHelper & TaskProviderHelper

定義於

inference/src/lib/getProviderHelper.ts:225

getProviderHelper(provider, task): ObjectDetectionTaskHelper & TaskProviderHelper

引數

名稱 型別
提供者 "black-forest-labs" | "cerebras" | "cohere" | "fal-ai" | "featherless-ai" | "fireworks-ai" | "groq" | "hf-inference" | "hyperbolic" | "nebius" | "novita" | "nscale" | "openai" | "ovhcloud" | "replicate" | "sambanova" | "together" | "auto"
任務 "object-detection"

返回

ObjectDetectionTaskHelper & TaskProviderHelper

定義於

inference/src/lib/getProviderHelper.ts:229

getProviderHelper(provider, task): ZeroShotImageClassificationTaskHelper & TaskProviderHelper

引數

名稱 型別
提供者 "black-forest-labs" | "cerebras" | "cohere" | "fal-ai" | "featherless-ai" | "fireworks-ai" | "groq" | "hf-inference" | "hyperbolic" | "nebius" | "novita" | "nscale" | "openai" | "ovhcloud" | "replicate" | "sambanova" | "together" | "auto"
任務 "zero-shot-image-classification"

返回

ZeroShotImageClassificationTaskHelper & TaskProviderHelper

定義於

inference/src/lib/getProviderHelper.ts:233

getProviderHelper(provider, task): ZeroShotClassificationTaskHelper & TaskProviderHelper

引數

名稱 型別
提供者 "black-forest-labs" | "cerebras" | "cohere" | "fal-ai" | "featherless-ai" | "fireworks-ai" | "groq" | "hf-inference" | "hyperbolic" | "nebius" | "novita" | "nscale" | "openai" | "ovhcloud" | "replicate" | "sambanova" | "together" | "auto"
任務 "zero-shot-classification"

返回

ZeroShotClassificationTaskHelper & TaskProviderHelper

定義於

inference/src/lib/getProviderHelper.ts:237

getProviderHelper(provider, task): ImageToImageTaskHelper & TaskProviderHelper

引數

名稱 型別
提供者 "black-forest-labs" | "cerebras" | "cohere" | "fal-ai" | "featherless-ai" | "fireworks-ai" | "groq" | "hf-inference" | "hyperbolic" | "nebius" | "novita" | "nscale" | "openai" | "ovhcloud" | "replicate" | "sambanova" | "together" | "auto"
任務 "image-to-image"

返回

ImageToImageTaskHelper & TaskProviderHelper

定義於

inference/src/lib/getProviderHelper.ts:241

getProviderHelper(provider, task): ImageToVideoTaskHelper & TaskProviderHelper

引數

名稱 型別
提供者 "black-forest-labs" | "cerebras" | "cohere" | "fal-ai" | "featherless-ai" | "fireworks-ai" | "groq" | "hf-inference" | "hyperbolic" | "nebius" | "novita" | "nscale" | "openai" | "ovhcloud" | "replicate" | "sambanova" | "together" | "auto"
任務 "image-to-video"

返回

ImageToVideoTaskHelper & TaskProviderHelper

定義於

inference/src/lib/getProviderHelper.ts:245

getProviderHelper(provider, task): SentenceSimilarityTaskHelper & TaskProviderHelper

引數

名稱 型別
提供者 "black-forest-labs" | "cerebras" | "cohere" | "fal-ai" | "featherless-ai" | "fireworks-ai" | "groq" | "hf-inference" | "hyperbolic" | "nebius" | "novita" | "nscale" | "openai" | "ovhcloud" | "replicate" | "sambanova" | "together" | "auto"
任務 "sentence-similarity"

返回

SentenceSimilarityTaskHelper & TaskProviderHelper

定義於

inference/src/lib/getProviderHelper.ts:249

getProviderHelper(provider, task): TableQuestionAnsweringTaskHelper & TaskProviderHelper

引數

名稱 型別
提供者 "black-forest-labs" | "cerebras" | "cohere" | "fal-ai" | "featherless-ai" | "fireworks-ai" | "groq" | "hf-inference" | "hyperbolic" | "nebius" | "novita" | "nscale" | "openai" | "ovhcloud" | "replicate" | "sambanova" | "together" | "auto"
任務 "table-question-answering"

返回

TableQuestionAnsweringTaskHelper & TaskProviderHelper

定義於

inference/src/lib/getProviderHelper.ts:253

getProviderHelper(provider, task): TabularClassificationTaskHelper & TaskProviderHelper

引數

名稱 型別
提供者 "black-forest-labs" | "cerebras" | "cohere" | "fal-ai" | "featherless-ai" | "fireworks-ai" | "groq" | "hf-inference" | "hyperbolic" | "nebius" | "novita" | "nscale" | "openai" | "ovhcloud" | "replicate" | "sambanova" | "together" | "auto"
任務 "tabular-classification"

返回

TabularClassificationTaskHelper & TaskProviderHelper

定義於

inference/src/lib/getProviderHelper.ts:257

getProviderHelper(provider, task): TabularRegressionTaskHelper & TaskProviderHelper

引數

名稱 型別
提供者 "black-forest-labs" | "cerebras" | "cohere" | "fal-ai" | "featherless-ai" | "fireworks-ai" | "groq" | "hf-inference" | "hyperbolic" | "nebius" | "novita" | "nscale" | "openai" | "ovhcloud" | "replicate" | "sambanova" | "together" | "auto"
任務 "tabular-regression"

返回

TabularRegressionTaskHelper & TaskProviderHelper

定義於

inference/src/lib/getProviderHelper.ts:261

getProviderHelper(provider, task): TokenClassificationTaskHelper & TaskProviderHelper

引數

名稱 型別
提供者 "black-forest-labs" | "cerebras" | "cohere" | "fal-ai" | "featherless-ai" | "fireworks-ai" | "groq" | "hf-inference" | "hyperbolic" | "nebius" | "novita" | "nscale" | "openai" | "ovhcloud" | "replicate" | "sambanova" | "together" | "auto"
任務 "token-classification"

返回

TokenClassificationTaskHelper & TaskProviderHelper

定義於

inference/src/lib/getProviderHelper.ts:265

getProviderHelper(provider, task): TranslationTaskHelper & TaskProviderHelper

引數

名稱 型別
提供者 "black-forest-labs" | "cerebras" | "cohere" | "fal-ai" | "featherless-ai" | "fireworks-ai" | "groq" | "hf-inference" | "hyperbolic" | "nebius" | "novita" | "nscale" | "openai" | "ovhcloud" | "replicate" | "sambanova" | "together" | "auto"
任務 "translation"

返回

TranslationTaskHelper & TaskProviderHelper

定義於

inference/src/lib/getProviderHelper.ts:269

getProviderHelper(provider, task): SummarizationTaskHelper & TaskProviderHelper

引數

名稱 型別
提供者 "black-forest-labs" | "cerebras" | "cohere" | "fal-ai" | "featherless-ai" | "fireworks-ai" | "groq" | "hf-inference" | "hyperbolic" | "nebius" | "novita" | "nscale" | "openai" | "ovhcloud" | "replicate" | "sambanova" | "together" | "auto"
任務 "summarization"

返回

SummarizationTaskHelper & TaskProviderHelper

定義於

inference/src/lib/getProviderHelper.ts:273

getProviderHelper(provider, task): VisualQuestionAnsweringTaskHelper & TaskProviderHelper

引數

名稱 型別
提供者 "black-forest-labs" | "cerebras" | "cohere" | "fal-ai" | "featherless-ai" | "fireworks-ai" | "groq" | "hf-inference" | "hyperbolic" | "nebius" | "novita" | "nscale" | "openai" | "ovhcloud" | "replicate" | "sambanova" | "together" | "auto"
任務 "visual-question-answering"

返回

VisualQuestionAnsweringTaskHelper & TaskProviderHelper

定義於

inference/src/lib/getProviderHelper.ts:277

getProviderHelper(provider, task): TaskProviderHelper

引數

名稱 型別
提供者 "black-forest-labs" | "cerebras" | "cohere" | "fal-ai" | "featherless-ai" | "fireworks-ai" | "groq" | "hf-inference" | "hyperbolic" | "nebius" | "novita" | "nscale" | "openai" | "ovhcloud" | "replicate" | "sambanova" | "together" | "auto"
任務 undefined | InferenceTask

返回

TaskProviderHelper

定義於

inference/src/lib/getProviderHelper.ts:281


imageClassification

imageClassification(args, options?): Promise\<ImageClassificationOutput>

此任務讀取影像輸入並輸出類別的可能性。推薦模型:google/vit-base-patch16-224

引數

名稱 型別
args ImageClassificationArgs
options? Options

返回

Promise\<ImageClassificationOutput>

定義於

inference/src/tasks/cv/imageClassification.ts:14


imageSegmentation

imageSegmentation(args, options?): Promise\<ImageSegmentationOutput>

此任務讀取影像輸入並輸出檢測到物件的類別可能性和邊界框。推薦模型:facebook/detr-resnet-50-panoptic

引數

名稱 型別
args ImageSegmentationArgs
options? Options

返回

Promise\<ImageSegmentationOutput>

定義於

inference/src/tasks/cv/imageSegmentation.ts:14


imageToImage

imageToImage(args, options?): Promise\<Blob>

此任務讀取文字輸入並輸出影像。推薦模型:lllyasviel/sd-controlnet-depth

引數

名稱 型別
args ImageToImageArgs
options? Options

返回

Promise\<Blob>

定義於

inference/src/tasks/cv/imageToImage.ts:14


imageToText

imageToText(args, options?): Promise\<ImageToTextOutput>

此任務讀取影像輸入並輸出文字描述。

引數

名稱 型別
args ImageToTextArgs
options? Options

返回

Promise\<ImageToTextOutput>

定義於

inference/src/tasks/cv/imageToText.ts:13


imageToVideo

imageToVideo(args, options?): Promise\<Blob>

此任務讀取文字輸入並輸出影像。推薦模型:Wan-AI/Wan2.1-I2V-14B-720P

引數

名稱 型別
args ImageToVideoArgs
options? Options

返回

Promise\<Blob>

定義於

inference/src/tasks/cv/imageToVideo.ts:14


makeRequestOptions

makeRequestOptions(args, providerHelper, options?): Promise\<{ info: RequestInit ; url: string }>

輔助函式,用於準備請求引數。此非同步版本處理模型 ID 解析步驟。

引數

名稱 型別
args RequestArgs & { data?: Blob | ArrayBuffer ; stream?: boolean }
providerHelper TaskProviderHelper
options? Options & { task?: InferenceTask }

返回

Promise\<{ info: RequestInit ; url: string }>

定義於

inference/src/lib/makeRequestOptions.ts:19


makeRequestOptionsFromResolvedModel

makeRequestOptionsFromResolvedModel(resolvedModel, providerHelper, args, mapping, options?): Object

輔助函式,用於準備請求引數。- 僅供內部使用。此同步版本跳過模型 ID 解析步驟。

引數

名稱 型別
resolvedModel 字串
providerHelper TaskProviderHelper
args RequestArgs & { data?: Blob | ArrayBuffer ; stream?: boolean }
mapping undefined | InferenceProviderMappingEntry
options? Options & { task?: InferenceTask }

返回

Object

名稱 型別
info RequestInit
url 字串

定義於

inference/src/lib/makeRequestOptions.ts:105


objectDetection

objectDetection(args, options?): Promise\<ObjectDetectionOutput>

此任務讀取影像輸入並輸出檢測到物件的類別可能性和邊界框。推薦模型:facebook/detr-resnet-50

引數

名稱 型別
args ObjectDetectionArgs
options? Options

返回

Promise\<ObjectDetectionOutput>

定義於

inference/src/tasks/cv/objectDetection.ts:14


questionAnswering

questionAnswering(args, options?): Promise\<QuestionAnsweringOutput[number]>

想要一個無所不知的機器人,可以回答任何問題?推薦模型:deepset/roberta-base-squad2

引數

名稱 型別
args QuestionAnsweringArgs
options? Options

返回

Promise\<QuestionAnsweringOutput[number]>

定義於

inference/src/tasks/nlp/questionAnswering.ts:13


request

request\<T>(args, options?): Promise\<T>

用於向推理提供者進行自定義呼叫的原語

型別引數

名稱
T

引數

名稱 型別
args RequestArgs
options? Options & { task?: InferenceTask }

返回

Promise\<T>

已棄用

請改用特定的任務函式。此函式將在未來版本中移除。

定義於

inference/src/tasks/custom/request.ts:11


sentenceSimilarity

sentenceSimilarity(args, options?): Promise\<SentenceSimilarityOutput>

透過比較嵌入來計算一段文字與另一組句子之間的語義相似度。

引數

名稱 型別
args SentenceSimilarityArgs
options? Options

返回

Promise\<SentenceSimilarityOutput>

定義於

inference/src/tasks/nlp/sentenceSimilarity.ts:12


setLogger

setLogger(logger): void

引數

名稱 型別
logger Logger

返回

定義於

inference/src/lib/logger.ts:5


streamingRequest

streamingRequest\<T>(args, options?): AsyncGenerator\<T>

用於進行自定義推理呼叫的原語,該呼叫期望伺服器傳送事件,並透過生成器返回響應

型別引數

名稱
T

引數

名稱 型別
args RequestArgs
options? Options & { task?: InferenceTask }

返回

AsyncGenerator\<T>

已棄用

請改用特定的任務函式。此函式將在未來版本中移除。

定義於

inference/src/tasks/custom/streamingRequest.ts:11


summarization

summarization(args, options?): Promise\<SummarizationOutput>

此任務以將較長文字總結為較短文字而聞名。請注意,某些模型的輸入長度有最大限制。這意味著摘要無法處理完整的書籍等。選擇模型時請謹慎。

引數

名稱 型別
args SummarizationArgs
options? Options

返回

Promise\<SummarizationOutput>

定義於

inference/src/tasks/nlp/summarization.ts:12


tableQuestionAnswering

tableQuestionAnswering(args, options?): Promise\<TableQuestionAnsweringOutput[number]\>

不懂SQL?不想深入研究大型電子表格?用普通英語提問!推薦模型:google/tapas-base-finetuned-wtq。

引數

名稱 型別
args TableQuestionAnsweringArgs
options? Options

返回

Promise\<TableQuestionAnsweringOutput[number]\>

定義於

inference/src/tasks/nlp/tableQuestionAnswering.ts:12


tabularClassification

tabularClassification(args, options?): Promise\<TabularClassificationOutput\>

根據給定的表格形式特徵集預測目標標籤。通常,您會希望在訓練資料上訓練一個分類模型,並將其與相同格式的新資料一起使用。示例模型:vvmnnnkv/wine-quality

引數

名稱 型別
args TabularClassificationArgs
options? Options

返回

Promise\<TabularClassificationOutput\>

定義於

inference/src/tasks/tabular/tabularClassification.ts:25


tabularRegression

tabularRegression(args, options?): Promise\<TabularRegressionOutput\>

為給定表格形式的特徵集預測目標值。通常,您會希望在訓練資料上訓練迴歸模型,並將其與格式相同的新資料一起使用。示例模型:scikit-learn/Fish-Weight

引數

名稱 型別
args TabularRegressionArgs
options? Options

返回

Promise\<TabularRegressionOutput\>

定義於

inference/src/tasks/tabular/tabularRegression.ts:25


textClassification

textClassification(args, options?): Promise\<TextClassificationOutput\>

通常用於情感分析,它將輸出輸入類的可能性。推薦模型:distilbert-base-uncased-finetuned-sst-2-english

引數

名稱 型別
args TextClassificationArgs
options? Options

返回

Promise\<TextClassificationOutput\>

定義於

inference/src/tasks/nlp/textClassification.ts:12


textGeneration

textGeneration(args, options?): Promise\<TextGenerationOutput\>

用於從提示符繼續文字。這是一個非常通用的任務。推薦模型:gpt2(一個簡單的模型,但很有趣)。

引數

名稱 型別
args BaseArgs \& TextGenerationInput
options? Options

返回

Promise\<TextGenerationOutput\>

定義於

inference/src/tasks/nlp/textGeneration.ts:13


textGenerationStream

textGenerationStream(args, options?): AsyncGenerator\<TextGenerationStreamOutput\>

用於從提示繼續文字。與 textGeneration 相同,但返回一個可一次讀取一個 token 的生成器

引數

名稱 型別
args BaseArgs \& TextGenerationInput
options? Options

返回

AsyncGenerator\<TextGenerationStreamOutput\>

定義於

inference/src/tasks/nlp/textGenerationStream.ts:90


textToImage

textToImage(args, options?): Promise\<string\>

此任務讀取一些文字輸入並輸出影像。推薦模型:stabilityai/stable-diffusion-2

引數

名稱 型別
args TextToImageArgs
options? TextToImageOptions \& { outputType: "url" }

返回

Promise\<string\>

定義於

inference/src/tasks/cv/textToImage.ts:18

textToImage(args, options?): Promise\<Blob\>

引數

名稱 型別
args TextToImageArgs
options? TextToImageOptions \& { outputType?: "blob" }

返回

Promise\<Blob>

定義於

inference/src/tasks/cv/textToImage.ts:22

textToImage(args, options?): Promise\<Record\<string, unknown\>\>

引數

名稱 型別
args TextToImageArgs
options? TextToImageOptions \& { outputType?: "json" }

返回

Promise\<Record\<string, unknown\>\>

定義於

inference/src/tasks/cv/textToImage.ts:26


textToSpeech

textToSpeech(args, options?): Promise\<Blob\>

此任務合成語音音訊,發出給定文字。推薦模型:espnet/kan-bayashi_ljspeech_vits

引數

名稱 型別
args TextToSpeechArgs
options? Options

返回

Promise\<Blob>

定義於

inference/src/tasks/audio/textToSpeech.ts:15


textToVideo

textToVideo(args, options?): Promise\<TextToVideoOutput\>

引數

名稱 型別
args TextToVideoArgs
options? Options

返回

Promise\<TextToVideoOutput\>

定義於

inference/src/tasks/cv/textToVideo.ts:15


tokenClassification

tokenClassification(args, options?): Promise\<TokenClassificationOutput\>

通常用於句子解析,可以是語法分析,也可以是命名實體識別(NER)以理解文字中包含的關鍵詞。推薦模型:dbmdz/bert-large-cased-finetuned-conll03-english

引數

名稱 型別
args TokenClassificationArgs
options? Options

返回

Promise\<TokenClassificationOutput\>

定義於

inference/src/tasks/nlp/tokenClassification.ts:12


translation

translation(args, options?): Promise\<TranslationOutput\>

此任務眾所周知可將文字從一種語言翻譯成另一種語言。推薦模型:Helsinki-NLP/opus-mt-ru-en。

引數

名稱 型別
args TranslationArgs
options? Options

返回

Promise\<TranslationOutput\>

定義於

inference/src/tasks/nlp/translation.ts:11


visualQuestionAnswering

visualQuestionAnswering(args, options?): Promise\<VisualQuestionAnsweringOutput[number]\>

回答影像上的問題。推薦模型:dandelin/vilt-b32-finetuned-vqa。

引數

名稱 型別
args VisualQuestionAnsweringArgs
options? Options

返回

Promise\<VisualQuestionAnsweringOutput[number]\>

定義於

inference/src/tasks/multimodal/visualQuestionAnswering.ts:19


zeroShotClassification

zeroShotClassification(args, options?): Promise\<ZeroShotClassificationOutput\>

此任務在零程式碼的情況下進行分類非常有用,您只需傳遞一個句子/段落和該句子的可能標籤,即可獲得結果。推薦模型:facebook/bart-large-mnli。

引數

名稱 型別
args ZeroShotClassificationArgs
options? Options

返回

Promise\<ZeroShotClassificationOutput\>

定義於

inference/src/tasks/nlp/zeroShotClassification.ts:12


zeroShotImageClassification

zeroShotImageClassification(args, options?): Promise\<ZeroShotImageClassificationOutput\>

將影像分類到指定的類別中。推薦模型:openai/clip-vit-large-patch14-336

引數

名稱 型別
args ZeroShotImageClassificationArgs
options? Options

返回

Promise\<ZeroShotImageClassificationOutput\>

定義於

inference/src/tasks/cv/zeroShotImageClassification.ts:44

< > 在 GitHub 上更新

© . This site is unofficial and not affiliated with Hugging Face, Inc.