tokencounter

package
v0.2.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 21, 2025 License: MIT Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type TokenCounter

type TokenCounter struct {
	// contains filtered or unexported fields
}

func NewTokenCounter

func NewTokenCounter(encoding string) (*TokenCounter, error)

NewTokenCounter creates a new TokenCounter with the specified encoding. If encoding is empty, defaults to "o200k_base" (GPT-5 encoding). Supported encodings: o200k_base, cl100k_base, p50k_base, r50k_base, etc.

func (*TokenCounter) CountTokens

func (tc *TokenCounter) CountTokens(text string) (int, error)

func (*TokenCounter) CountTokensWithPath

func (tc *TokenCounter) CountTokensWithPath(text string, filePath string) (int, error)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL