@huggingface/inference 3.7.0 → 3.7.1

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 (126) hide show
  1. package/dist/index.cjs +1152 -839
  2. package/dist/index.js +1154 -841
  3. package/dist/src/lib/getProviderHelper.d.ts +37 -0
  4. package/dist/src/lib/getProviderHelper.d.ts.map +1 -0
  5. package/dist/src/lib/makeRequestOptions.d.ts +0 -2
  6. package/dist/src/lib/makeRequestOptions.d.ts.map +1 -1
  7. package/dist/src/providers/black-forest-labs.d.ts +14 -18
  8. package/dist/src/providers/black-forest-labs.d.ts.map +1 -1
  9. package/dist/src/providers/cerebras.d.ts +4 -2
  10. package/dist/src/providers/cerebras.d.ts.map +1 -1
  11. package/dist/src/providers/cohere.d.ts +5 -2
  12. package/dist/src/providers/cohere.d.ts.map +1 -1
  13. package/dist/src/providers/fal-ai.d.ts +50 -3
  14. package/dist/src/providers/fal-ai.d.ts.map +1 -1
  15. package/dist/src/providers/fireworks-ai.d.ts +5 -2
  16. package/dist/src/providers/fireworks-ai.d.ts.map +1 -1
  17. package/dist/src/providers/hf-inference.d.ts +125 -2
  18. package/dist/src/providers/hf-inference.d.ts.map +1 -1
  19. package/dist/src/providers/hyperbolic.d.ts +31 -2
  20. package/dist/src/providers/hyperbolic.d.ts.map +1 -1
  21. package/dist/src/providers/nebius.d.ts +20 -18
  22. package/dist/src/providers/nebius.d.ts.map +1 -1
  23. package/dist/src/providers/novita.d.ts +21 -18
  24. package/dist/src/providers/novita.d.ts.map +1 -1
  25. package/dist/src/providers/openai.d.ts +4 -2
  26. package/dist/src/providers/openai.d.ts.map +1 -1
  27. package/dist/src/providers/providerHelper.d.ts +182 -0
  28. package/dist/src/providers/providerHelper.d.ts.map +1 -0
  29. package/dist/src/providers/replicate.d.ts +23 -19
  30. package/dist/src/providers/replicate.d.ts.map +1 -1
  31. package/dist/src/providers/sambanova.d.ts +4 -2
  32. package/dist/src/providers/sambanova.d.ts.map +1 -1
  33. package/dist/src/providers/together.d.ts +32 -2
  34. package/dist/src/providers/together.d.ts.map +1 -1
  35. package/dist/src/snippets/getInferenceSnippets.d.ts.map +1 -1
  36. package/dist/src/tasks/audio/audioClassification.d.ts.map +1 -1
  37. package/dist/src/tasks/audio/automaticSpeechRecognition.d.ts.map +1 -1
  38. package/dist/src/tasks/audio/textToSpeech.d.ts.map +1 -1
  39. package/dist/src/tasks/audio/utils.d.ts +2 -1
  40. package/dist/src/tasks/audio/utils.d.ts.map +1 -1
  41. package/dist/src/tasks/custom/request.d.ts +0 -2
  42. package/dist/src/tasks/custom/request.d.ts.map +1 -1
  43. package/dist/src/tasks/custom/streamingRequest.d.ts +0 -2
  44. package/dist/src/tasks/custom/streamingRequest.d.ts.map +1 -1
  45. package/dist/src/tasks/cv/imageClassification.d.ts.map +1 -1
  46. package/dist/src/tasks/cv/imageSegmentation.d.ts.map +1 -1
  47. package/dist/src/tasks/cv/imageToImage.d.ts.map +1 -1
  48. package/dist/src/tasks/cv/imageToText.d.ts.map +1 -1
  49. package/dist/src/tasks/cv/objectDetection.d.ts.map +1 -1
  50. package/dist/src/tasks/cv/textToImage.d.ts.map +1 -1
  51. package/dist/src/tasks/cv/textToVideo.d.ts.map +1 -1
  52. package/dist/src/tasks/cv/zeroShotImageClassification.d.ts.map +1 -1
  53. package/dist/src/tasks/index.d.ts +6 -6
  54. package/dist/src/tasks/index.d.ts.map +1 -1
  55. package/dist/src/tasks/multimodal/documentQuestionAnswering.d.ts.map +1 -1
  56. package/dist/src/tasks/multimodal/visualQuestionAnswering.d.ts.map +1 -1
  57. package/dist/src/tasks/nlp/chatCompletion.d.ts.map +1 -1
  58. package/dist/src/tasks/nlp/chatCompletionStream.d.ts.map +1 -1
  59. package/dist/src/tasks/nlp/featureExtraction.d.ts.map +1 -1
  60. package/dist/src/tasks/nlp/fillMask.d.ts.map +1 -1
  61. package/dist/src/tasks/nlp/questionAnswering.d.ts.map +1 -1
  62. package/dist/src/tasks/nlp/sentenceSimilarity.d.ts.map +1 -1
  63. package/dist/src/tasks/nlp/summarization.d.ts.map +1 -1
  64. package/dist/src/tasks/nlp/tableQuestionAnswering.d.ts.map +1 -1
  65. package/dist/src/tasks/nlp/textClassification.d.ts.map +1 -1
  66. package/dist/src/tasks/nlp/textGeneration.d.ts.map +1 -1
  67. package/dist/src/tasks/nlp/tokenClassification.d.ts.map +1 -1
  68. package/dist/src/tasks/nlp/translation.d.ts.map +1 -1
  69. package/dist/src/tasks/nlp/zeroShotClassification.d.ts.map +1 -1
  70. package/dist/src/tasks/tabular/tabularClassification.d.ts.map +1 -1
  71. package/dist/src/tasks/tabular/tabularRegression.d.ts.map +1 -1
  72. package/dist/src/types.d.ts +3 -13
  73. package/dist/src/types.d.ts.map +1 -1
  74. package/package.json +3 -3
  75. package/src/lib/getProviderHelper.ts +270 -0
  76. package/src/lib/makeRequestOptions.ts +34 -91
  77. package/src/providers/black-forest-labs.ts +73 -22
  78. package/src/providers/cerebras.ts +6 -27
  79. package/src/providers/cohere.ts +9 -28
  80. package/src/providers/fal-ai.ts +195 -77
  81. package/src/providers/fireworks-ai.ts +8 -29
  82. package/src/providers/hf-inference.ts +555 -34
  83. package/src/providers/hyperbolic.ts +107 -29
  84. package/src/providers/nebius.ts +65 -29
  85. package/src/providers/novita.ts +68 -32
  86. package/src/providers/openai.ts +6 -32
  87. package/src/providers/providerHelper.ts +354 -0
  88. package/src/providers/replicate.ts +124 -34
  89. package/src/providers/sambanova.ts +5 -30
  90. package/src/providers/together.ts +92 -28
  91. package/src/snippets/getInferenceSnippets.ts +16 -9
  92. package/src/snippets/templates.exported.ts +1 -1
  93. package/src/tasks/audio/audioClassification.ts +4 -7
  94. package/src/tasks/audio/audioToAudio.ts +3 -26
  95. package/src/tasks/audio/automaticSpeechRecognition.ts +4 -3
  96. package/src/tasks/audio/textToSpeech.ts +5 -29
  97. package/src/tasks/audio/utils.ts +2 -1
  98. package/src/tasks/custom/request.ts +0 -2
  99. package/src/tasks/custom/streamingRequest.ts +0 -2
  100. package/src/tasks/cv/imageClassification.ts +3 -7
  101. package/src/tasks/cv/imageSegmentation.ts +3 -8
  102. package/src/tasks/cv/imageToImage.ts +3 -6
  103. package/src/tasks/cv/imageToText.ts +3 -6
  104. package/src/tasks/cv/objectDetection.ts +3 -18
  105. package/src/tasks/cv/textToImage.ts +9 -137
  106. package/src/tasks/cv/textToVideo.ts +11 -62
  107. package/src/tasks/cv/zeroShotImageClassification.ts +3 -7
  108. package/src/tasks/index.ts +6 -6
  109. package/src/tasks/multimodal/documentQuestionAnswering.ts +3 -19
  110. package/src/tasks/multimodal/visualQuestionAnswering.ts +3 -11
  111. package/src/tasks/nlp/chatCompletion.ts +5 -20
  112. package/src/tasks/nlp/chatCompletionStream.ts +1 -2
  113. package/src/tasks/nlp/featureExtraction.ts +3 -18
  114. package/src/tasks/nlp/fillMask.ts +3 -16
  115. package/src/tasks/nlp/questionAnswering.ts +3 -22
  116. package/src/tasks/nlp/sentenceSimilarity.ts +3 -7
  117. package/src/tasks/nlp/summarization.ts +3 -6
  118. package/src/tasks/nlp/tableQuestionAnswering.ts +3 -27
  119. package/src/tasks/nlp/textClassification.ts +3 -8
  120. package/src/tasks/nlp/textGeneration.ts +12 -79
  121. package/src/tasks/nlp/tokenClassification.ts +3 -18
  122. package/src/tasks/nlp/translation.ts +3 -6
  123. package/src/tasks/nlp/zeroShotClassification.ts +3 -16
  124. package/src/tasks/tabular/tabularClassification.ts +3 -6
  125. package/src/tasks/tabular/tabularRegression.ts +3 -6
  126. package/src/types.ts +3 -14
package/src/types.ts CHANGED
@@ -34,7 +34,7 @@ export interface Options {
34
34
  billTo?: string;
35
35
  }
36
36
 
37
- export type InferenceTask = Exclude<PipelineType, "other">;
37
+ export type InferenceTask = Exclude<PipelineType, "other"> | "conversational";
38
38
 
39
39
  export const INFERENCE_PROVIDERS = [
40
40
  "black-forest-labs",
@@ -101,14 +101,6 @@ export type RequestArgs = BaseArgs &
101
101
  parameters?: Record<string, unknown>;
102
102
  };
103
103
 
104
- export interface ProviderConfig {
105
- makeBaseUrl: ((task?: InferenceTask) => string) | (() => string);
106
- makeBody: (params: BodyParams) => Record<string, unknown>;
107
- makeHeaders: (params: HeaderParams) => Record<string, string>;
108
- makeUrl: (params: UrlParams) => string;
109
- clientSideRoutingOnly?: boolean;
110
- }
111
-
112
104
  export type AuthMethod = "none" | "hf-token" | "credentials-include" | "provider-key";
113
105
 
114
106
  export interface HeaderParams {
@@ -118,15 +110,12 @@ export interface HeaderParams {
118
110
 
119
111
  export interface UrlParams {
120
112
  authMethod: AuthMethod;
121
- baseUrl: string;
122
113
  model: string;
123
114
  task?: InferenceTask;
124
- chatCompletion?: boolean;
125
115
  }
126
116
 
127
- export interface BodyParams {
128
- args: Record<string, unknown>;
129
- chatCompletion?: boolean;
117
+ export interface BodyParams<T extends Record<string, unknown> = Record<string, unknown>> {
118
+ args: T;
130
119
  model: string;
131
120
  task?: InferenceTask;
132
121
  }