@goliapkg/tiktoken-wasm 3.6.0 → 3.7.1
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.
- package/README.md +9 -3
- package/package.json +1 -1
- package/tiktoken_wasm.js +11 -7
- package/tiktoken_wasm_bg.wasm +0 -0
package/README.md
CHANGED
|
@@ -122,7 +122,7 @@ module.exports = {
|
|
|
122
122
|
|
|
123
123
|
### `listEncodings(): string[]`
|
|
124
124
|
|
|
125
|
-
List all available encoding names (
|
|
125
|
+
List all available encoding names (17 encodings).
|
|
126
126
|
|
|
127
127
|
### `getEncoding(name: string): Encoding`
|
|
128
128
|
|
|
@@ -138,6 +138,12 @@ Get a tokenizer by encoding name. Supported:
|
|
|
138
138
|
- `deepseek_v3` — DeepSeek V3/R1
|
|
139
139
|
- `qwen2` — Qwen 2/2.5/3
|
|
140
140
|
- `mistral_v3` — Mistral/Codestral/Pixtral (Tekken)
|
|
141
|
+
- `deepseek_v4` — DeepSeek V4 Pro/Flash
|
|
142
|
+
- `kimi_k2` — Kimi K2/K2.5/K2.6
|
|
143
|
+
- `kimi_k3` — Kimi K3
|
|
144
|
+
- `glm4` — GLM-4.5/4.6/4.7
|
|
145
|
+
- `glm5` — GLM-5/5.2
|
|
146
|
+
- `minimax_m2` — MiniMax M2 family
|
|
141
147
|
|
|
142
148
|
### `encodingForModel(model: string): Encoding`
|
|
143
149
|
|
|
@@ -163,7 +169,7 @@ Map a model name to its encoding name without loading the encoding.
|
|
|
163
169
|
|
|
164
170
|
### `estimateCost(modelId, inputTokens, outputTokens): number`
|
|
165
171
|
|
|
166
|
-
Estimate API cost in USD. Supports
|
|
172
|
+
Estimate API cost in USD. Supports 107 models across 10 providers.
|
|
167
173
|
|
|
168
174
|
### `getModelInfo(modelId): ModelInfo`
|
|
169
175
|
|
|
@@ -171,7 +177,7 @@ Get model metadata with full TypeScript typing.
|
|
|
171
177
|
|
|
172
178
|
### `allModels(): ModelInfo[]`
|
|
173
179
|
|
|
174
|
-
List all
|
|
180
|
+
List all 107 supported models with pricing info.
|
|
175
181
|
|
|
176
182
|
### `modelsByProvider(provider): ModelInfo[]`
|
|
177
183
|
|
package/package.json
CHANGED
package/tiktoken_wasm.js
CHANGED
|
@@ -275,7 +275,7 @@ export function allModels() {
|
|
|
275
275
|
wasm.allModels(retptr);
|
|
276
276
|
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
277
277
|
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
278
|
-
var v1 = getArrayJsValueFromWasm0(r0, r1)
|
|
278
|
+
var v1 = getArrayJsValueFromWasm0(r0, r1);
|
|
279
279
|
wasm.__wbindgen_export(r0, r1 * 4, 4);
|
|
280
280
|
return v1;
|
|
281
281
|
} finally {
|
|
@@ -416,7 +416,7 @@ export function listEncodings() {
|
|
|
416
416
|
wasm.listEncodings(retptr);
|
|
417
417
|
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
418
418
|
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
419
|
-
var v1 = getArrayJsValueFromWasm0(r0, r1)
|
|
419
|
+
var v1 = getArrayJsValueFromWasm0(r0, r1);
|
|
420
420
|
wasm.__wbindgen_export(r0, r1 * 4, 4);
|
|
421
421
|
return v1;
|
|
422
422
|
} finally {
|
|
@@ -441,7 +441,7 @@ export function modelToEncoding(model) {
|
|
|
441
441
|
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
442
442
|
let v2;
|
|
443
443
|
if (r0 !== 0) {
|
|
444
|
-
v2 = getStringFromWasm0(r0, r1)
|
|
444
|
+
v2 = getStringFromWasm0(r0, r1);
|
|
445
445
|
wasm.__wbindgen_export(r0, r1 * 1, 1);
|
|
446
446
|
}
|
|
447
447
|
return v2;
|
|
@@ -466,7 +466,7 @@ export function modelsByProvider(provider) {
|
|
|
466
466
|
wasm.modelsByProvider(retptr, ptr0, len0);
|
|
467
467
|
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
468
468
|
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
469
|
-
var v2 = getArrayJsValueFromWasm0(r0, r1)
|
|
469
|
+
var v2 = getArrayJsValueFromWasm0(r0, r1);
|
|
470
470
|
wasm.__wbindgen_export(r0, r1 * 4, 4);
|
|
471
471
|
return v2;
|
|
472
472
|
} finally {
|
|
@@ -476,11 +476,11 @@ export function modelsByProvider(provider) {
|
|
|
476
476
|
function __wbg_get_imports() {
|
|
477
477
|
const import0 = {
|
|
478
478
|
__proto__: null,
|
|
479
|
-
|
|
479
|
+
__wbg_Error_408e67f47ca7b58b: function(arg0, arg1) {
|
|
480
480
|
const ret = Error(getStringFromWasm0(arg0, arg1));
|
|
481
481
|
return addHeapObject(ret);
|
|
482
482
|
},
|
|
483
|
-
|
|
483
|
+
__wbg___wbindgen_throw_bb96b2010945f0bc: function(arg0, arg1) {
|
|
484
484
|
throw new Error(getStringFromWasm0(arg0, arg1));
|
|
485
485
|
},
|
|
486
486
|
__wbg_modelinfo_new: function(arg0) {
|
|
@@ -663,11 +663,15 @@ function __wbg_finalize_init(instance, module) {
|
|
|
663
663
|
|
|
664
664
|
async function __wbg_load(module, imports) {
|
|
665
665
|
if (typeof Response === 'function' && module instanceof Response) {
|
|
666
|
+
if (!module.ok) {
|
|
667
|
+
throw new Error(`failed to fetch Wasm: ${module.status} ${module.statusText} fetching '${module.url}'`);
|
|
668
|
+
}
|
|
669
|
+
|
|
666
670
|
if (typeof WebAssembly.instantiateStreaming === 'function') {
|
|
667
671
|
try {
|
|
668
672
|
return await WebAssembly.instantiateStreaming(module, imports);
|
|
669
673
|
} catch (e) {
|
|
670
|
-
const validResponse =
|
|
674
|
+
const validResponse = expectedResponseType(module.type);
|
|
671
675
|
|
|
672
676
|
if (validResponse && module.headers.get('Content-Type') !== 'application/wasm') {
|
|
673
677
|
console.warn("`WebAssembly.instantiateStreaming` failed because your server does not serve Wasm with `application/wasm` MIME type. Falling back to `WebAssembly.instantiate` which is slower. Original error:\n", e);
|
package/tiktoken_wasm_bg.wasm
CHANGED
|
Binary file
|