Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/cache-manager.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { DownloadProgressCallback } from './model-manager';
import type { DownloadProgressCallback } from './model-manager';
import { createWorker, isSafariMobile } from './utils';
import { OPFS_UTILS_WORKER_CODE } from './workers-code/generated';

Expand Down
6 changes: 5 additions & 1 deletion src/glue/glue.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
import { GLUE_MESSAGE_PROTOTYPES, GLUE_VERSION, GlueMsg } from './messages';
import {
GLUE_MESSAGE_PROTOTYPES,
GLUE_VERSION,
type GlueMsg,
} from './messages';

/**
* Glue is a simple binary protocol for serializing and deserializing messages.
Expand Down
24 changes: 12 additions & 12 deletions src/glue/messages.ts
Original file line number Diff line number Diff line change
Expand Up @@ -997,21 +997,21 @@ export interface GlueMsgLoadReq {
seed: number;
n_ctx: number;
n_threads: number;
embeddings?: boolean;
offload_kqv?: boolean;
n_batch?: number;
embeddings?: boolean | undefined;
offload_kqv?: boolean | undefined;
n_batch?: number | undefined;
n_seq_max?: number;
pooling_type?: string;
rope_scaling_type?: string;
rope_freq_base?: number;
rope_freq_scale?: number;
yarn_ext_factor?: number;
yarn_attn_factor?: number;
yarn_beta_fast?: number;
yarn_beta_slow?: number;
yarn_orig_ctx?: number;
rope_freq_base?: number | undefined;
rope_freq_scale?: number | undefined;
yarn_ext_factor?: number | undefined;
yarn_attn_factor?: number | undefined;
yarn_beta_fast?: number | undefined;
yarn_beta_slow?: number | undefined;
yarn_orig_ctx?: number | undefined;
cache_type_k?: string;
cache_type_v?: string;
cache_type_v?: string | undefined;
}

// struct glue_msg_load_res
Expand Down Expand Up @@ -1316,7 +1316,7 @@ export interface GlueMsgTestPerplexityRes {
// struct glue_msg_chat_format_req
export interface GlueMsgChatFormatReq {
_name: "cfmt_req";
tmpl?: string;
tmpl?: string | undefined;
add_ass?: boolean;
roles: string[];
contents: string[];
Expand Down
11 changes: 7 additions & 4 deletions src/model-manager.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
import CacheManager, { CacheEntry, DownloadOptions } from './cache-manager';
import CacheManager, {
type CacheEntry,
type DownloadOptions,
} from './cache-manager';
import { sumArr } from './utils';
import { WllamaError, WllamaLogger } from './wllama';
import { WllamaError, type WllamaLogger } from './wllama';

const DEFAULT_PARALLEL_DOWNLOADS = 3;

Expand Down Expand Up @@ -38,13 +41,13 @@ export interface ModelManagerParams {
*
* Default: 3
*/
parallelDownloads?: number;
parallelDownloads?: number | undefined;
/**
* Allow offline mode
*
* Default: false
*/
allowOffline?: boolean;
allowOffline?: boolean | undefined;
}

/**
Expand Down
6 changes: 3 additions & 3 deletions src/wllama.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@ import {
joinBuffers,
sortFileByShard,
} from './utils';
import CacheManager, { DownloadOptions } from './cache-manager';
import CacheManager, { type DownloadOptions } from './cache-manager';
import { ModelManager, Model } from './model-manager';
import {
import type {
GlueMsgChatFormatRes,
GlueMsgDecodeRes,
GlueMsgDetokenizeRes,
Expand Down Expand Up @@ -260,7 +260,7 @@ export class WllamaError extends Error {
* This is equivalent to AbortError in Fetch API.
*/
export class WllamaAbortError extends Error {
name: string = 'AbortError';
override name: string = 'AbortError';
constructor() {
super('Operation aborted');
}
Expand Down
4 changes: 2 additions & 2 deletions src/worker.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
*/

import { glueDeserialize, glueSerialize } from './glue/glue';
import { GlueMsg } from './glue/messages';
import type { GlueMsg } from './glue/messages';
import { createWorker, isSafariMobile } from './utils';
import {
LLAMA_CPP_WORKER_CODE,
Expand Down Expand Up @@ -44,7 +44,7 @@ interface Task {
resolve: any;
reject: any;
param: TaskParam;
buffers?: ArrayBuffer[];
buffers?: ArrayBuffer[] | undefined;
}

export class ProxyToWorker {
Expand Down
3 changes: 3 additions & 0 deletions tsconfig.build.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,9 @@
"downlevelIteration": true,
"resolveJsonModule": true,
"experimentalDecorators": true,
"exactOptionalPropertyTypes": true,
"noImplicitOverride": true,
"verbatimModuleSyntax": true,

"noEmit": false,
"module": "es2015",
Expand Down