everything-webgpu / types /engine /prefetch.d.ts
nyaaorick's picture
feat: publish everything-webgpu package, engine source and documentation
1944112 verified
Raw History Blame Contribute Delete
1.26 kB
/**
* WebLLM's `cleanModelUrl`, mirrored deliberately.
*
* Kept character-for-character with the bundle's version (see the contract
* test) because the whole point is to produce the same cache keys its loader
* will look for.
*/
export function resolveModelUrl(modelUrl: any): string;
/**
* @param {object} opts
* @param {string} opts.modelId
* @param {object} opts.record the merged app-config entry: `model`, `model_lib`
* @param {(p: {phase: string, done: number, total: number, label: string}) => void} [opts.onProgress]
* @param {AbortSignal} [opts.signal]
* @param {(url: string, init?: object) => Promise<Response>} [opts.fetchImpl]
* @returns {Promise<{modelId: string, files: number, bytes: number, alreadyCached: boolean}>}
*/
export function prefetchModel({ modelId, record, onProgress, signal, fetchImpl, }: {
modelId: string;
record: object;
onProgress?: (p: {
phase: string;
done: number;
total: number;
label: string;
}) => void;
signal?: AbortSignal;
fetchImpl?: (url: string, init?: object) => Promise<Response>;
}): Promise<{
modelId: string;
files: number;
bytes: number;
alreadyCached: boolean;
}>;
export function isAlreadyLocal(record: any): boolean;