6 lines
135 B
TypeScript
6 lines
135 B
TypeScript
|
import { encode } from "gpt-3-encoder";
|
||
|
|
||
|
export default function countTokens(text: string): number {
|
||
|
return encode(text).length;
|
||
|
}
|