MCPcopy Create free account
hub / github.com/appdevforall/CodeOnTheGo / tokenize

Function tokenize

subprojects/llama.cpp/tools/server/chat.mjs:63–74  ·  view source on GitHub ↗
(content)

Source from the content-addressed store, hash-verified

61}
62
63async function tokenize(content) {
64 const result = await fetch(`${API_URL}/tokenize`, {
65 method: 'POST',
66 body: JSON.stringify({ content })
67 })
68
69 if (!result.ok) {
70 return []
71 }
72
73 return await result.json().tokens
74}
75
76const n_keep = await tokenize(instruction).length
77

Callers 6

countTokensMethod · 0.85
tokenizeMethod · 0.85
sendMethod · 0.85
chat.mjsFile · 0.85
loadMethod · 0.85
tokenizeMethod · 0.85

Calls 1

jsonMethod · 0.80

Tested by

no test coverage detected