MCPcopy Create free account
hub / github.com/Xyntopia/taskyon / countStringTokens

Function countStringTokens

src/modules/chat.ts:201–205  ·  view source on GitHub ↗
(txt: string)

Source from the content-addressed store, hash-verified

199const enc = getEncoding('gpt2');
200
201export function countStringTokens(txt: string) {
202 // Tokenize the content
203 const content = enc.encode(txt);
204 return content.length;
205}
206
207function countChatTokens(
208 chatMessages: (

Callers 3

countChatTokensFunction · 0.85
countToolTokensFunction · 0.85
estimateChatTokensFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected