@goliapkg/tiktoken-wasm 3.2.4 → 3.2.5
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/LICENSE +21 -0
- package/README.md +12 -2
- package/package.json +2 -2
- package/tiktoken_wasm.d.ts +4 -4
- package/tiktoken_wasm.js +7 -9
- package/tiktoken_wasm_bg.wasm +0 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 GOLIA株式会社
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
CHANGED
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
# @goliapkg/tiktoken-wasm
|
|
2
2
|
|
|
3
3
|
[](https://www.npmjs.com/package/@goliapkg/tiktoken-wasm)
|
|
4
|
-
[](
|
|
4
|
+
[](LICENSE)
|
|
5
|
+
|
|
6
|
+
**English** | [简体中文](README.zh-CN.md) | [日本語](README.ja.md)
|
|
5
7
|
|
|
6
8
|
WebAssembly bindings for the [tiktoken](https://crates.io/crates/tiktoken) BPE tokenizer — run multi-provider tokenization directly in the browser or Node.js with near-native performance.
|
|
7
9
|
|
|
@@ -211,6 +213,14 @@ Call `await init()` once before any other API calls. This loads and compiles the
|
|
|
211
213
|
|
|
212
214
|
See [`examples/react-app`](../tiktoken/examples/react-app/) for a complete Vite + React demo application.
|
|
213
215
|
|
|
216
|
+
<!-- ECOSYSTEM BEGIN (generated — edit ecosystem.toml, not this block) -->
|
|
217
|
+
|
|
218
|
+
## Ecosystem
|
|
219
|
+
|
|
220
|
+
[tiktoken](https://crates.io/crates/tiktoken) · **@goliapkg/tiktoken-wasm** · [instructors](https://crates.io/crates/instructors) · [chunkedrs](https://crates.io/crates/chunkedrs) · [embedrs](https://crates.io/crates/embedrs)
|
|
221
|
+
|
|
222
|
+
<!-- ECOSYSTEM END -->
|
|
223
|
+
|
|
214
224
|
## License
|
|
215
225
|
|
|
216
|
-
[MIT](
|
|
226
|
+
[MIT](LICENSE)
|
package/package.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"name": "@goliapkg/tiktoken-wasm",
|
|
3
3
|
"type": "module",
|
|
4
4
|
"description": "WASM bindings for the tiktoken BPE tokenizer",
|
|
5
|
-
"version": "3.2.
|
|
5
|
+
"version": "3.2.5",
|
|
6
6
|
"license": "MIT",
|
|
7
7
|
"repository": {
|
|
8
8
|
"type": "git",
|
|
@@ -18,4 +18,4 @@
|
|
|
18
18
|
"sideEffects": [
|
|
19
19
|
"./snippets/*"
|
|
20
20
|
]
|
|
21
|
-
}
|
|
21
|
+
}
|
package/tiktoken_wasm.d.ts
CHANGED
|
@@ -162,7 +162,6 @@ export interface InitOutput {
|
|
|
162
162
|
readonly encoding_encode: (a: number, b: number, c: number, d: number) => void;
|
|
163
163
|
readonly encoding_encodeWithSpecialTokens: (a: number, b: number, c: number, d: number) => void;
|
|
164
164
|
readonly encoding_name: (a: number, b: number) => void;
|
|
165
|
-
readonly encoding_numSpecialTokens: (a: number) => number;
|
|
166
165
|
readonly encoding_vocabSize: (a: number) => number;
|
|
167
166
|
readonly estimateCost: (a: number, b: number, c: number, d: number, e: number) => void;
|
|
168
167
|
readonly getEncoding: (a: number, b: number, c: number) => void;
|
|
@@ -170,13 +169,14 @@ export interface InitOutput {
|
|
|
170
169
|
readonly listEncodings: (a: number) => void;
|
|
171
170
|
readonly modelToEncoding: (a: number, b: number, c: number) => void;
|
|
172
171
|
readonly modelinfo_cachedInputPer1m: (a: number, b: number) => void;
|
|
173
|
-
readonly modelinfo_contextWindow: (a: number) => number;
|
|
174
172
|
readonly modelinfo_id: (a: number, b: number) => void;
|
|
173
|
+
readonly modelinfo_provider: (a: number, b: number) => void;
|
|
174
|
+
readonly modelsByProvider: (a: number, b: number, c: number) => void;
|
|
175
|
+
readonly encoding_numSpecialTokens: (a: number) => number;
|
|
176
|
+
readonly modelinfo_contextWindow: (a: number) => number;
|
|
175
177
|
readonly modelinfo_inputPer1m: (a: number) => number;
|
|
176
178
|
readonly modelinfo_maxOutput: (a: number) => number;
|
|
177
179
|
readonly modelinfo_outputPer1m: (a: number) => number;
|
|
178
|
-
readonly modelinfo_provider: (a: number, b: number) => void;
|
|
179
|
-
readonly modelsByProvider: (a: number, b: number, c: number) => void;
|
|
180
180
|
readonly __wbindgen_add_to_stack_pointer: (a: number) => number;
|
|
181
181
|
readonly __wbindgen_export: (a: number, b: number, c: number) => void;
|
|
182
182
|
readonly __wbindgen_export2: (a: number, b: number) => number;
|
package/tiktoken_wasm.js
CHANGED
|
@@ -8,7 +8,6 @@
|
|
|
8
8
|
*/
|
|
9
9
|
export class Encoding {
|
|
10
10
|
static __wrap(ptr) {
|
|
11
|
-
ptr = ptr >>> 0;
|
|
12
11
|
const obj = Object.create(Encoding.prototype);
|
|
13
12
|
obj.__wbg_ptr = ptr;
|
|
14
13
|
EncodingFinalization.register(obj, obj.__wbg_ptr, obj);
|
|
@@ -166,7 +165,6 @@ if (Symbol.dispose) Encoding.prototype[Symbol.dispose] = Encoding.prototype.free
|
|
|
166
165
|
*/
|
|
167
166
|
export class ModelInfo {
|
|
168
167
|
static __wrap(ptr) {
|
|
169
|
-
ptr = ptr >>> 0;
|
|
170
168
|
const obj = Object.create(ModelInfo.prototype);
|
|
171
169
|
obj.__wbg_ptr = ptr;
|
|
172
170
|
ModelInfoFinalization.register(obj, obj.__wbg_ptr, obj);
|
|
@@ -476,11 +474,11 @@ export function modelsByProvider(provider) {
|
|
|
476
474
|
function __wbg_get_imports() {
|
|
477
475
|
const import0 = {
|
|
478
476
|
__proto__: null,
|
|
479
|
-
|
|
477
|
+
__wbg_Error_ef53bc310eb298a0: function(arg0, arg1) {
|
|
480
478
|
const ret = Error(getStringFromWasm0(arg0, arg1));
|
|
481
479
|
return addHeapObject(ret);
|
|
482
480
|
},
|
|
483
|
-
|
|
481
|
+
__wbg___wbindgen_throw_1506f2235d1bdba0: function(arg0, arg1) {
|
|
484
482
|
throw new Error(getStringFromWasm0(arg0, arg1));
|
|
485
483
|
},
|
|
486
484
|
__wbg_modelinfo_new: function(arg0) {
|
|
@@ -501,10 +499,10 @@ function __wbg_get_imports() {
|
|
|
501
499
|
|
|
502
500
|
const EncodingFinalization = (typeof FinalizationRegistry === 'undefined')
|
|
503
501
|
? { register: () => {}, unregister: () => {} }
|
|
504
|
-
: new FinalizationRegistry(ptr => wasm.__wbg_encoding_free(ptr
|
|
502
|
+
: new FinalizationRegistry(ptr => wasm.__wbg_encoding_free(ptr, 1));
|
|
505
503
|
const ModelInfoFinalization = (typeof FinalizationRegistry === 'undefined')
|
|
506
504
|
? { register: () => {}, unregister: () => {} }
|
|
507
|
-
: new FinalizationRegistry(ptr => wasm.__wbg_modelinfo_free(ptr
|
|
505
|
+
: new FinalizationRegistry(ptr => wasm.__wbg_modelinfo_free(ptr, 1));
|
|
508
506
|
|
|
509
507
|
function addHeapObject(obj) {
|
|
510
508
|
if (heap_next === heap.length) heap.push(heap.length + 1);
|
|
@@ -545,8 +543,7 @@ function getDataViewMemory0() {
|
|
|
545
543
|
}
|
|
546
544
|
|
|
547
545
|
function getStringFromWasm0(ptr, len) {
|
|
548
|
-
|
|
549
|
-
return decodeText(ptr, len);
|
|
546
|
+
return decodeText(ptr >>> 0, len);
|
|
550
547
|
}
|
|
551
548
|
|
|
552
549
|
let cachedUint32ArrayMemory0 = null;
|
|
@@ -651,8 +648,9 @@ if (!('encodeInto' in cachedTextEncoder)) {
|
|
|
651
648
|
|
|
652
649
|
let WASM_VECTOR_LEN = 0;
|
|
653
650
|
|
|
654
|
-
let wasmModule, wasm;
|
|
651
|
+
let wasmModule, wasmInstance, wasm;
|
|
655
652
|
function __wbg_finalize_init(instance, module) {
|
|
653
|
+
wasmInstance = instance;
|
|
656
654
|
wasm = instance.exports;
|
|
657
655
|
wasmModule = module;
|
|
658
656
|
cachedDataViewMemory0 = null;
|
package/tiktoken_wasm_bg.wasm
CHANGED
|
Binary file
|