Huggingface.js documentation

Interface: Options

Hugging Face's logo
Join the Hugging Face community

and get access to the augmented documentation experience

to get started

Interface: Options

Properties

dont _ load _ model

Optional dont_load_model: boolean

(Default: false). Boolean. Do not load the model if it’s not already available.

Defined in

inference/src/types.ts:15


fetch

Optional fetch: (input: RequestInfo | URL, init?: RequestInit) => Promise\<Response>

Custom fetch function to use instead of the default one, for example to use a proxy or edit headers.

Type declaration

▸ (input, init?): Promise\<Response>

Parameters
Name Type
input RequestInfo | URL
init? RequestInit
Returns

Promise\<Response>

Defined in

inference/src/types.ts:28


includeCredentials

Optional includeCredentials: string | boolean

(Default: “same-origin”). String | Boolean. Credentials to use for the request. If this is a string, it will be passed straight on. If it’s a boolean, true will be “include” and false will not send credentials at all.

Defined in

inference/src/types.ts:37


retry _ on _ error

Optional retry_on_error: boolean

(Default: true) Boolean. If a request 503s and wait_for_model is set to false, the request will be retried with the same parameters but with wait_for_model set to true.

Defined in

inference/src/types.ts:7


signal

Optional signal: AbortSignal

Abort Controller signal to use for request interruption.

Defined in

inference/src/types.ts:32


use _ cache

Optional use_cache: boolean

(Default: true). Boolean. There is a cache layer on Inference API (serverless) to speedup requests we have already seen. Most models can use those results as is as models are deterministic (meaning the results will be the same anyway). However if you use a non deterministic model, you can set this parameter to prevent the caching mechanism from being used resulting in a real new query.

Defined in

inference/src/types.ts:11


use _ gpu

Optional use_gpu: boolean

(Default: false). Boolean to use GPU instead of CPU for inference (requires Startup plan at least).

Defined in

inference/src/types.ts:19


wait _ for _ model

Optional wait_for_model: boolean

(Default: false) Boolean. If the model is not ready, wait for it instead of receiving 503. It limits the number of requests required to get your inference done. It is advised to only set this flag to true after receiving a 503 error as it will limit hanging in your application to known places.

Defined in

inference/src/types.ts:24