Package-level declarations
Types
Link copied to clipboard
A caching implementation of the PromptTokenizer interface that optimizes token counting by storing previously computed token counts for messages. This reduces redundant computations when the same message is processed multiple times.
Link copied to clipboard
A tokenizer implementation that always returns 0.
Link copied to clipboard
An implementation of the PromptTokenizer interface that delegates token counting to an instance of the Tokenizer interface. The class provides methods to estimate the token count for individual messages and for the entirety of a prompt.
Link copied to clipboard
interface PromptTokenizer
An interface that provides utilities for tokenizing and calculating token usage in messages and prompts.
Link copied to clipboard
A simple regex-based tokenizer that splits text on whitespace and common punctuation.