Product
Introducing License Enforcement in Socket
Ensure open-source compliance with Socket’s License Enforcement Beta. Set up your License Policy and secure your software!
js-tiktoken
Advanced tools
tiktoken is a BPE tokeniser for use with OpenAI's models. This is a pure JS port of the original tiktoken library.
Install the library from NPM:
npm install js-tiktoken
Basic usage follows, which includes all the OpenAI encoders and ranks:
import assert from "node:assert";
import { getEncoding, encodingForModel } from "js-tiktoken";
const enc = getEncoding("gpt2");
assert(enc.decode(enc.encode("hello world")) === "hello world");
FAQs
JavaScript port of tiktoken
The npm package js-tiktoken receives a total of 508,585 weekly downloads. As such, js-tiktoken popularity was classified as popular.
We found that js-tiktoken demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Product
Ensure open-source compliance with Socket’s License Enforcement Beta. Set up your License Policy and secure your software!
Product
We're launching a new set of license analysis and compliance features for analyzing, managing, and complying with licenses across a range of supported languages and ecosystems.
Product
We're excited to introduce Socket Optimize, a powerful CLI command to secure open source dependencies with tested, optimized package overrides.