tokens

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: May 31, 2026 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Count

func Count(s string) int

Count returns the number of BPE tokens in s under cl100k_base. Returns 0 for the empty string. Panics if Init has not been called successfully — thesis-2 loud-fail: a count without init is a wiring bug. The encoder pointer is the source of truth: nil ⇒ Init never ran or failed.

func Init

func Init() error

Init loads the cl100k_base BPE table. Safe to call multiple times; repeated calls are no-ops. Returns the first init error if loading failed. Call from server.New so a corrupt embed fails startup loudly, not on first request.

Types

This section is empty.

Jump to

Keyboard shortcuts

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