MCPcopy Index your code
hub / github.com/codehamr/codehamr / Tokens

Function Tokens

internal/ctx/ctx.go:35–35  ·  view source on GitHub ↗

Tokens approximates token count as char/4, good enough for budgeting.

(s string)

Source from the content-addressed store, hash-verified

33}
34
35// Tokens approximates token count as char/4, good enough for budgeting.
36func Tokens(s string) int { return (len(s) + 3) / 4 }
37
38func (m Message) Tokens() int {

Callers 5

TokensMethod · 0.85
TruncateFunction · 0.85
TestTokensHeuristicFunction · 0.85

Calls

no outgoing calls

Tested by 3

TestTokensHeuristicFunction · 0.68