Type Alias: ResolveModelFileOptions
type ResolveModelFileOptions = {
directory: string;
download: "auto" | false;
verify: boolean;
fileName: string;
headers: Record<string, string>;
cli: boolean;
onProgress: (status: {
totalSize: number;
downloadedSize: number;
}) => void;
deleteTempFileOnCancel: boolean;
parallel: number;
tokens: ModelFileAccessTokens;
signal: AbortSignal;
};
Defined in: utils/resolveModelFile.ts:15
Properties
directory?
optional directory: string;
Defined in: utils/resolveModelFile.ts:21
The directory to resolve models from, and download models to.
Default to node-llama-cpp
's default global models directory (~/.node-llama-cpp/models
).
download?
optional download: "auto" | false;
Defined in: utils/resolveModelFile.ts:31
When downloading a model file, whether to download the file if it doesn't exist.
"auto"
: Download the file if it doesn't existfalse
: Don't download the file if it doesn't exist. Impliesverify: false
even ifverify
is set totrue
.
Defaults to "auto"
.
verify?
optional verify: boolean;
Defined in: utils/resolveModelFile.ts:39
When an existing model file that corresponds to the URI is found, verify that it matches the expected size of the remote file.
Defaults to false
.
fileName?
optional fileName: string;
Defined in: utils/resolveModelFile.ts:48
The name of the file to be resolved.
If provided and existing file is found with the same name, it will be returned.
If provided and no existing file is found with the same name, the file will be downloaded with the provided name.
headers?
optional headers: Record<string, string>;
Defined in: utils/resolveModelFile.ts:53
Additional headers to use when downloading a model file.
cli?
optional cli: boolean;
Defined in: utils/resolveModelFile.ts:60
When downloading a model file, show the download progress.
Defaults to true
.
onProgress()?
optional onProgress: (status: {
totalSize: number;
downloadedSize: number;
}) => void;
Defined in: utils/resolveModelFile.ts:65
When downloading a model file, called on download progress
Parameters
Parameter | Type |
---|---|
status | { totalSize : number ; downloadedSize : number ; } |
status.totalSize | number |
status.downloadedSize | number |
Returns
void
deleteTempFileOnCancel?
optional deleteTempFileOnCancel: boolean;
Defined in: utils/resolveModelFile.ts:72
If true, the temporary file will be deleted if the download is canceled.
Defaults to true
.
parallel?
optional parallel: number;
Defined in: utils/resolveModelFile.ts:79
The number of parallel downloads to use when downloading split files.
Defaults to 4
.
tokens?
optional tokens: ModelFileAccessTokens;
Defined in: utils/resolveModelFile.ts:84
Tokens to use to access the remote model file when downloading.
signal?
optional signal: AbortSignal;
Defined in: utils/resolveModelFile.ts:89
The signal to use to cancel a download.