tiktoken-node
TypeScript icon, indicating that this package has built-in type declarations

0.0.7 • Public • Published

⏳ tiktoken-node

tiktoken is a fast BPE tokeniser for use with OpenAI's models.

const tiktoken = require('tiktoken-node')
let enc = tiktoken.getEncoding("gpt2")
console.assert(enc.decode(enc.encode("hello world")) == "hello world")

// To get the tokeniser corresponding to a specific model in the OpenAI API:
enc = tiktoken.encodingForModel("text-davinci-003")

The open source version of tiktoken-node can be installed from npm:

npm install tiktoken-node

Dependencies (0)

    Dev Dependencies (2)

    Package Sidebar

    Install

    npm i tiktoken-node

    Weekly Downloads

    3,773

    Version

    0.0.7

    License

    MIT

    Unpacked Size

    33.1 MB

    Total Files

    10

    Last publish

    Collaborators

    • ceifa