countTokens

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

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

Parameters

text

A string.

token

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