@goliapkg/tiktoken-wasm 3.2.3 → 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 +1 -1
- package/README.md +12 -2
- package/package.json +2 -4
- package/tiktoken_wasm.d.ts +57 -0
- package/tiktoken_wasm.js +740 -6
- package/tiktoken_wasm_bg.wasm +0 -0
- package/tiktoken_wasm_bg.js +0 -646
package/LICENSE
CHANGED
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",
|
|
@@ -11,13 +11,11 @@
|
|
|
11
11
|
"files": [
|
|
12
12
|
"tiktoken_wasm_bg.wasm",
|
|
13
13
|
"tiktoken_wasm.js",
|
|
14
|
-
"tiktoken_wasm_bg.js",
|
|
15
14
|
"tiktoken_wasm.d.ts"
|
|
16
15
|
],
|
|
17
16
|
"main": "tiktoken_wasm.js",
|
|
18
17
|
"types": "tiktoken_wasm.d.ts",
|
|
19
18
|
"sideEffects": [
|
|
20
|
-
"./tiktoken_wasm.js",
|
|
21
19
|
"./snippets/*"
|
|
22
20
|
]
|
|
23
|
-
}
|
|
21
|
+
}
|
package/tiktoken_wasm.d.ts
CHANGED
|
@@ -147,3 +147,60 @@ export function modelToEncoding(model: string): string | undefined;
|
|
|
147
147
|
* Returns an empty array for unknown providers.
|
|
148
148
|
*/
|
|
149
149
|
export function modelsByProvider(provider: string): ModelInfo[];
|
|
150
|
+
|
|
151
|
+
export type InitInput = RequestInfo | URL | Response | BufferSource | WebAssembly.Module;
|
|
152
|
+
|
|
153
|
+
export interface InitOutput {
|
|
154
|
+
readonly memory: WebAssembly.Memory;
|
|
155
|
+
readonly __wbg_encoding_free: (a: number, b: number) => void;
|
|
156
|
+
readonly __wbg_modelinfo_free: (a: number, b: number) => void;
|
|
157
|
+
readonly allModels: (a: number) => void;
|
|
158
|
+
readonly encodingForModel: (a: number, b: number, c: number) => void;
|
|
159
|
+
readonly encoding_count: (a: number, b: number, c: number) => number;
|
|
160
|
+
readonly encoding_countWithSpecialTokens: (a: number, b: number, c: number) => number;
|
|
161
|
+
readonly encoding_decode: (a: number, b: number, c: number, d: number) => void;
|
|
162
|
+
readonly encoding_encode: (a: number, b: number, c: number, d: number) => void;
|
|
163
|
+
readonly encoding_encodeWithSpecialTokens: (a: number, b: number, c: number, d: number) => void;
|
|
164
|
+
readonly encoding_name: (a: number, b: number) => void;
|
|
165
|
+
readonly encoding_vocabSize: (a: number) => number;
|
|
166
|
+
readonly estimateCost: (a: number, b: number, c: number, d: number, e: number) => void;
|
|
167
|
+
readonly getEncoding: (a: number, b: number, c: number) => void;
|
|
168
|
+
readonly getModelInfo: (a: number, b: number, c: number) => void;
|
|
169
|
+
readonly listEncodings: (a: number) => void;
|
|
170
|
+
readonly modelToEncoding: (a: number, b: number, c: number) => void;
|
|
171
|
+
readonly modelinfo_cachedInputPer1m: (a: number, b: number) => void;
|
|
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;
|
|
177
|
+
readonly modelinfo_inputPer1m: (a: number) => number;
|
|
178
|
+
readonly modelinfo_maxOutput: (a: number) => number;
|
|
179
|
+
readonly modelinfo_outputPer1m: (a: number) => number;
|
|
180
|
+
readonly __wbindgen_add_to_stack_pointer: (a: number) => number;
|
|
181
|
+
readonly __wbindgen_export: (a: number, b: number, c: number) => void;
|
|
182
|
+
readonly __wbindgen_export2: (a: number, b: number) => number;
|
|
183
|
+
readonly __wbindgen_export3: (a: number, b: number, c: number, d: number) => number;
|
|
184
|
+
}
|
|
185
|
+
|
|
186
|
+
export type SyncInitInput = BufferSource | WebAssembly.Module;
|
|
187
|
+
|
|
188
|
+
/**
|
|
189
|
+
* Instantiates the given `module`, which can either be bytes or
|
|
190
|
+
* a precompiled `WebAssembly.Module`.
|
|
191
|
+
*
|
|
192
|
+
* @param {{ module: SyncInitInput }} module - Passing `SyncInitInput` directly is deprecated.
|
|
193
|
+
*
|
|
194
|
+
* @returns {InitOutput}
|
|
195
|
+
*/
|
|
196
|
+
export function initSync(module: { module: SyncInitInput } | SyncInitInput): InitOutput;
|
|
197
|
+
|
|
198
|
+
/**
|
|
199
|
+
* If `module_or_path` is {RequestInfo} or {URL}, makes a request and
|
|
200
|
+
* for everything else, calls `WebAssembly.instantiate` directly.
|
|
201
|
+
*
|
|
202
|
+
* @param {{ module_or_path: InitInput | Promise<InitInput> }} module_or_path - Passing `InitInput` directly is deprecated.
|
|
203
|
+
*
|
|
204
|
+
* @returns {Promise<InitOutput>}
|
|
205
|
+
*/
|
|
206
|
+
export default function __wbg_init (module_or_path?: { module_or_path: InitInput | Promise<InitInput> } | InitInput | Promise<InitInput>): Promise<InitOutput>;
|