MCPcopy Create free account
hub / github.com/bricks-cloud/BricksLLM / Count

Function Count

internal/provider/custom/token.go:11–19  ·  view source on GitHub ↗
(input string)

Source from the content-addressed store, hash-verified

9}
10
11func Count(input string) (int, error) {
12 encoder, err := tiktoken.GetEncoding("cl100k_base")
13 if err != nil {
14 return 0, err
15 }
16
17 token := encoder.Encode(input, nil, nil)
18 return len(token), nil
19}

Callers 2

countTokensFromJsonFunction · 0.92
decorateEventMethod · 0.92

Calls

no outgoing calls

Tested by

no test coverage detected