countTokens

abstract fun countTokens(text: JsAny, token: CancellationToken = definedExternally): PromiseLike<JsInt>(source)

Count the number of tokens in a message using the model specific tokenizer-logic.

Parameters

text

A string or a message instance.

token

Optional cancellation token. See CancellationTokenSource for how to create one.