@huggingface/inference 3.6.1 → 3.7.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 (100) hide show
  1. package/README.md +0 -25
  2. package/dist/index.cjs +256 -154
  3. package/dist/index.js +256 -154
  4. package/dist/src/config.d.ts +1 -0
  5. package/dist/src/config.d.ts.map +1 -1
  6. package/dist/src/lib/makeRequestOptions.d.ts.map +1 -1
  7. package/dist/src/providers/black-forest-labs.d.ts.map +1 -1
  8. package/dist/src/providers/cerebras.d.ts.map +1 -1
  9. package/dist/src/providers/cohere.d.ts.map +1 -1
  10. package/dist/src/providers/fal-ai.d.ts +6 -16
  11. package/dist/src/providers/fal-ai.d.ts.map +1 -1
  12. package/dist/src/providers/fireworks-ai.d.ts.map +1 -1
  13. package/dist/src/providers/hf-inference.d.ts.map +1 -1
  14. package/dist/src/providers/hyperbolic.d.ts.map +1 -1
  15. package/dist/src/providers/nebius.d.ts.map +1 -1
  16. package/dist/src/providers/novita.d.ts.map +1 -1
  17. package/dist/src/providers/openai.d.ts.map +1 -1
  18. package/dist/src/providers/replicate.d.ts.map +1 -1
  19. package/dist/src/providers/sambanova.d.ts.map +1 -1
  20. package/dist/src/providers/together.d.ts.map +1 -1
  21. package/dist/src/tasks/audio/automaticSpeechRecognition.d.ts.map +1 -1
  22. package/dist/src/tasks/custom/request.d.ts +1 -0
  23. package/dist/src/tasks/custom/request.d.ts.map +1 -1
  24. package/dist/src/tasks/custom/streamingRequest.d.ts +1 -0
  25. package/dist/src/tasks/custom/streamingRequest.d.ts.map +1 -1
  26. package/dist/src/tasks/cv/imageToText.d.ts.map +1 -1
  27. package/dist/src/tasks/cv/objectDetection.d.ts +1 -1
  28. package/dist/src/tasks/cv/objectDetection.d.ts.map +1 -1
  29. package/dist/src/tasks/cv/textToVideo.d.ts +1 -1
  30. package/dist/src/tasks/cv/textToVideo.d.ts.map +1 -1
  31. package/dist/src/tasks/cv/zeroShotImageClassification.d.ts +1 -1
  32. package/dist/src/tasks/cv/zeroShotImageClassification.d.ts.map +1 -1
  33. package/dist/src/tasks/multimodal/documentQuestionAnswering.d.ts +1 -1
  34. package/dist/src/tasks/multimodal/documentQuestionAnswering.d.ts.map +1 -1
  35. package/dist/src/tasks/multimodal/visualQuestionAnswering.d.ts.map +1 -1
  36. package/dist/src/tasks/nlp/chatCompletion.d.ts +1 -1
  37. package/dist/src/tasks/nlp/chatCompletion.d.ts.map +1 -1
  38. package/dist/src/tasks/nlp/chatCompletionStream.d.ts +1 -1
  39. package/dist/src/tasks/nlp/chatCompletionStream.d.ts.map +1 -1
  40. package/dist/src/tasks/nlp/questionAnswering.d.ts.map +1 -1
  41. package/dist/src/tasks/nlp/sentenceSimilarity.d.ts.map +1 -1
  42. package/dist/src/tasks/nlp/textClassification.d.ts.map +1 -1
  43. package/dist/src/tasks/nlp/tokenClassification.d.ts.map +1 -1
  44. package/dist/src/tasks/nlp/zeroShotClassification.d.ts.map +1 -1
  45. package/dist/src/types.d.ts +11 -2
  46. package/dist/src/types.d.ts.map +1 -1
  47. package/dist/src/utils/request.d.ts +27 -0
  48. package/dist/src/utils/request.d.ts.map +1 -0
  49. package/dist/test/InferenceClient.spec.d.ts.map +1 -1
  50. package/package.json +2 -2
  51. package/src/config.ts +1 -0
  52. package/src/lib/makeRequestOptions.ts +8 -3
  53. package/src/providers/black-forest-labs.ts +6 -2
  54. package/src/providers/cerebras.ts +6 -2
  55. package/src/providers/cohere.ts +6 -2
  56. package/src/providers/fal-ai.ts +85 -3
  57. package/src/providers/fireworks-ai.ts +6 -2
  58. package/src/providers/hf-inference.ts +6 -2
  59. package/src/providers/hyperbolic.ts +6 -2
  60. package/src/providers/nebius.ts +6 -2
  61. package/src/providers/novita.ts +5 -2
  62. package/src/providers/openai.ts +6 -2
  63. package/src/providers/replicate.ts +6 -2
  64. package/src/providers/sambanova.ts +6 -2
  65. package/src/providers/together.ts +6 -2
  66. package/src/snippets/templates.exported.ts +1 -1
  67. package/src/tasks/audio/audioClassification.ts +2 -2
  68. package/src/tasks/audio/audioToAudio.ts +2 -2
  69. package/src/tasks/audio/automaticSpeechRecognition.ts +3 -3
  70. package/src/tasks/audio/textToSpeech.ts +2 -2
  71. package/src/tasks/custom/request.ts +7 -32
  72. package/src/tasks/custom/streamingRequest.ts +5 -85
  73. package/src/tasks/cv/imageClassification.ts +2 -2
  74. package/src/tasks/cv/imageSegmentation.ts +2 -2
  75. package/src/tasks/cv/imageToImage.ts +2 -2
  76. package/src/tasks/cv/imageToText.ts +7 -9
  77. package/src/tasks/cv/objectDetection.ts +4 -4
  78. package/src/tasks/cv/textToImage.ts +3 -3
  79. package/src/tasks/cv/textToVideo.ts +23 -36
  80. package/src/tasks/cv/zeroShotImageClassification.ts +4 -5
  81. package/src/tasks/multimodal/documentQuestionAnswering.ts +13 -13
  82. package/src/tasks/multimodal/visualQuestionAnswering.ts +4 -2
  83. package/src/tasks/nlp/chatCompletion.ts +3 -4
  84. package/src/tasks/nlp/chatCompletionStream.ts +3 -3
  85. package/src/tasks/nlp/featureExtraction.ts +2 -2
  86. package/src/tasks/nlp/fillMask.ts +2 -2
  87. package/src/tasks/nlp/questionAnswering.ts +3 -2
  88. package/src/tasks/nlp/sentenceSimilarity.ts +2 -11
  89. package/src/tasks/nlp/summarization.ts +2 -2
  90. package/src/tasks/nlp/tableQuestionAnswering.ts +2 -2
  91. package/src/tasks/nlp/textClassification.ts +8 -9
  92. package/src/tasks/nlp/textGeneration.ts +16 -16
  93. package/src/tasks/nlp/textGenerationStream.ts +2 -2
  94. package/src/tasks/nlp/tokenClassification.ts +9 -10
  95. package/src/tasks/nlp/translation.ts +2 -2
  96. package/src/tasks/nlp/zeroShotClassification.ts +9 -10
  97. package/src/tasks/tabular/tabularClassification.ts +2 -2
  98. package/src/tasks/tabular/tabularRegression.ts +2 -2
  99. package/src/types.ts +13 -2
  100. package/src/utils/request.ts +161 -0
package/README.md CHANGED
@@ -572,31 +572,6 @@ await hf.tabularClassification({
572
572
  })
573
573
  ```
574
574
 
575
- ## Custom Calls
576
-
577
- For models with custom parameters / outputs.
578
-
579
- ```typescript
580
- await hf.request({
581
- model: 'my-custom-model',
582
- inputs: 'hello world',
583
- parameters: {
584
- custom_param: 'some magic',
585
- }
586
- })
587
-
588
- // Custom streaming call, for models with custom parameters / outputs
589
- for await (const output of hf.streamingRequest({
590
- model: 'my-custom-model',
591
- inputs: 'hello world',
592
- parameters: {
593
- custom_param: 'some magic',
594
- }
595
- })) {
596
- ...
597
- }
598
- ```
599
-
600
575
  You can use any Chat Completion API-compatible provider with the `chatCompletion` method.
601
576
 
602
577
  ```typescript