ContextWindow.count_tokens()

Count tokens in text using the configured counter.

Usage

Source

ContextWindow.count_tokens(text)

Parameters

text: str
The text to count tokens for.

Returns

int
Token count.