mirror of
https://github.com/sqlchat/sqlchat.git
synced 2025-07-30 10:43:06 +08:00
feat: implement token counter (#3)
This commit is contained in:
@ -1 +1,7 @@
|
||||
import { encode } from "@nem035/gpt-3-encoder";
|
||||
|
||||
export const openAIApiKey = process.env.OPENAI_API_KEY;
|
||||
|
||||
export const countTextTokens = (text: string) => {
|
||||
return encode(text).length;
|
||||
};
|
||||
|
Reference in New Issue
Block a user