package example;

import com.theokanning.openai.completion.chat.ChatMessage;
import com.theokanning.openai.completion.chat.ChatMessageRole;
import com.theokanning.openai.utils.TikTokensUtil;

import java.util.ArrayList;
import java.util.List;

class TikTokensExample {

    public static void main(String... args) {
        List<ChatMessage> messages = new ArrayList<>();
        messages.add(new ChatMessage(ChatMessageRole.SYSTEM.value(), "Hello OpenAI 1."));
        messages.add(new ChatMessage(ChatMessageRole.SYSTEM.value(), "Hello OpenAI 2.   "));

        int tokens_1 = TikTokensUtil.tokens(TikTokensUtil.ModelEnum.GPT_3_5_TURBO.getName(), messages);
        int tokens_2 = TikTokensUtil.tokens(TikTokensUtil.ModelEnum.GPT_3_5_TURBO.getName(), "Hello OpenAI 1.");
    }

}

com.theokanning.openai.completion.chat.ChatMessageRole.SYSTEM.value com.theokanning.openai.utils.TikTokensUtil.ModelEnum.GPT_3_5_TURBO.getName
[((409, 439), 'com.theokanning.openai.completion.chat.ChatMessageRole.SYSTEM.value'), ((499, 529), 'com.theokanning.openai.completion.chat.ChatMessageRole.SYSTEM.value'), ((600, 647), 'com.theokanning.openai.utils.TikTokensUtil.ModelEnum.GPT_3_5_TURBO.getName'), ((704, 751), 'com.theokanning.openai.utils.TikTokensUtil.ModelEnum.GPT_3_5_TURBO.getName')]