# Classe : InferenceClient

## Hiérarchie

- `Task`

  ↳ **`InferenceClient`**

  ↳↳ [`InferenceClientEndpoint`](InferenceClientEndpoint)

  ↳↳ [`HfInference`](HfInference)

## Constructeurs

### constructor

• **new InferenceClient**(`accessToken?`, `defaultOptions?`) : [`InferenceClient`](InferenceClient)

#### Paramètres[[constructor.parameters]]

| Nom | Type | Valeur par défaut |
| :------ | :------ | :------ |
| `accessToken` | `string` | `""` |
| `defaultOptions` | [`Options`](../interfaces/Options) & \{ `endpointUrl?`: `string`  } | `{}` |

#### Retourne[[constructor.returns]]

[`InferenceClient`](InferenceClient)

#### Défini dans[[constructor.defined-in]]

[inference/src/InferenceClient.ts:15](https://github.com/huggingface/huggingface.js/blob/main/packages/inference/src/InferenceClient.ts#L15)

## Propriétés

### accessToken

• `Private` `Readonly` **accessToken** : `string`

#### Défini dans[[accesstoken.defined-in]]

[inference/src/InferenceClient.ts:12](https://github.com/huggingface/huggingface.js/blob/main/packages/inference/src/InferenceClient.ts#L12)

___

### defaultOptions

• `Private` `Readonly` **defaultOptions** : [`Options`](../interfaces/Options)

#### Défini dans[[defaultoptions.defined-in]]

[inference/src/InferenceClient.ts:13](https://github.com/huggingface/huggingface.js/blob/main/packages/inference/src/InferenceClient.ts#L13)

## Méthodes

### audioClassification

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

Cette tâche lit une entrée audio et sort la probabilité de classes. Modèle recommandé : superb/hubert-large-superb-er

#### Paramètres[[audioclassification.parameters]]

| Nom | Type |
| :------ | :------ |
| `args` | [`AudioClassificationArgs`](../modules#audioclassificationargs) |
| `options?` | [`Options`](../interfaces/Options) |

#### Retourne[[audioclassification.returns]]

`Promise`\<`AudioClassificationOutput`\>

#### Défini dans[[audioclassification.defined-in]]

[inference/src/tasks/audio/audioClassification.ts:15](https://github.com/huggingface/huggingface.js/blob/main/packages/inference/src/tasks/audio/audioClassification.ts#L15)

___

### audioToAudio

▸ **audioToAudio**(`args`, `options?`) : `Promise`\<[`AudioToAudioOutput`](../interfaces/AudioToAudioOutput)[]\>

Cette tâche lit une entrée audio et produit un ou plusieurs fichiers audio. Modèle d’exemple : speechbrain/sepformer-wham effectue la séparation des sources audio.

#### Paramètres[[audiotoaudio.parameters]]

| Nom | Type |
| :------ | :------ |
| `args` | [`AudioToAudioArgs`](../modules#audiotoaudioargs) |
| `options?` | [`Options`](../interfaces/Options) |

#### Retourne[[audiotoaudio.returns]]

`Promise`\<[`AudioToAudioOutput`](../interfaces/AudioToAudioOutput)[]\>

#### Défini dans[[audiotoaudio.defined-in]]

[inference/src/tasks/audio/audioToAudio.ts:41](https://github.com/huggingface/huggingface.js/blob/main/packages/inference/src/tasks/audio/audioToAudio.ts#L41)

___

### automaticSpeechRecognition

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

Cette tâche lit une entrée audio et restitue les mots prononcés dans les fichiers audio. Modèle recommandé (langue anglaise) : facebook/wav2vec2-large-960h-lv60-self

#### Paramètres[[automaticspeechrecognition.parameters]]

| Nom | Type |
| :------ | :------ |
| `args` | [`AutomaticSpeechRecognitionArgs`](../modules#automaticspeechrecognitionargs) |
| `options?` | [`Options`](../interfaces/Options) |

#### Retourne[[automaticspeechrecognition.returns]]

`Promise`\<`AutomaticSpeechRecognitionOutput`\>

#### Défini dans[[automaticspeechrecognition.defined-in]]

[inference/src/tasks/audio/automaticSpeechRecognition.ts:13](https://github.com/huggingface/huggingface.js/blob/main/packages/inference/src/tasks/audio/automaticSpeechRecognition.ts#L13)

___

### chatCompletion

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

Utilisez le point de terminaison de complétion de chat pour générer une réponse à un prompt, en utilisant l'API de complétion de messages OpenAI sans flux

#### Paramètres[[chatcompletion.parameters]]

| Nom | Type |
| :------ | :------ |
| `args` | [`BaseArgs`](../interfaces/BaseArgs) & `ChatCompletionInput` |
| `options?` | [`Options`](../interfaces/Options) |

#### Retourne[[chatcompletion.returns]]

`Promise`\<`ChatCompletionOutput`\>

#### Défini dans[[chatcompletion.defined-in]]

[inference/src/tasks/nlp/chatCompletion.ts:12](https://github.com/huggingface/huggingface.js/blob/main/packages/inference/src/tasks/nlp/chatCompletion.ts#L12)

___

### chatCompletionStream

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

Utilisez pour continuer un texte à partir d'un prompt. Identique à `textGeneration` mais renvoie un générateur qui peut être lu un jeton à la fois

#### Paramètres[[chatcompletionstream.parameters]]

| Nom | Type |
| :------ | :------ |
| `args` | [`BaseArgs`](../interfaces/BaseArgs) & `ChatCompletionInput` |
| `options?` | [`Options`](../interfaces/Options) |

#### Retourne[[chatcompletionstream.returns]]

`AsyncGenerator`\<`ChatCompletionStreamOutput`\>

#### Défini dans[[chatcompletionstream.defined-in]]

[inference/src/tasks/nlp/chatCompletionStream.ts:12](https://github.com/huggingface/huggingface.js/blob/main/packages/inference/src/tasks/nlp/chatCompletionStream.ts#L12)

___

### documentQuestionAnswering

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

Répond à une question sur une image de document. Modèle recommandé : impira/layoutlm-document-qa.

#### Paramètres[[documentquestionanswering.parameters]]

| Nom | Type |
| :------ | :------ |
| `args` | [`DocumentQuestionAnsweringArgs`](../modules#documentquestionansweringargs) |
| `options?` | [`Options`](../interfaces/Options) |

#### Retourne[[documentquestionanswering.returns]]

`Promise`\<`DocumentQuestionAnsweringOutput`[`number`]\>

#### Défini dans[[documentquestionanswering.defined-in]]

[inference/src/tasks/multimodal/documentQuestionAnswering.ts:19](https://github.com/huggingface/huggingface.js/blob/main/packages/inference/src/tasks/multimodal/documentQuestionAnswering.ts#L19)

___

### endpoint

▸ **endpoint**(`endpointUrl`) : [`InferenceClient`](InferenceClient)

Retourne une nouvelle instance de InferenceClient liée à un point de terminaison spécifié.

Principalement pour la rétrocompatibilité.

#### Paramètres[[endpoint.parameters]]

| Nom | Type |
| :------ | :------ |
| `endpointUrl` | `string` |

#### Retourne[[endpoint.returns]]

[`InferenceClient`](InferenceClient)

#### Défini dans[[endpoint.defined-in]]

[inference/src/InferenceClient.ts:46](https://github.com/huggingface/huggingface.js/blob/main/packages/inference/src/InferenceClient.ts#L46)

___

### featureExtraction

▸ **featureExtraction**(`args`, `options?`) : `Promise`\<[`FeatureExtractionOutput`](../modules#featureextractionoutput)\>

Cette tâche lit du texte et produit des valeurs flottantes brutes, généralement consommées dans le cadre d'une base de données sémantique ou d'une recherche sémantique.

#### Paramètres[[featureextraction.parameters]]

| Nom | Type |
| :------ | :------ |
| `args` | [`FeatureExtractionArgs`](../modules#featureextractionargs) |
| `options?` | [`Options`](../interfaces/Options) |

#### Retourne[[featureextraction.returns]]

`Promise`\<[`FeatureExtractionOutput`](../modules#featureextractionoutput)\>

#### Défini dans[[featureextraction.defined-in]]

[inference/src/tasks/nlp/featureExtraction.ts:22](https://github.com/huggingface/huggingface.js/blob/main/packages/inference/src/tasks/nlp/featureExtraction.ts#L22)

___

### fillMask

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

Tente de combler un trou avec un mot manquant (un jeton, pour être précis). C'est la tâche de base pour les modèles BERT.

#### Paramètres[[fillmask.parameters]]

| Nom | Type |
| :------ | :------ |
| `args` | [`FillMaskArgs`](../modules#fillmaskargs) |
| `options?` | [`Options`](../interfaces/Options) |

#### Retourne[[fillmask.returns]]

`Promise`\<`FillMaskOutput`\>

#### Défini dans[[fillmask.defined-in]]

[inference/src/tasks/nlp/fillMask.ts:12](https://github.com/huggingface/huggingface.js/blob/main/packages/inference/src/tasks/nlp/fillMask.ts#L12)

___

### imageClassification

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

Cette tâche lit une image en entrée et sort la probabilité des classes. Modèle recommandé : google/vit-base-patch16-224

#### Paramètres[[imageclassification.parameters]]

| Nom | Type |
| :------ | :------ |
| `args` | [`ImageClassificationArgs`](../modules#imageclassificationargs) |
| `options?` | [`Options`](../interfaces/Options) |

#### Retourne[[imageclassification.returns]]

`Promise`\<`ImageClassificationOutput`\>

#### Défini dans[[imageclassification.defined-in]]

[inference/src/tasks/cv/imageClassification.ts:14](https://github.com/huggingface/huggingface.js/blob/main/packages/inference/src/tasks/cv/imageClassification.ts#L14)

___

### imageSegmentation

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

Cette tâche lit une image en entrée et renvoie la probabilité des classes ainsi que les boîtes englobantes des objets détectés. Modèle recommandé : facebook/detr-resnet-50-panoptic

#### Paramètres[[imagesegmentation.parameters]]

| Nom | Type |
| :------ | :------ |
| `args` | [`ImageSegmentationArgs`](../modules#imagesegmentationargs) |
| `options?` | [`Options`](../interfaces/Options) |

#### Retourne[[imagesegmentation.returns]]

`Promise`\<`ImageSegmentationOutput`\>

#### Défini dans[[imagesegmentation.defined-in]]

[inference/src/tasks/cv/imageSegmentation.ts:14](https://github.com/huggingface/huggingface.js/blob/main/packages/inference/src/tasks/cv/imageSegmentation.ts#L14)

___

### imageTextToImage

▸ **imageTextToImage**(`args`, `options?`) : `Promise`\<`Blob`\>

Cette tâche prend en entrée une image et un texte et génère une nouvelle image. Modèle recommandé : black-forest-labs/FLUX.2-dev

#### Paramètres[[imagetexttoimage.parameters]]

| Nom | Type |
| :------ | :------ |
| `args` | [`ImageTextToImageArgs`](../modules#imagetexttoimageargs) |
| `options?` | [`Options`](../interfaces/Options) |

#### Retourne[[imagetexttoimage.returns]]

`Promise`\<`Blob`\>

#### Défini dans[[imagetexttoimage.defined-in]]

[inference/src/tasks/cv/imageTextToImage.ts:13](https://github.com/huggingface/huggingface.js/blob/main/packages/inference/src/tasks/cv/imageTextToImage.ts#L13)

___

### imageTextToVideo

▸ **imageTextToVideo**(`args`, `options?`) : `Promise`\<`Blob`\>

Cette tâche prend en entrée une image et du texte et génère une vidéo en sortie. Modèle recommandé : Lightricks/LTX-Video

#### Paramètres[[imagetexttovideo.parameters]]

| Nom | Type |
| :------ | :------ |
| `args` | [`ImageTextToVideoArgs`](../modules#imagetexttovideoargs) |
| `options?` | [`Options`](../interfaces/Options) |

#### Retourne[[imagetexttovideo.returns]]

`Promise`\<`Blob`\>

#### Défini dans[[imagetexttovideo.defined-in]]

[inference/src/tasks/cv/imageTextToVideo.ts:13](https://github.com/huggingface/huggingface.js/blob/main/packages/inference/src/tasks/cv/imageTextToVideo.ts#L13)

___

### imageToImage

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

Cette tâche lit une entrée de texte et génère une image en sortie. Modèle recommandé : lllyasviel/sd-controlnet-depth

#### Paramètres[[imagetoimage.parameters]]

| Nom | Type |
| :------ | :------ |
| `args` | [`ImageToImageArgs`](../modules#imagetoimageargs) |
| `options?` | [`Options`](../interfaces/Options) |

#### Retourne[[imagetoimage.returns]]

`Promise`\<`Blob`\>

#### Défini dans[[imagetoimage.defined-in]]

[inference/src/tasks/cv/imageToImage.ts:14](https://github.com/huggingface/huggingface.js/blob/main/packages/inference/src/tasks/cv/imageToImage.ts#L14)

___

### imageToText

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

Cette tâche lit une entrée image et produit la légende de texte correspondante.

#### Paramètres[[imagetotext.parameters]]

| Nom | Type |
| :------ | :------ |
| `args` | [`ImageToTextArgs`](../modules#imagetotextargs) |
| `options?` | [`Options`](../interfaces/Options) |

#### Retourne[[imagetotext.returns]]

`Promise`\<`ImageToTextOutput`\>

#### Défini dans[[imagetotext.defined-in]]

[inference/src/tasks/cv/imageToText.ts:12](https://github.com/huggingface/huggingface.js/blob/main/packages/inference/src/tasks/cv/imageToText.ts#L12)

___

### imageToVideo

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

Cette tâche lit une entrée de texte et génère une image. Modèle recommandé : Wan-AI/Wan2.1-I2V-14B-720P

#### Paramètres[[imagetovideo.parameters]]

| Nom | Type |
| :------ | :------ |
| `args` | [`ImageToVideoArgs`](../modules#imagetovideoargs) |
| `options?` | [`Options`](../interfaces/Options) |

#### Retourne[[imagetovideo.returns]]

`Promise`\<`Blob`\>

#### Défini dans[[imagetovideo.defined-in]]

[inference/src/tasks/cv/imageToVideo.ts:14](https://github.com/huggingface/huggingface.js/blob/main/packages/inference/src/tasks/cv/imageToVideo.ts#L14)

___

### objectDetection

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

Cette tâche lit une image en entrée et renvoie la probabilité des classes ainsi que les boîtes englobantes des objets détectés. Modèle recommandé : facebook/detr-resnet-50

#### Paramètres[[objectdetection.parameters]]

| Nom | Type |
| :------ | :------ |
| `args` | [`ObjectDetectionArgs`](../modules#objectdetectionargs) |
| `options?` | [`Options`](../interfaces/Options) |

#### Retourne[[objectdetection.returns]]

`Promise`\<`ObjectDetectionOutput`\>

#### Défini dans[[objectdetection.defined-in]]

[inference/src/tasks/cv/objectDetection.ts:14](https://github.com/huggingface/huggingface.js/blob/main/packages/inference/src/tasks/cv/objectDetection.ts#L14)

___

### questionAnswering

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

Envie d’avoir un bot omniscient capable de répondre à n’importe quelle question ? Modèle recommandé : deepset/roberta-base-squad2

#### Paramètres[[questionanswering.parameters]]

| Nom | Type |
| :------ | :------ |
| `args` | [`QuestionAnsweringArgs`](../modules#questionansweringargs) |
| `options?` | [`Options`](../interfaces/Options) |

#### Retourne[[questionanswering.returns]]

`Promise`\<`QuestionAnsweringOutput`[`number`]\>

#### Défini dans[[questionanswering.defined-in]]

[inference/src/tasks/nlp/questionAnswering.ts:13](https://github.com/huggingface/huggingface.js/blob/main/packages/inference/src/tasks/nlp/questionAnswering.ts#L13)

___

### demande

▸ **demande**\<`T`\>(`args`, `options?`): `Promise`\<`T`\>

Primitive permettant d'effectuer des appels personnalisés au fournisseur d'inférence

#### Paramètres de type[[request.type-parameters]]

| Nom |
| :------ |
| `T` |

#### Paramètres[[request.parameters]]

| Nom | Type |
| :------ | :------ |
| `args` | [`RequestArgs`](../modules#requestargs) |
| `options?` | [`Options`](../interfaces/Options) & \{ `task?`: [`InferenceTask`](../modules#inferencetask)  } |

#### Retourne[[request.returns]]

`Promise`\<`T`\>

**`Deprecated`**

Utilisez plutôt des fonctions de tâches spécifiques. Cette fonction sera supprimée dans une version future.

#### Défini dans[[request.defined-in]]

[inference/src/tasks/custom/request.ts:11](https://github.com/huggingface/huggingface.js/blob/main/packages/inference/src/tasks/custom/request.ts#L11)

___

### sentenceSimilarity

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

Calculer la similarité sémantique entre un texte et une liste d'autres phrases en comparant leurs embeddings.

#### Paramètres[[sentencesimilarity.parameters]]

| Nom | Type |
| :------ | :------ |
| `args` | [`SentenceSimilarityArgs`](../modules#sentencesimilarityargs) |
| `options?` | [`Options`](../interfaces/Options) |

#### Retourne[[sentencesimilarity.returns]]

`Promise`\<`SentenceSimilarityOutput`\>

#### Défini dans[[sentencesimilarity.defined-in]]

[inference/src/tasks/nlp/sentenceSimilarity.ts:12](https://github.com/huggingface/huggingface.js/blob/main/packages/inference/src/tasks/nlp/sentenceSimilarity.ts#L12)

___

### streamingRequest

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

Primitive permettant d’effectuer des appels d’inférence personnalisés qui s’attendent à des événements envoyés par le serveur, et renvoyant la réponse via un générateur

#### Paramètres de type[[streamingrequest.type-parameters]]

| Nom |
| :------ |
| `T` |

#### Paramètres[[streamingrequest.parameters]]

| Nom | Type |
| :------ | :------ |
| `args` | [`RequestArgs`](../modules#requestargs) |
| `options?` | [`Options`](../interfaces/Options) & \{ `task?`: [`InferenceTask`](../modules#inferencetask)  } |

#### Retourne[[streamingrequest.returns]]

`AsyncGenerator`\<`T`\>

**`Deprecated`**

Utilisez plutôt des fonctions de tâches spécifiques. Cette fonction sera supprimée dans une version future.

#### Défini dans[[streamingrequest.defined-in]]

[inference/src/tasks/custom/streamingRequest.ts:11](https://github.com/huggingface/huggingface.js/blob/main/packages/inference/src/tasks/custom/streamingRequest.ts#L11)

___

### résumé

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

Cette tâche consiste à résumer un texte long en un texte plus court. Attention, certains modèles ont une longueur d’entrée maximale. Cela signifie que le résumé ne peut pas traiter des livres entiers, par exemple. Faites attention lors du choix de votre modèle.

#### Paramètres[[summarization.parameters]]

| Nom | Type |
| :------ | :------ |
| `args` | [`SummarizationArgs`](../modules#summarizationargs) |
| `options?` | [`Options`](../interfaces/Options) |

#### Retourne[[summarization.returns]]

`Promise`\<`SummarizationOutput`\>

#### Défini dans[[summarization.defined-in]]

[inference/src/tasks/nlp/summarization.ts:12](https://github.com/huggingface/huggingface.js/blob/main/packages/inference/src/tasks/nlp/summarization.ts#L12)

___

### tableQuestionAnswering

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

Vous ne connaissez pas SQL ? Vous ne souhaitez pas vous plonger dans un grand tableur ? Posez vos questions en anglais courant ! Modèle recommandé : google/tapas-base-finetuned-wtq.

#### Paramètres[[tablequestionanswering.parameters]]

| Nom | Type |
| :------ | :------ |
| `args` | [`TableQuestionAnsweringArgs`](../modules#tablequestionansweringargs) |
| `options?` | [`Options`](../interfaces/Options) |

#### Retourne[[tablequestionanswering.returns]]

`Promise`\<`TableQuestionAnsweringOutput`[`number`]\>

#### Défini dans[[tablequestionanswering.defined-in]]

[inference/src/tasks/nlp/tableQuestionAnswering.ts:12](https://github.com/huggingface/huggingface.js/blob/main/packages/inference/src/tasks/nlp/tableQuestionAnswering.ts#L12)

___

### tabularClassification

▸ **tabularClassification**(`args`, `options?`) : `Promise`\<[`TabularClassificationOutput`](../modules#tabularclassificationoutput)\>

Prédit l'étiquette cible pour un ensemble de caractéristiques donné sous forme tabulaire. En général, vous souhaitez entraîner un modèle de classification sur vos données d'entraînement et l'utiliser avec vos nouvelles données du même format. Exemple de modèle : vvmnnnkv/wine-quality

#### Paramètres[[tabularclassification.parameters]]

| Nom | Type |
| :------ | :------ |
| `args` | [`TabularClassificationArgs`](../modules#tabularclassificationargs) |
| `options?` | [`Options`](../interfaces/Options) |

#### Retourne[[tabularclassification.returns]]

`Promise`\<[`TabularClassificationOutput`](../modules#tabularclassificationoutput)\>

#### Défini dans[[tabularclassification.defined-in]]

[inference/src/tasks/tabular/tabularClassification.ts:25](https://github.com/huggingface/huggingface.js/blob/main/packages/inference/src/tasks/tabular/tabularClassification.ts#L25)

___

### tabularRegression

▸ **tabularRegression**(`args`, `options?`) : `Promise`\<[`TabularRegressionOutput`](../modules#tabularregressionoutput)\>

Prédit la valeur cible pour un ensemble de caractéristiques donné sous forme tabulaire. En général, vous souhaitez entraîner un modèle de régression sur vos données d’entraînement et l’utiliser avec vos nouvelles données du même format. Exemple de modèle : scikit-learn/Fish-Weight

#### Paramètres[[tabularregression.parameters]]

| Nom | Type |
| :------ | :------ |
| `args` | [`TabularRegressionArgs`](../modules#tabularregressionargs) |
| `options?` | [`Options`](../interfaces/Options) |

#### Retourne[[tabularregression.returns]]

`Promise`\<[`TabularRegressionOutput`](../modules#tabularregressionoutput)\>

#### Défini dans[[tabularregression.defined-in]]

[inference/src/tasks/tabular/tabularRegression.ts:25](https://github.com/huggingface/huggingface.js/blob/main/packages/inference/src/tasks/tabular/tabularRegression.ts#L25)

___

### textClassification

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

Utilisé généralement pour l'analyse de sentiments, il renvoie la probabilité des classes d'une entrée. Modèle recommandé : distilbert-base-uncased-finetuned-sst-2-english

#### Paramètres[[textclassification.parameters]]

| Nom | Type |
| :------ | :------ |
| `args` | [`TextClassificationArgs`](../modules#textclassificationargs) |
| `options?` | [`Options`](../interfaces/Options) |

#### Retourne[[textclassification.returns]]

`Promise`\<`TextClassificationOutput`\>

#### Défini dans[[textclassification.defined-in]]

[inference/src/tasks/nlp/textClassification.ts:12](https://github.com/huggingface/huggingface.js/blob/main/packages/inference/src/tasks/nlp/textClassification.ts#L12)

___

### textGeneration

▸ **textGeneration**(`args`, `options?`) : `Promise`\<[`TextGenerationOutput`](../interfaces/TextGenerationOutput)\>

Utilisez pour continuer un texte à partir d'un prompt. Il s'agit d'une tâche très générique. Modèle recommandé : gpt2 (c'est un modèle simple, mais amusant à manipuler).

#### Paramètres[[textgeneration.parameters]]

| Nom | Type |
| :------ | :------ |
| `args` | [`BaseArgs`](../interfaces/BaseArgs) & [`TextGenerationInput`](../interfaces/TextGenerationInput) |
| `options?` | [`Options`](../interfaces/Options) |

#### Retourne[[textgeneration.returns]]

`Promise`\<[`TextGenerationOutput`](../interfaces/TextGenerationOutput)\>

#### Défini dans[[textgeneration.defined-in]]

[inference/src/tasks/nlp/textGeneration.ts:12](https://github.com/huggingface/huggingface.js/blob/main/packages/inference/src/tasks/nlp/textGeneration.ts#L12)

___

### textGenerationStream

▸ **textGenerationStream**(`args`, `options?`) : `AsyncGenerator`\<[`TextGenerationStreamOutput`](../interfaces/TextGenerationStreamOutput)\>

Utilisez pour continuer un texte à partir d'un prompt. Identique à `textGeneration` mais renvoie un générateur qui peut être lu un jeton à la fois

#### Paramètres[[textgenerationstream.parameters]]

| Nom | Type |
| :------ | :------ |
| `args` | [`BaseArgs`](../interfaces/BaseArgs) & [`TextGenerationInput`](../interfaces/TextGenerationInput) |
| `options?` | [`Options`](../interfaces/Options) |

#### Retourne[[textgenerationstream.returns]]

`AsyncGenerator`\<[`TextGenerationStreamOutput`](../interfaces/TextGenerationStreamOutput)\>

#### Défini dans[[textgenerationstream.defined-in]]

[inference/src/tasks/nlp/textGenerationStream.ts:90](https://github.com/huggingface/huggingface.js/blob/main/packages/inference/src/tasks/nlp/textGenerationStream.ts#L90)

___

### textRanking

▸ **textRanking**(`args`, `options?`) : `Promise`\<`TextRankingOutput`\>

Classez les documents par pertinence par rapport à une requête à l'aide d'un modèle de reranker.

#### Paramètres[[textranking.parameters]]

| Nom | Type |
| :------ | :------ |
| `args` | [`TextRankingArgs`](../modules#textrankingargs) |
| `options?` | [`Options`](../interfaces/Options) |

#### Retourne[[textranking.returns]]

`Promise`\<`TextRankingOutput`\>

#### Défini dans[[textranking.defined-in]]

[inference/src/tasks/nlp/textRanking.ts:12](https://github.com/huggingface/huggingface.js/blob/main/packages/inference/src/tasks/nlp/textRanking.ts#L12)

___

### textToAudio

▸ **textToAudio**(`args`, `options?`) : `Promise`\<`Blob`\>

Cette tâche génère de l'audio (par exemple de la musique ou des effets sonores) à partir d'un prompt texte en entrée. Modèle d'exemple : stabilityai/stable-audio-open-1.0

#### Paramètres[[texttoaudio.parameters]]

| Nom | Type |
| :------ | :------ |
| `args` | [`TextToAudioArgs`](../modules#texttoaudioargs) |
| `options?` | [`Options`](../interfaces/Options) |

#### Retourne[[texttoaudio.returns]]

`Promise`\<`Blob`\>

#### Défini dans[[texttoaudio.defined-in]]

[inference/src/tasks/audio/textToAudio.ts:18](https://github.com/huggingface/huggingface.js/blob/main/packages/inference/src/tasks/audio/textToAudio.ts#L18)

___

### textToImage

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

Cette tâche lit une entrée de texte et génère une image en sortie. Modèle recommandé : stabilityai/stable-diffusion-2

#### Paramètres[[texttoimage.parameters]]

| Nom | Type |
| :------ | :------ |
| `args` | [`TextToImageArgs`](../modules#texttoimageargs) |
| `options?` | `TextToImageOptions` & \{ `outputType`: ``"url"``  } |

#### Retourne[[texttoimage.returns]]

`Promise`\<`string`\>

#### Défini dans[[texttoimage.defined-in]]

[inference/src/tasks/cv/textToImage.ts:18](https://github.com/huggingface/huggingface.js/blob/main/packages/inference/src/tasks/cv/textToImage.ts#L18)

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

#### Paramètres[[texttoimage.parameters]]

| Nom | Type |
| :------ | :------ |
| `args` | [`TextToImageArgs`](../modules#texttoimageargs) |
| `options?` | `TextToImageOptions` & \{ `outputType`: ``"dataUrl"``  } |

#### Retourne[[texttoimage.returns]]

`Promise`\<`string`\>

#### Défini dans[[texttoimage.defined-in]]

[inference/src/tasks/cv/textToImage.ts:22](https://github.com/huggingface/huggingface.js/blob/main/packages/inference/src/tasks/cv/textToImage.ts#L22)

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

#### Paramètres[[texttoimage.parameters]]

| Nom | Type |
| :------ | :------ |
| `args` | [`TextToImageArgs`](../modules#texttoimageargs) |
| `options?` | `TextToImageOptions` & \{ `outputType?`: ``"blob"``  } |

#### Retourne[[texttoimage.returns]]

`Promise`\<`Blob`\>

#### Défini dans[[texttoimage.defined-in]]

[inference/src/tasks/cv/textToImage.ts:26](https://github.com/huggingface/huggingface.js/blob/main/packages/inference/src/tasks/cv/textToImage.ts#L26)

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

#### Paramètres[[texttoimage.parameters]]

| Nom | Type |
| :------ | :------ |
| `args` | [`TextToImageArgs`](../modules#texttoimageargs) |
| `options?` | `TextToImageOptions` & \{ `outputType?`: ``"json"``  } |

#### Retourne[[texttoimage.returns]]

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

#### Défini dans[[texttoimage.defined-in]]

[inference/src/tasks/cv/textToImage.ts:30](https://github.com/huggingface/huggingface.js/blob/main/packages/inference/src/tasks/cv/textToImage.ts#L30)

___

### textToSpeech

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

Cette tâche synthétise un audio d'une voix prononçant un texte donné. Modèle recommandé : espnet/kan-bayashi_ljspeech_vits

#### Paramètres[[texttospeech.parameters]]

| Nom | Type |
| :------ | :------ |
| `args` | `TextToSpeechArgs` |
| `options?` | [`Options`](../interfaces/Options) |

#### Retourne[[texttospeech.returns]]

`Promise`\<`Blob`\>

#### Défini dans[[texttospeech.defined-in]]

[inference/src/tasks/audio/textToSpeech.ts:15](https://github.com/huggingface/huggingface.js/blob/main/packages/inference/src/tasks/audio/textToSpeech.ts#L15)

___

### textToVideo

▸ **textToVideo**(`args`, `options?`) : `Promise`\<[`TextToVideoOutput`](../modules#texttovideooutput)\>

#### Paramètres[[texttovideo.parameters]]

| Nom | Type |
| :------ | :------ |
| `args` | [`TextToVideoArgs`](../modules#texttovideoargs) |
| `options?` | [`Options`](../interfaces/Options) |

#### Retourne[[texttovideo.returns]]

`Promise`\<[`TextToVideoOutput`](../modules#texttovideooutput)\>

#### Défini dans[[texttovideo.defined-in]]

[inference/src/tasks/cv/textToVideo.ts:15](https://github.com/huggingface/huggingface.js/blob/main/packages/inference/src/tasks/cv/textToVideo.ts#L15)

___

### tokenClassification

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

Utilisé généralement pour l'analyse de phrases, qu'elle soit grammaticale ou de reconnaissance d'entités nommées (NER), afin de comprendre les mots-clés contenus dans le texte. Modèle recommandé : dbmdz/bert-large-cased-finetuned-conll03-english

#### Paramètres[[tokenclassification.parameters]]

| Nom | Type |
| :------ | :------ |
| `args` | [`TokenClassificationArgs`](../modules#tokenclassificationargs) |
| `options?` | [`Options`](../interfaces/Options) |

#### Retourne[[tokenclassification.returns]]

`Promise`\<`TokenClassificationOutput`\>

#### Défini dans[[tokenclassification.defined-in]]

[inference/src/tasks/nlp/tokenClassification.ts:12](https://github.com/huggingface/huggingface.js/blob/main/packages/inference/src/tasks/nlp/tokenClassification.ts#L12)

___

### traduction

▸ **traduction**(`args`, `options?`): `Promise`\<`TranslationOutput`\>

Cette tâche est bien connue pour traduire un texte d'une langue à une autre. Modèle recommandé : Helsinki-NLP/opus-mt-ru-en.

#### Paramètres[[translation.parameters]]

| Nom | Type |
| :------ | :------ |
| `args` | [`TranslationArgs`](../modules#translationargs) |
| `options?` | [`Options`](../interfaces/Options) |

#### Retourne[[translation.returns]]

`Promise`\<`TranslationOutput`\>

#### Défini dans[[translation.defined-in]]

[inference/src/tasks/nlp/translation.ts:11](https://github.com/huggingface/huggingface.js/blob/main/packages/inference/src/tasks/nlp/translation.ts#L11)

___

### visualQuestionAnswering

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

Répond à une question sur une image. Modèle recommandé : dandelin/vilt-b32-finetuned-vqa.

#### Paramètres[[visualquestionanswering.parameters]]

| Nom | Type |
| :------ | :------ |
| `args` | [`VisualQuestionAnsweringArgs`](../modules#visualquestionansweringargs) |
| `options?` | [`Options`](../interfaces/Options) |

#### Retourne[[visualquestionanswering.returns]]

`Promise`\<`VisualQuestionAnsweringOutput`[`number`]\>

#### Défini dans[[visualquestionanswering.defined-in]]

[inference/src/tasks/multimodal/visualQuestionAnswering.ts:19](https://github.com/huggingface/huggingface.js/blob/main/packages/inference/src/tasks/multimodal/visualQuestionAnswering.ts#L19)

___

### zeroShotClassification

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

Cette tâche est très utile pour tester la classification sans écrire de code : il suffit de transmettre une phrase ou un paragraphe ainsi que les étiquettes possibles pour cette phrase, et un résultat est renvoyé. Modèle recommandé : facebook/bart-large-mnli.

#### Paramètres[[zeroshotclassification.parameters]]

| Nom | Type |
| :------ | :------ |
| `args` | [`ZeroShotClassificationArgs`](../modules#zeroshotclassificationargs) |
| `options?` | [`Options`](../interfaces/Options) |

#### Retourne[[zeroshotclassification.returns]]

`Promise`\<`ZeroShotClassificationOutput`\>

#### Défini dans[[zeroshotclassification.defined-in]]

[inference/src/tasks/nlp/zeroShotClassification.ts:12](https://github.com/huggingface/huggingface.js/blob/main/packages/inference/src/tasks/nlp/zeroShotClassification.ts#L12)

___

### zeroShotImageClassification

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

Classer une image dans des classes spécifiées. Modèle recommandé : openai/clip-vit-large-patch14-336

#### Paramètres[[zeroshotimageclassification.parameters]]

| Nom | Type |
| :------ | :------ |
| `args` | [`ZeroShotImageClassificationArgs`](../modules#zeroshotimageclassificationargs) |
| `options?` | [`Options`](../interfaces/Options) |

#### Retourne[[zeroshotimageclassification.returns]]

`Promise`\<`ZeroShotImageClassificationOutput`\>

#### Défini dans[[zeroshotimageclassification.defined-in]]

[inference/src/tasks/cv/zeroShotImageClassification.ts:44](https://github.com/huggingface/huggingface.js/blob/main/packages/inference/src/tasks/cv/zeroShotImageClassification.ts#L44)

