mirror of
https://github.com/ikechan8370/chatgpt-plugin.git
synced 2025-12-17 13:57:10 +00:00
fix: 2.7 dev start
This commit is contained in:
parent
fbe8953667
commit
4a4dceec18
7 changed files with 5459 additions and 6 deletions
8
utils/openai/tokenizer.ts
Normal file
8
utils/openai/tokenizer.ts
Normal file
|
|
@ -0,0 +1,8 @@
|
|||
import { getEncoding } from 'js-tiktoken'
|
||||
|
||||
// TODO: make this configurable
|
||||
const tokenizer = getEncoding('cl100k_base')
|
||||
|
||||
export function encode(input: string): Uint32Array {
|
||||
return new Uint32Array(tokenizer.encode(input))
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue