@litert-lm/core 0.12.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (82) hide show
  1. package/README.md +145 -0
  2. package/dist/cleanup.d.ts +25 -0
  3. package/dist/cleanup.d.ts.map +1 -0
  4. package/dist/cleanup.js +36 -0
  5. package/dist/cleanup.js.map +1 -0
  6. package/dist/conversation.d.ts +43 -0
  7. package/dist/conversation.d.ts.map +1 -0
  8. package/dist/conversation.js +153 -0
  9. package/dist/conversation.js.map +1 -0
  10. package/dist/conversation_config.d.ts +107 -0
  11. package/dist/conversation_config.d.ts.map +1 -0
  12. package/dist/conversation_config.js +17 -0
  13. package/dist/conversation_config.js.map +1 -0
  14. package/dist/engine.d.ts +37 -0
  15. package/dist/engine.d.ts.map +1 -0
  16. package/dist/engine.js +200 -0
  17. package/dist/engine.js.map +1 -0
  18. package/dist/engine_settings.d.ts +56 -0
  19. package/dist/engine_settings.d.ts.map +1 -0
  20. package/dist/engine_settings.js +110 -0
  21. package/dist/engine_settings.js.map +1 -0
  22. package/dist/global_litertlm.d.ts +66 -0
  23. package/dist/global_litertlm.d.ts.map +1 -0
  24. package/dist/global_litertlm.js +85 -0
  25. package/dist/global_litertlm.js.map +1 -0
  26. package/dist/index.d.ts +27 -0
  27. package/dist/index.d.ts.map +1 -0
  28. package/dist/index.js +27 -0
  29. package/dist/index.js.map +1 -0
  30. package/dist/litertlm_web.d.ts +32 -0
  31. package/dist/litertlm_web.d.ts.map +1 -0
  32. package/dist/litertlm_web.js +75 -0
  33. package/dist/litertlm_web.js.map +1 -0
  34. package/dist/load.d.ts +28 -0
  35. package/dist/load.d.ts.map +1 -0
  36. package/dist/load.js +43 -0
  37. package/dist/load.js.map +1 -0
  38. package/dist/load_litertlm.d.ts +58 -0
  39. package/dist/load_litertlm.d.ts.map +1 -0
  40. package/dist/load_litertlm.js +75 -0
  41. package/dist/load_litertlm.js.map +1 -0
  42. package/dist/mutex.d.ts +45 -0
  43. package/dist/mutex.d.ts.map +1 -0
  44. package/dist/mutex.js +62 -0
  45. package/dist/mutex.js.map +1 -0
  46. package/dist/readable_stream_data_stream_wrapper.d.ts +44 -0
  47. package/dist/readable_stream_data_stream_wrapper.d.ts.map +1 -0
  48. package/dist/readable_stream_data_stream_wrapper.js +315 -0
  49. package/dist/readable_stream_data_stream_wrapper.js.map +1 -0
  50. package/dist/session.d.ts +46 -0
  51. package/dist/session.d.ts.map +1 -0
  52. package/dist/session.js +88 -0
  53. package/dist/session.js.map +1 -0
  54. package/dist/session_config.d.ts +55 -0
  55. package/dist/session_config.d.ts.map +1 -0
  56. package/dist/session_config.js +109 -0
  57. package/dist/session_config.js.map +1 -0
  58. package/dist/types.d.ts +42 -0
  59. package/dist/types.d.ts.map +1 -0
  60. package/dist/types.js +17 -0
  61. package/dist/types.js.map +1 -0
  62. package/dist/url_path_utils.d.ts +28 -0
  63. package/dist/url_path_utils.d.ts.map +1 -0
  64. package/dist/url_path_utils.js +34 -0
  65. package/dist/url_path_utils.js.map +1 -0
  66. package/dist/wasm_binding_types.d.ts +365 -0
  67. package/dist/wasm_binding_types.d.ts.map +1 -0
  68. package/dist/wasm_binding_types.js +39 -0
  69. package/dist/wasm_binding_types.js.map +1 -0
  70. package/dist/wasm_feature_detect.d.ts +42 -0
  71. package/dist/wasm_feature_detect.d.ts.map +1 -0
  72. package/dist/wasm_feature_detect.js +117 -0
  73. package/dist/wasm_feature_detect.js.map +1 -0
  74. package/dist/wasm_utils.d.ts +30 -0
  75. package/dist/wasm_utils.d.ts.map +1 -0
  76. package/dist/wasm_utils.js +41 -0
  77. package/dist/wasm_utils.js.map +1 -0
  78. package/package.json +46 -0
  79. package/wasm/litertlm_wasm_compat_internal.js +8400 -0
  80. package/wasm/litertlm_wasm_compat_internal.wasm +0 -0
  81. package/wasm/litertlm_wasm_internal.js +8389 -0
  82. package/wasm/litertlm_wasm_internal.wasm +0 -0
@@ -0,0 +1,42 @@
1
+ /**
2
+ * Copyright 2026 Google LLC
3
+ *
4
+ * Licensed under the Apache License, Version 2.0 (the "License");
5
+ * you may not use this file except in compliance with the License.
6
+ * You may obtain a copy of the License at
7
+ *
8
+ * http://www.apache.org/licenses/LICENSE-2.0
9
+ *
10
+ * Unless required by applicable law or agreed to in writing, software
11
+ * distributed under the License is distributed on an "AS IS" BASIS,
12
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ * See the License for the specific language governing permissions and
14
+ * limitations under the License.
15
+ */
16
+ /**
17
+ * Recursively makes all properties of T required.
18
+ */
19
+ export type RecursiveRequired<T> = T extends Set<infer U> ? Set<RecursiveRequired<U>> : T extends object ? {
20
+ [K in keyof T]-?: RecursiveRequired<T[K]>;
21
+ } : T;
22
+ /**
23
+ * Primitive JSON value.
24
+ *
25
+ * This includes 'null' in order to match the JSON spec.
26
+ */
27
+ export type JsonPrimitive = string | number | boolean | null;
28
+ /**
29
+ * Array of JSON values.
30
+ */
31
+ export type JsonArray = JsonValue[];
32
+ /**
33
+ * Object of JSON values.
34
+ */
35
+ export interface JsonObject {
36
+ [key: string]: JsonValue | undefined;
37
+ }
38
+ /**
39
+ * Any valid JSON value.
40
+ */
41
+ export type JsonValue = JsonPrimitive | JsonArray | JsonObject;
42
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH;;GAEG;AACH,MAAM,MAAM,iBAAiB,CAAC,CAAC,IAC7B,CAAC,SAAS,GAAG,CAAC,MAAM,CAAC,CAAC,GAAG,GAAG,CAAC,iBAAiB,CAAC,CAAC,CAAC,CAAC,GAClD,CAAC,SAAS,MAAM,GAAG;KAClB,CAAC,IAAI,MAAM,CAAC,CAAE,CAAC,GAAG,iBAAiB,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;CAC3C,GAAG,CAAC,CAAC;AAEN;;;;GAIG;AAEH,MAAM,MAAM,aAAa,GAAG,MAAM,GAAC,MAAM,GAAC,OAAO,GAAC,IAAI,CAAC;AAEvD;;GAEG;AACH,MAAM,MAAM,SAAS,GAAG,SAAS,EAAE,CAAC;AAEpC;;GAEG;AACH,MAAM,WAAW,UAAU;IACzB,CAAC,GAAG,EAAE,MAAM,GAAG,SAAS,GAAC,SAAS,CAAC;CACpC;AAED;;GAEG;AACH,MAAM,MAAM,SAAS,GAAG,aAAa,GAAC,SAAS,GAAC,UAAU,CAAC"}
package/dist/types.js ADDED
@@ -0,0 +1,17 @@
1
+ /**
2
+ * Copyright 2026 Google LLC
3
+ *
4
+ * Licensed under the Apache License, Version 2.0 (the "License");
5
+ * you may not use this file except in compliance with the License.
6
+ * You may obtain a copy of the License at
7
+ *
8
+ * http://www.apache.org/licenses/LICENSE-2.0
9
+ *
10
+ * Unless required by applicable law or agreed to in writing, software
11
+ * distributed under the License is distributed on an "AS IS" BASIS,
12
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ * See the License for the specific language governing permissions and
14
+ * limitations under the License.
15
+ */
16
+ export {};
17
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG"}
@@ -0,0 +1,28 @@
1
+ /**
2
+ * Copyright 2026 Google LLC
3
+ *
4
+ * Licensed under the Apache License, Version 2.0 (the "License");
5
+ * you may not use this file except in compliance with the License.
6
+ * You may obtain a copy of the License at
7
+ *
8
+ * http://www.apache.org/licenses/LICENSE-2.0
9
+ *
10
+ * Unless required by applicable law or agreed to in writing, software
11
+ * distributed under the License is distributed on an "AS IS" BASIS,
12
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ * See the License for the specific language governing permissions and
14
+ * limitations under the License.
15
+ */
16
+ /**
17
+ * Type for a path to a resource.
18
+ */
19
+ export type UrlPath = string;
20
+ /**
21
+ * Returns the string representation of the given url path.
22
+ */
23
+ export declare function pathToString(path: UrlPath): string;
24
+ /**
25
+ * Appends a path segment to the given url path.
26
+ */
27
+ export declare function appendPathSegment(path: UrlPath, segment: string): string;
28
+ //# sourceMappingURL=url_path_utils.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"url_path_utils.d.ts","sourceRoot":"","sources":["../src/url_path_utils.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH;;GAEG;AACH,MAAM,MAAM,OAAO,GAAG,MAAM,CAAC;AAE7B;;GAEG;AACH,wBAAgB,YAAY,CAAC,IAAI,EAAE,OAAO,GAAG,MAAM,CAElD;AAED;;GAEG;AACH,wBAAgB,iBAAiB,CAAC,IAAI,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,GAAG,MAAM,CAQxE"}
@@ -0,0 +1,34 @@
1
+ /**
2
+ * Copyright 2026 Google LLC
3
+ *
4
+ * Licensed under the Apache License, Version 2.0 (the "License");
5
+ * you may not use this file except in compliance with the License.
6
+ * You may obtain a copy of the License at
7
+ *
8
+ * http://www.apache.org/licenses/LICENSE-2.0
9
+ *
10
+ * Unless required by applicable law or agreed to in writing, software
11
+ * distributed under the License is distributed on an "AS IS" BASIS,
12
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ * See the License for the specific language governing permissions and
14
+ * limitations under the License.
15
+ */
16
+ /**
17
+ * Returns the string representation of the given url path.
18
+ */
19
+ export function pathToString(path) {
20
+ return path;
21
+ }
22
+ /**
23
+ * Appends a path segment to the given url path.
24
+ */
25
+ export function appendPathSegment(path, segment) {
26
+ if (!path)
27
+ return segment;
28
+ if (!segment)
29
+ return path;
30
+ const pathWithSlash = path.endsWith('/') ? path : path + '/';
31
+ const segmentWithoutSlash = segment.startsWith('/') ? segment.substring(1) : segment;
32
+ return pathWithSlash + segmentWithoutSlash;
33
+ }
34
+ //# sourceMappingURL=url_path_utils.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"url_path_utils.js","sourceRoot":"","sources":["../src/url_path_utils.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAOH;;GAEG;AACH,MAAM,UAAU,YAAY,CAAC,IAAa;IACxC,OAAO,IAAI,CAAC;AACd,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,iBAAiB,CAAC,IAAa,EAAE,OAAe;IAC9D,IAAI,CAAC,IAAI;QAAE,OAAO,OAAO,CAAC;IAC1B,IAAI,CAAC,OAAO;QAAE,OAAO,IAAI,CAAC;IAE1B,MAAM,aAAa,GAAG,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,GAAG,GAAG,CAAC;IAC7D,MAAM,mBAAmB,GACrB,OAAO,CAAC,UAAU,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC;IAC7D,OAAO,aAAa,GAAG,mBAAmB,CAAC;AAC7C,CAAC"}
@@ -0,0 +1,365 @@
1
+ /**
2
+ * Copyright 2026 Google LLC
3
+ *
4
+ * Licensed under the Apache License, Version 2.0 (the "License");
5
+ * you may not use this file except in compliance with the License.
6
+ * You may obtain a copy of the License at
7
+ *
8
+ * http://www.apache.org/licenses/LICENSE-2.0
9
+ *
10
+ * Unless required by applicable law or agreed to in writing, software
11
+ * distributed under the License is distributed on an "AS IS" BASIS,
12
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ * See the License for the specific language governing permissions and
14
+ * limitations under the License.
15
+ */
16
+ import { WasmModule } from '@litertjs/wasm-utils';
17
+ import { type ReadableStreamDataStreamWrapper } from './readable_stream_data_stream_wrapper';
18
+ /**
19
+ * Backend types for LiteRT-LM.
20
+ */
21
+ export declare const Backend: {
22
+ UNSPECIFIED: number;
23
+ CPU_ARTISAN: number;
24
+ GPU_ARTISAN: number;
25
+ CPU: number;
26
+ GPU: number;
27
+ GOOGLE_TENSOR_ARTISAN: number;
28
+ NPU: number;
29
+ };
30
+ /**
31
+ * A LiteRT-LM Backend.
32
+ */
33
+ export type Backend = (typeof Backend)[keyof typeof Backend];
34
+ /**
35
+ * An object that must be manually deleted to free its memory.
36
+ */
37
+ export declare interface Deletable {
38
+ delete(): void;
39
+ }
40
+ /**
41
+ * A C++ vector of elements.
42
+ */
43
+ export declare interface EmscriptenVector<T> extends Deletable {
44
+ size(): number;
45
+ get(index: number): T;
46
+ push_back(item: T): void;
47
+ }
48
+ /**
49
+ * A C++ vector of uint32_t.
50
+ */
51
+ export declare interface VectorUint32Constructor {
52
+ new (): EmscriptenVector<number>;
53
+ }
54
+ /**
55
+ * A C++ vector of int.
56
+ */
57
+ export declare interface VectorIntConstructor {
58
+ new (): EmscriptenVector<number>;
59
+ }
60
+ /**
61
+ * A C++ vector of vector of int.
62
+ */
63
+ export declare interface VectorVectorIntConstructor {
64
+ new (): EmscriptenVector<EmscriptenVector<number>>;
65
+ }
66
+ /**
67
+ * A C++ enum value in Wasm.
68
+ */
69
+ export declare interface EmscriptenEnumElement<T> {
70
+ value: T;
71
+ }
72
+ type EmscriptenEnum<T extends object> = {
73
+ [K in keyof T]: EmscriptenEnumElement<T[K]>;
74
+ };
75
+ declare interface ModelAssetsConstructor {
76
+ new (...args: never[]): ModelAssets;
77
+ create(modelPath: string): ModelAssets;
78
+ createStreaming(stream: ReadableStreamDataStream): ModelAssets;
79
+ }
80
+ declare const ModelAssetsBrand: unique symbol;
81
+ /**
82
+ * LiteRT-LM ModelAssets
83
+ */
84
+ export declare interface ModelAssets extends Deletable {
85
+ [ModelAssetsBrand]: void;
86
+ getPath(): string;
87
+ }
88
+ /**
89
+ * LiteRT-LM Backend enum values
90
+ */
91
+ declare interface EngineSettingsConstructor {
92
+ new (...args: never[]): EngineSettings;
93
+ createDefault(modelAssets: ModelAssets, backend: EmscriptenEnumElement<Backend>): EngineSettings;
94
+ }
95
+ declare const EngineSettingsBrand: unique symbol;
96
+ /**
97
+ * LiteRT-LM EngineSettings
98
+ */
99
+ export declare interface EngineSettings extends Deletable {
100
+ [EngineSettingsBrand]: void;
101
+ getMutableMainExecutorSettings(): LlmExecutorSettings;
102
+ getParallelFileSectionLoading(): boolean;
103
+ setParallelFileSectionLoading(parallelFileSectionLoading: boolean): void;
104
+ getSingleThreadedExecution(): boolean;
105
+ setSingleThreadedExecution(singleThreadedExecution: boolean): void;
106
+ }
107
+ /**
108
+ * LiteRT-LM CpuConfig
109
+ */
110
+ export declare interface CpuConfig {
111
+ kv_increment_size: number;
112
+ prefill_chunk_size: number;
113
+ number_of_threads: number;
114
+ }
115
+ /**
116
+ * LiteRT-LM GpuConfig
117
+ */
118
+ export declare interface GpuConfig {
119
+ max_top_k: number;
120
+ external_tensor_mode: boolean;
121
+ }
122
+ /**
123
+ * LiteRT-LM GpuArtisanConfig
124
+ */
125
+ export declare interface GpuArtisanConfig {
126
+ num_output_candidates: number;
127
+ wait_for_weight_uploads: boolean;
128
+ num_decode_steps_per_sync: number;
129
+ sequence_batch_size: number;
130
+ supported_lora_ranks: EmscriptenVector<number>;
131
+ max_top_k: number;
132
+ enable_decode_logits: boolean;
133
+ enable_external_embeddings: boolean;
134
+ use_submodel: boolean;
135
+ }
136
+ /**
137
+ * LiteRT-LM AdvancedSettings
138
+ */
139
+ export declare interface AdvancedSettings {
140
+ prefill_batch_sizes: Set<number>;
141
+ num_output_candidates: number;
142
+ configure_magic_numbers: boolean;
143
+ verify_magic_numbers: boolean;
144
+ clear_kv_cache_before_prefill: boolean;
145
+ num_logits_to_print_after_decode: number;
146
+ gpu_madvise_original_shared_tensors: boolean;
147
+ is_benchmark: boolean;
148
+ preferred_device_substr: string;
149
+ num_threads_to_upload: number;
150
+ num_threads_to_compile: number;
151
+ convert_weights_on_gpu: boolean;
152
+ optimize_shader_compilation: boolean;
153
+ share_constant_tensors: boolean;
154
+ }
155
+ declare const ExecutorSettingsBaseBrand: unique symbol;
156
+ /**
157
+ * LiteRT-LM ExecutorSettingsBase
158
+ */
159
+ export declare interface ExecutorSettingsBase extends Deletable {
160
+ [ExecutorSettingsBaseBrand]: void;
161
+ getCacheDir(): string;
162
+ setCacheDir(cacheDir: string): void;
163
+ }
164
+ /**
165
+ * LiteRT-LM LlmExecutorSettings constructor
166
+ */
167
+ declare interface LlmExecutorSettingsConstructor {
168
+ new (...args: never[]): LlmExecutorSettings;
169
+ }
170
+ declare const LlmExecutorSettingsBrand: unique symbol;
171
+ /**
172
+ * LiteRT-LM LlmExecutorSettings
173
+ */
174
+ export declare interface LlmExecutorSettings extends ExecutorSettingsBase {
175
+ [LlmExecutorSettingsBrand]: void;
176
+ getMaxNumTokens(): number;
177
+ setMaxNumTokens(maxNumTokens: number): void;
178
+ setBackendConfigCpu(cpuConfig: CpuConfig): void;
179
+ setBackendConfigGpu(gpuConfig: GpuConfig): void;
180
+ setBackendConfigGpuArtisan(gpuArtisanConfig: GpuArtisanConfig): void;
181
+ getBackendConfigCpu(): CpuConfig;
182
+ getBackendConfigGpu(): GpuConfig;
183
+ getBackendConfigGpuArtisan(): GpuArtisanConfig;
184
+ setSamplerBackend(backend: EmscriptenEnumElement<Backend>): void;
185
+ getSamplerBackend(): EmscriptenEnumElement<Backend>;
186
+ setAdvancedSettings(advancedSettings: AdvancedSettings): void;
187
+ getAdvancedSettings(): AdvancedSettings;
188
+ }
189
+ /**
190
+ * LiteRT-LM Engine constructor
191
+ */
192
+ declare interface EngineConstructor {
193
+ new (...args: never[]): Engine;
194
+ createEngine(engineSettings: EngineSettings, inputPromptAsHint: string): Promise<Engine>;
195
+ createStreaming(engineSettings: EngineSettings, inputPromptAsHint: string): Promise<Engine>;
196
+ }
197
+ declare const EngineBrand: unique symbol;
198
+ /**
199
+ * LiteRT-LM Engine
200
+ */
201
+ export declare interface Engine extends Deletable {
202
+ [EngineBrand]: void;
203
+ createSession(sessionConfig: SessionConfig): Session;
204
+ getEngineSettings(): EngineSettings;
205
+ waitUntilDone(): Promise<void>;
206
+ }
207
+ /**
208
+ * LiteRT-LM SamplerType enum values
209
+ */
210
+ export declare const SamplerType: {
211
+ readonly TYPE_UNSPECIFIED: 0;
212
+ readonly TOP_K: 1;
213
+ readonly TOP_P: 2;
214
+ readonly GREEDY: 3;
215
+ };
216
+ /**
217
+ * LiteRT-LM SamplerType
218
+ */
219
+ export type SamplerType = typeof SamplerType[keyof typeof SamplerType];
220
+ /**
221
+ * LiteRT-LM SamplerParameters
222
+ */
223
+ declare interface SamplerParameters {
224
+ type(): EmscriptenEnumElement<SamplerType>;
225
+ setType(type: EmscriptenEnumElement<SamplerType>): void;
226
+ k(): number;
227
+ setK(k: number): void;
228
+ p(): number;
229
+ setP(p: number): void;
230
+ temperature(): number;
231
+ setTemperature(temperature: number): void;
232
+ seed(): number;
233
+ setSeed(seed: number): void;
234
+ }
235
+ /**
236
+ * LiteRT-LM SessionConfig constructor
237
+ */
238
+ declare interface SessionConfigConstructor {
239
+ new (...args: never[]): SessionConfig;
240
+ createDefault(): SessionConfig;
241
+ }
242
+ declare const SessionConfigBrand: unique symbol;
243
+ /**
244
+ * LiteRT-LM SessionConfig
245
+ */
246
+ export declare interface SessionConfig extends Deletable {
247
+ [SessionConfigBrand]: void;
248
+ getAudioModalityEnabled(): boolean;
249
+ setAudioModalityEnabled(audioModalityEnabled: boolean): void;
250
+ getVisionModalityEnabled(): boolean;
251
+ setVisionModalityEnabled(visionModalityEnabled: boolean): void;
252
+ getMutableSamplerParams(): SamplerParameters;
253
+ getStopTokenIds(): EmscriptenVector<EmscriptenVector<number>>;
254
+ setStopTokenIds(stopTokenIds: EmscriptenVector<EmscriptenVector<number>>): void;
255
+ getStartTokenId(): number;
256
+ setStartTokenId(startTokenId: number): void;
257
+ getNumOutputCandidates(): number;
258
+ setNumOutputCandidates(numOutputCandidates: number): void;
259
+ getSamplerBackend(): EmscriptenEnumElement<Backend>;
260
+ setSamplerBackend(backend: EmscriptenEnumElement<Backend>): void;
261
+ getApplyPromptTemplateInSession(): boolean;
262
+ setApplyPromptTemplateInSession(applyPromptTemplateInSession: boolean): void;
263
+ getUseExternalSampler(): boolean;
264
+ setUseExternalSampler(useExternalSampler: boolean): void;
265
+ getMaxOutputTokens(): number;
266
+ setMaxOutputTokens(maxOutputTokens: number): void;
267
+ }
268
+ declare const SessionBrand: unique symbol;
269
+ /**
270
+ * LiteRT-LM Session
271
+ */
272
+ export declare interface Session extends Deletable {
273
+ [SessionBrand]: void;
274
+ getSessionConfig(): SessionConfig;
275
+ runPrefill(inputs: string[]): Promise<void>;
276
+ runDecode(): Promise<Responses>;
277
+ cancelProcess(): void;
278
+ }
279
+ declare const ResponsesBrand: unique symbol;
280
+ /**
281
+ * LiteRT-LM Responses
282
+ */
283
+ export declare interface Responses extends Deletable {
284
+ [ResponsesBrand]: void;
285
+ getTexts(): EmscriptenVector<string>;
286
+ }
287
+ /**
288
+ * LiteRT-LM ConversationConfig constructor
289
+ */
290
+ declare interface ConversationConfigConstructor {
291
+ new (...args: never[]): ConversationConfig;
292
+ createDefault(engine: Engine): ConversationConfig;
293
+ createCustom(engine: Engine, sessionConfig: SessionConfig, enableConstrainedDecoding: boolean, prefillPrefaceOnInit: boolean, filterChannelContentFromKvCache: boolean, prefaceJson: string): ConversationConfig;
294
+ }
295
+ declare const ConversationConfigBrand: unique symbol;
296
+ /**
297
+ * LiteRT-LM ConversationConfig
298
+ */
299
+ export declare interface ConversationConfig extends Deletable {
300
+ [ConversationConfigBrand]: void;
301
+ }
302
+ /**
303
+ * LiteRT-LM Conversation constructor
304
+ */
305
+ declare interface ConversationConstructor {
306
+ new (...args: never[]): Conversation;
307
+ create(engine: Engine, config: ConversationConfig): Conversation;
308
+ }
309
+ declare const ConversationBrand: unique symbol;
310
+ /**
311
+ * LiteRT-LM Conversation
312
+ */
313
+ export declare interface Conversation extends Deletable {
314
+ [ConversationBrand]: void;
315
+ sendMessage(messageJson: string): Promise<string>;
316
+ sendMessageAsync(messageJson: string, callback: (chunk: string | null, isDone: boolean, error: string | null) => void): Promise<void>;
317
+ getHistory(): string;
318
+ cancelProcess(): void;
319
+ }
320
+ declare interface ReadableStreamDataStreamConstructor {
321
+ new (...args: never[]): ReadableStreamDataStream;
322
+ create(stream: ReadableStreamDataStreamWrapper): ReadableStreamDataStream;
323
+ }
324
+ declare const ReadableStreamDataStreamBrand: unique symbol;
325
+ /**
326
+ * LiteRT-LM ReadableStreamDataStream.
327
+ */
328
+ export declare interface ReadableStreamDataStream extends Deletable {
329
+ [ReadableStreamDataStreamBrand]: void;
330
+ }
331
+ type BackendEnum = EmscriptenEnum<{
332
+ UNSPECIFIED: Backend;
333
+ CPU_ARTISAN: Backend;
334
+ GPU_ARTISAN: Backend;
335
+ CPU: Backend;
336
+ GPU: Backend;
337
+ GOOGLE_TENSOR_ARTISAN: Backend;
338
+ NPU: Backend;
339
+ }>;
340
+ /**
341
+ * Interface for the C++ LiteRt LM bindings.
342
+ */
343
+ export declare interface LiteRtLmWasm extends WasmModule {
344
+ preinitializedWebGPUDevice?: GPUDevice;
345
+ VectorUint32: VectorUint32Constructor;
346
+ VectorInt: VectorIntConstructor;
347
+ VectorVectorInt: VectorVectorIntConstructor;
348
+ FS: FileSystemApi;
349
+ setupLogging(): void;
350
+ Backend: BackendEnum;
351
+ ModelAssets: ModelAssetsConstructor;
352
+ EngineSettings: EngineSettingsConstructor;
353
+ LlmExecutorSettings: LlmExecutorSettingsConstructor;
354
+ Engine: EngineConstructor;
355
+ SessionConfig: SessionConfigConstructor;
356
+ ReadableStreamDataStream: ReadableStreamDataStreamConstructor;
357
+ ConversationConfig: ConversationConfigConstructor;
358
+ Conversation: ConversationConstructor;
359
+ }
360
+ declare interface FileSystemApi {
361
+ writeFile(path: string, data: string | ArrayBufferView): void;
362
+ unlink(path: string): void;
363
+ }
364
+ export {};
365
+ //# sourceMappingURL=wasm_binding_types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"wasm_binding_types.d.ts","s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AAa,EAAE,wBAAwB,CAAC;IACxC,wBAAwB,EAAE,mCAAmC,CAAC;IAC9D,kBAAkB,EAAE,6BAA6B,CAAC;IAClD,YAAY,EAAE,uBAAuB,CAAC;CACvC;AAOD,OAAO,WAAW,aAAa;IAC7B,SAAS,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAC,eAAe,GAAG,IAAI,CAAC;IAC5D,MAAM,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI,CAAC;CAC5B"}
@@ -0,0 +1,39 @@
1
+ /**
2
+ * Copyright 2026 Google LLC
3
+ *
4
+ * Licensed under the Apache License, Version 2.0 (the "License");
5
+ * you may not use this file except in compliance with the License.
6
+ * You may obtain a copy of the License at
7
+ *
8
+ * http://www.apache.org/licenses/LICENSE-2.0
9
+ *
10
+ * Unless required by applicable law or agreed to in writing, software
11
+ * distributed under the License is distributed on an "AS IS" BASIS,
12
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ * See the License for the specific language governing permissions and
14
+ * limitations under the License.
15
+ */
16
+ /**
17
+ * Backend types for LiteRT-LM.
18
+ */
19
+ export const Backend = {
20
+ // Ideally, we'd pull these from the Wasm module, but we want them to be
21
+ // available in JS before the Wasm module is loaded.
22
+ UNSPECIFIED: 0,
23
+ CPU_ARTISAN: 1,
24
+ GPU_ARTISAN: 2,
25
+ CPU: 3,
26
+ GPU: 4,
27
+ GOOGLE_TENSOR_ARTISAN: 5,
28
+ NPU: 6,
29
+ };
30
+ /**
31
+ * LiteRT-LM SamplerType enum values
32
+ */
33
+ export const SamplerType = {
34
+ TYPE_UNSPECIFIED: 0,
35
+ TOP_K: 1,
36
+ TOP_P: 2,
37
+ GREEDY: 3,
38
+ };
39
+ //# sourceMappingURL=wasm_binding_types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"wasm_binding_types.js","sourceRoot":"","sources":["../src/wasm_binding_types.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAMH;;GAEG;AACH,MAAM,CAAC,MAAM,OAAO,GAAG;IACrB,wEAAwE;IACxE,oDAAoD;IACpD,WAAW,EAAE,CAAC;IACd,WAAW,EAAE,CAAC;IACd,WAAW,EAAE,CAAC;IACd,GAAG,EAAE,CAAC;IACN,GAAG,EAAE,CAAC;IACN,qBAAqB,EAAE,CAAC;IACxB,GAAG,EAAE,CAAC;CACP,CAAC;AAoQF;;GAEG;AACH,MAAM,CAAC,MAAM,WAAW,GAAG;IACzB,gBAAgB,EAAE,CAAC;IACnB,KAAK,EAAE,CAAC;IACR,KAAK,EAAE,CAAC;IACR,MAAM,EAAE,CAAC;CACD,CAAC"}
@@ -0,0 +1,42 @@
1
+ /**
2
+ * Copyright 2025 Google LLC
3
+ *
4
+ * Licensed under the Apache License, Version 2.0 (the "License");
5
+ * you may not use this file except in compliance with the License.
6
+ * You may obtain a copy of the License at
7
+ *
8
+ * http://www.apache.org/licenses/LICENSE-2.0
9
+ *
10
+ * Unless required by applicable law or agreed to in writing, software
11
+ * distributed under the License is distributed on an "AS IS" BASIS,
12
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ * See the License for the specific language governing permissions and
14
+ * limitations under the License.
15
+ */
16
+ interface SupportStatus {
17
+ supported: boolean;
18
+ error?: Error;
19
+ }
20
+ declare interface WasmFeatureValues {
21
+ relaxedSimd: Promise<SupportStatus> | undefined;
22
+ threads: Promise<SupportStatus> | undefined;
23
+ }
24
+ declare const WASM_FEATURE_VALUES: WasmFeatureValues;
25
+ declare const WASM_FEATURE_CHECKS: Record<keyof typeof WASM_FEATURE_VALUES, () => Promise<SupportStatus>>;
26
+ /**
27
+ * Check if a given WASM feature is supported.
28
+ *
29
+ * @param feature The feature to check.
30
+ * @return A promise that resolves to true if the feature is supported,
31
+ * false otherwise.
32
+ */
33
+ export declare function supportsFeature(feature: keyof typeof WASM_FEATURE_CHECKS): Promise<boolean>;
34
+ /**
35
+ * Throw an error if a given WASM feature is not supported.
36
+ *
37
+ * @param feature The feature to check.
38
+ * @throws An error if the feature is not supported.
39
+ */
40
+ export declare function throwIfFeatureNotSupported(feature: keyof typeof WASM_FEATURE_CHECKS): Promise<void>;
41
+ export {};
42
+ //# sourceMappingURL=wasm_feature_detect.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"wasm_feature_detect.d.ts","sourceRoot":"","sources":["../src/wasm_feature_detect.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAqCH,UAAU,aAAa;IACrB,SAAS,EAAE,OAAO,CAAC;IACnB,KAAK,CAAC,EAAE,KAAK,CAAC;CACf;AAID,OAAO,WAAW,iBAAiB;IACjC,WAAW,EAAE,OAAO,CAAC,aAAa,CAAC,GAAC,SAAS,CAAC;IAC9C,OAAO,EAAE,OAAO,CAAC,aAAa,CAAC,GAAC,SAAS,CAAC;CAC3C;AAED,QAAA,MAAM,mBAAmB,EAAE,iBAG1B,CAAC;AAWF,QAAA,MAAM,mBAAmB,EACrB,MAAM,CAAC,MAAM,OAAO,mBAAmB,EAAE,MAAM,OAAO,CAAC,aAAa,CAAC,CAqBpE,CAAC;AAEN;;;;;;GAMG;AACH,wBAAsB,eAAe,CACjC,OAAO,EAAE,MAAM,OAAO,mBAAmB,GAAG,OAAO,CAAC,OAAO,CAAC,CAO/D;AAED;;;;;GAKG;AACH,wBAAsB,0BAA0B,CAC5C,OAAO,EAAE,MAAM,OAAO,mBAAmB,GAAG,OAAO,CAAC,IAAI,CAAC,CAU5D"}