tokenCountFor

abstract fun tokenCountFor(message: Message): Int(source)

Calculates the number of tokens required for a given message.

Return

The number of tokens required to encode the message.

Parameters

message

The message for which the token count should be determined.


abstract fun tokenCountFor(prompt: Prompt): Int(source)

Calculates the total number of tokens spent in a given prompt.

Return

The total number of tokens spent as an integer.

Parameters

prompt

The prompt for which the total tokens spent need to be calculated.