mirror of
https://github.com/Mintplex-Labs/tiktoken.git
synced 2026-07-19 13:54:01 -04:00
Update examples
This commit is contained in:
@@ -29,7 +29,7 @@ async function encodingForModel(
|
||||
}
|
||||
|
||||
async function main() {
|
||||
const encodings = await encodingForModel("gpt-4");
|
||||
const encodings = await encodingForModel("gpt-4-1106-preview");
|
||||
const text = "function foo() { return 1; }";
|
||||
const tokens = encodings.encode(text);
|
||||
console.log(tokens);
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import assert from "node:assert";
|
||||
import { getEncoding } from "../dist";
|
||||
|
||||
const enc = getEncoding("gpt2");
|
||||
const enc = getEncoding("cl100k_base");
|
||||
assert(enc.decode(enc.encode("hello world")) === "hello world");
|
||||
|
||||
Reference in New Issue
Block a user