Package io.codemodder.plugins.llm
Class Tokens
java.lang.Object
io.codemodder.plugins.llm.Tokens
A set of utilities around LLM tokens.
-
Method Summary
Modifier and TypeMethodDescriptionstatic intcountTokens(List<com.theokanning.openai.completion.chat.ChatMessage> messages) Estimates the number of tokens the messages will consume when passed to thegpt-3.5-turbo-0613orgpt-4-0613models.
-
Method Details
-
countTokens
Estimates the number of tokens the messages will consume when passed to thegpt-3.5-turbo-0613orgpt-4-0613models.This does not yet support estimating the number of tokens the functions will consume, since the unofficial solutions are brittle.
We should be able to replace this with
TikTokensUtil.tokenswhen the feature is released.- Parameters:
messages- The messages.- Returns:
- The number of tokens.
- See Also:
-