@@ -128,21 +128,21 @@ The inference package provides specific error types to help you handle different
128128
129129The package defines several error types that extend the base ` Error ` class:
130130
131- - ` HfInferenceError ` : Base error class for all Hugging Face Inference errors
132- - ` HfInferenceInputError ` : Thrown when there are issues with input parameters
133- - ` HfInferenceProviderApiError ` : Thrown when there are API-level errors from providers
134- - ` HfInferenceHubApiError ` : Thrown when there are API-levels errors from the Hugging Face Hub
135- - ` HfInferenceProviderOutputError ` : Thrown when there are issues with providers' API responses format
131+ - ` InferenceClientError ` : Base error class for all Hugging Face Inference errors
132+ - ` InferenceClientInputError ` : Thrown when there are issues with input parameters
133+ - ` InferenceClientProviderApiError ` : Thrown when there are API-level errors from providers
134+ - ` InferenceClientHubApiError ` : Thrown when there are API-levels errors from the Hugging Face Hub
135+ - ` InferenceClientProviderOutputError ` : Thrown when there are issues with providers' API responses format
136136
137137### Example Usage
138138
139139``` typescript
140140import { InferenceClient } from " @huggingface/inference" ;
141141import {
142- HfInferenceError ,
143- HfInferenceProviderApiError ,
144- HfInferenceProviderOutputError ,
145- HfInferenceHubApiError ,
142+ InferenceClientError ,
143+ InferenceClientProviderApiError ,
144+ InferenceClientProviderOutputError ,
145+ InferenceClientHubApiError ,
146146} from " @huggingface/inference" ;
147147
148148const hf = new HfInference ();
@@ -153,20 +153,20 @@ try {
153153 inputs: " Hello, I'm a language model" ,
154154 });
155155} catch (error ) {
156- if (error instanceof HfInferenceProviderApiError ) {
156+ if (error instanceof InferenceClientProviderApiError ) {
157157 // Handle API errors (e.g., rate limits, authentication issues)
158158 console .error (" Provider API Error:" , error .message );
159159 console .error (" HTTP Request details:" , error .request );
160160 console .error (" HTTP Response details:" , error .response );
161- if (error instanceof HfInferenceHubApiError ) {
161+ if (error instanceof InferenceClientHubApiError ) {
162162 // Handle API errors (e.g., rate limits, authentication issues)
163163 console .error (" Hub API Error:" , error .message );
164164 console .error (" HTTP Request details:" , error .request );
165165 console .error (" HTTP Response details:" , error .response );
166- } else if (error instanceof HfInferenceProviderOutputError ) {
166+ } else if (error instanceof InferenceClientProviderOutputError ) {
167167 // Handle malformed responses from providers
168168 console .error (" Provider Output Error:" , error .message );
169- } else if (error instanceof HfInferenceInputError ) {
169+ } else if (error instanceof InferenceClientInputError ) {
170170 // Handle invalid input parameters
171171 console .error (" Input Error:" , error .message );
172172 } else {
@@ -182,7 +182,7 @@ try {
182182 inputs: " Hello, I'm a language model" ,
183183 });
184184} catch (error ) {
185- if (error instanceof HfInferenceError ) {
185+ if (error instanceof InferenceClientError ) {
186186 // Handle errors from @huggingface/inference
187187 console .error (" Error from InferenceClient:" , error );
188188 } else {
@@ -194,7 +194,7 @@ try {
194194
195195### Error Details
196196
197- #### HfInferenceProviderApiError
197+ #### InferenceClientProviderApiError
198198
199199This error occurs when there are issues with the API request when performing inference at the selected provider.
200200
@@ -203,7 +203,7 @@ It has several properties:
203203- ` request ` : Details about the failed request (URL, method, headers)
204204- ` response ` : Response details including status code and body
205205
206- #### HfInferenceHubApiError
206+ #### InferenceClientHubApiError
207207
208208This error occurs when there are issues with the API request when requesting the Hugging Face Hub API.
209209
@@ -213,11 +213,11 @@ It has several properties:
213213- ` response ` : Response details including status code and body
214214
215215
216- #### HfInferenceProviderOutputError
216+ #### InferenceClientProviderOutputError
217217
218218This error occurs when a provider returns a response in an unexpected format.
219219
220- #### HfInferenceInputError
220+ #### InferenceClientInputError
221221
222222This error occurs when input parameters are invalid or missing. The error message describes what's wrong with the input.
223223
0 commit comments