@huggingface/inference 3.9.2 → 3.11.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (97) hide show
  1. package/README.md +9 -7
  2. package/dist/index.cjs +771 -646
  3. package/dist/index.js +770 -646
  4. package/dist/src/InferenceClient.d.ts +16 -17
  5. package/dist/src/InferenceClient.d.ts.map +1 -1
  6. package/dist/src/lib/getInferenceProviderMapping.d.ts +6 -2
  7. package/dist/src/lib/getInferenceProviderMapping.d.ts.map +1 -1
  8. package/dist/src/lib/getProviderHelper.d.ts.map +1 -1
  9. package/dist/src/lib/makeRequestOptions.d.ts.map +1 -1
  10. package/dist/src/providers/consts.d.ts.map +1 -1
  11. package/dist/src/providers/ovhcloud.d.ts +38 -0
  12. package/dist/src/providers/ovhcloud.d.ts.map +1 -0
  13. package/dist/src/providers/providerHelper.d.ts +1 -1
  14. package/dist/src/providers/providerHelper.d.ts.map +1 -1
  15. package/dist/src/snippets/getInferenceSnippets.d.ts +1 -1
  16. package/dist/src/snippets/getInferenceSnippets.d.ts.map +1 -1
  17. package/dist/src/snippets/templates.exported.d.ts.map +1 -1
  18. package/dist/src/tasks/audio/audioClassification.d.ts.map +1 -1
  19. package/dist/src/tasks/audio/audioToAudio.d.ts.map +1 -1
  20. package/dist/src/tasks/audio/automaticSpeechRecognition.d.ts.map +1 -1
  21. package/dist/src/tasks/audio/textToSpeech.d.ts.map +1 -1
  22. package/dist/src/tasks/custom/request.d.ts.map +1 -1
  23. package/dist/src/tasks/custom/streamingRequest.d.ts.map +1 -1
  24. package/dist/src/tasks/cv/imageClassification.d.ts.map +1 -1
  25. package/dist/src/tasks/cv/imageSegmentation.d.ts.map +1 -1
  26. package/dist/src/tasks/cv/imageToImage.d.ts.map +1 -1
  27. package/dist/src/tasks/cv/imageToText.d.ts.map +1 -1
  28. package/dist/src/tasks/cv/objectDetection.d.ts.map +1 -1
  29. package/dist/src/tasks/cv/textToImage.d.ts.map +1 -1
  30. package/dist/src/tasks/cv/textToVideo.d.ts.map +1 -1
  31. package/dist/src/tasks/cv/zeroShotImageClassification.d.ts.map +1 -1
  32. package/dist/src/tasks/multimodal/documentQuestionAnswering.d.ts.map +1 -1
  33. package/dist/src/tasks/multimodal/visualQuestionAnswering.d.ts.map +1 -1
  34. package/dist/src/tasks/nlp/chatCompletion.d.ts.map +1 -1
  35. package/dist/src/tasks/nlp/chatCompletionStream.d.ts.map +1 -1
  36. package/dist/src/tasks/nlp/featureExtraction.d.ts.map +1 -1
  37. package/dist/src/tasks/nlp/fillMask.d.ts.map +1 -1
  38. package/dist/src/tasks/nlp/questionAnswering.d.ts.map +1 -1
  39. package/dist/src/tasks/nlp/sentenceSimilarity.d.ts.map +1 -1
  40. package/dist/src/tasks/nlp/summarization.d.ts.map +1 -1
  41. package/dist/src/tasks/nlp/tableQuestionAnswering.d.ts.map +1 -1
  42. package/dist/src/tasks/nlp/textClassification.d.ts.map +1 -1
  43. package/dist/src/tasks/nlp/textGeneration.d.ts.map +1 -1
  44. package/dist/src/tasks/nlp/textGenerationStream.d.ts.map +1 -1
  45. package/dist/src/tasks/nlp/tokenClassification.d.ts.map +1 -1
  46. package/dist/src/tasks/nlp/translation.d.ts.map +1 -1
  47. package/dist/src/tasks/nlp/zeroShotClassification.d.ts.map +1 -1
  48. package/dist/src/tasks/tabular/tabularClassification.d.ts.map +1 -1
  49. package/dist/src/tasks/tabular/tabularRegression.d.ts.map +1 -1
  50. package/dist/src/types.d.ts +7 -5
  51. package/dist/src/types.d.ts.map +1 -1
  52. package/dist/src/utils/typedEntries.d.ts +4 -0
  53. package/dist/src/utils/typedEntries.d.ts.map +1 -0
  54. package/package.json +3 -3
  55. package/src/InferenceClient.ts +32 -43
  56. package/src/lib/getInferenceProviderMapping.ts +68 -19
  57. package/src/lib/getProviderHelper.ts +5 -0
  58. package/src/lib/makeRequestOptions.ts +4 -3
  59. package/src/providers/consts.ts +1 -0
  60. package/src/providers/ovhcloud.ts +75 -0
  61. package/src/providers/providerHelper.ts +1 -1
  62. package/src/snippets/getInferenceSnippets.ts +5 -4
  63. package/src/snippets/templates.exported.ts +7 -3
  64. package/src/tasks/audio/audioClassification.ts +3 -1
  65. package/src/tasks/audio/audioToAudio.ts +4 -1
  66. package/src/tasks/audio/automaticSpeechRecognition.ts +3 -1
  67. package/src/tasks/audio/textToSpeech.ts +2 -1
  68. package/src/tasks/custom/request.ts +3 -1
  69. package/src/tasks/custom/streamingRequest.ts +3 -1
  70. package/src/tasks/cv/imageClassification.ts +3 -1
  71. package/src/tasks/cv/imageSegmentation.ts +3 -1
  72. package/src/tasks/cv/imageToImage.ts +3 -1
  73. package/src/tasks/cv/imageToText.ts +3 -1
  74. package/src/tasks/cv/objectDetection.ts +3 -1
  75. package/src/tasks/cv/textToImage.ts +2 -1
  76. package/src/tasks/cv/textToVideo.ts +2 -1
  77. package/src/tasks/cv/zeroShotImageClassification.ts +3 -1
  78. package/src/tasks/multimodal/documentQuestionAnswering.ts +3 -1
  79. package/src/tasks/multimodal/visualQuestionAnswering.ts +3 -1
  80. package/src/tasks/nlp/chatCompletion.ts +3 -1
  81. package/src/tasks/nlp/chatCompletionStream.ts +3 -1
  82. package/src/tasks/nlp/featureExtraction.ts +3 -1
  83. package/src/tasks/nlp/fillMask.ts +3 -1
  84. package/src/tasks/nlp/questionAnswering.ts +4 -1
  85. package/src/tasks/nlp/sentenceSimilarity.ts +3 -1
  86. package/src/tasks/nlp/summarization.ts +3 -1
  87. package/src/tasks/nlp/tableQuestionAnswering.ts +3 -1
  88. package/src/tasks/nlp/textClassification.ts +3 -1
  89. package/src/tasks/nlp/textGeneration.ts +3 -1
  90. package/src/tasks/nlp/textGenerationStream.ts +3 -1
  91. package/src/tasks/nlp/tokenClassification.ts +3 -1
  92. package/src/tasks/nlp/translation.ts +3 -1
  93. package/src/tasks/nlp/zeroShotClassification.ts +3 -1
  94. package/src/tasks/tabular/tabularClassification.ts +3 -1
  95. package/src/tasks/tabular/tabularRegression.ts +3 -1
  96. package/src/types.ts +9 -4
  97. package/src/utils/typedEntries.ts +5 -0
package/README.md CHANGED
@@ -1,7 +1,7 @@
1
1
  # 🤗 Hugging Face Inference
2
2
 
3
- A Typescript powered wrapper for the HF Inference API (serverless), Inference Endpoints (dedicated), and all supported Inference Providers.
4
- It works with [Inference API (serverless)](https://huggingface.co/docs/api-inference/index) and [Inference Endpoints (dedicated)](https://huggingface.co/docs/inference-endpoints/index), and even with all supported third-party Inference Providers.
3
+ A Typescript powered wrapper for Inference Providers (serverless) and Inference Endpoints (dedicated).
4
+ It works with [Inference Providers (serverless)](https://huggingface.co/docs/api-inference/index) – including all supported third-party Inference Providers – and [Inference Endpoints (dedicated)](https://huggingface.co/docs/inference-endpoints/index), and even with .
5
5
 
6
6
  Check out the [full documentation](https://huggingface.co/docs/huggingface.js/inference/README).
7
7
 
@@ -25,20 +25,20 @@ yarn add @huggingface/inference
25
25
 
26
26
  ```ts
27
27
  // esm.sh
28
- import { InferenceClient } from "https://esm.sh/@huggingface/inference"
28
+ import { InferenceClient } from "https://esm.sh/@huggingface/inference";
29
29
  // or npm:
30
- import { InferenceClient } from "npm:@huggingface/inference"
30
+ import { InferenceClient } from "npm:@huggingface/inference";
31
31
  ```
32
32
 
33
33
  ### Initialize
34
34
 
35
35
  ```typescript
36
- import { InferenceClient } from '@huggingface/inference'
36
+ import { InferenceClient } from '@huggingface/inference';
37
37
 
38
- const hf = new InferenceClient('your access token')
38
+ const hf = new InferenceClient('your access token');
39
39
  ```
40
40
 
41
- ❗**Important note:** Using an access token is optional to get started, however you will be rate limited eventually. Join [Hugging Face](https://huggingface.co/join) and then visit [access tokens](https://huggingface.co/settings/tokens) to generate your access token for **free**.
41
+ ❗**Important note:** Always pass an access token. Join [Hugging Face](https://huggingface.co/join) and then visit [access tokens](https://huggingface.co/settings/tokens) to generate your access token for **free**.
42
42
 
43
43
  Your access token should be kept private. If you need to protect it in front-end applications, we suggest setting up a proxy server that stores the access token.
44
44
 
@@ -54,6 +54,7 @@ Currently, we support the following providers:
54
54
  - [Nebius](https://studio.nebius.ai)
55
55
  - [Novita](https://novita.ai/?utm_source=github_huggingface&utm_medium=github_readme&utm_campaign=link)
56
56
  - [Nscale](https://nscale.com)
57
+ - [OVHcloud](https://endpoints.ai.cloud.ovh.net/)
57
58
  - [Replicate](https://replicate.com)
58
59
  - [Sambanova](https://sambanova.ai)
59
60
  - [Together](https://together.xyz)
@@ -84,6 +85,7 @@ Only a subset of models are supported when requesting third-party providers. You
84
85
  - [Hyperbolic supported models](https://huggingface.co/api/partners/hyperbolic/models)
85
86
  - [Nebius supported models](https://huggingface.co/api/partners/nebius/models)
86
87
  - [Nscale supported models](https://huggingface.co/api/partners/nscale/models)
88
+ - [OVHcloud supported models](https://huggingface.co/api/partners/ovhcloud/models)
87
89
  - [Replicate supported models](https://huggingface.co/api/partners/replicate/models)
88
90
  - [Sambanova supported models](https://huggingface.co/api/partners/sambanova/models)
89
91
  - [Together supported models](https://huggingface.co/api/partners/together/models)