tokenCountFor
Computes the number of tokens in a given message.
Return
The estimated number of tokens in the message content.
Parameters
message
The message for which the token count needs to be calculated. The content of the message is analyzed to estimate the token count.
Calculates the total number of tokens spent for the given prompt based on its messages.
Return
The total number of tokens across all messages in the prompt.
Parameters
prompt
The Prompt
instance containing the list of messages for which the total token count will be calculated.