Repository: ggerganov/llama.cpp
File: src/llama-chat.cpp (C++)

Code before:
            }
        }
        if (add_ass) {
            ss << "
";
        }
    } else if (tmpl == LLM_CHAT_TEMPLATE_HUNYUAN_MOE) {
        // tencent/Hunyuan-A13B-Instruct
        for (auto message : chat) {
            std::string role(message->role);
            if (role == "system") {
                ss << "
" << message->content << "
";
            } else if (role == "assistant") {
                ss << message->content << "
";
            } else {
                ss << "
" << message->content << "
";
            }
        }
    } else if (tmpl == LLM_CHAT_TEMPLATE_HUNYUAN_DENSE) {
        // tencent/Hunyuan-4B
        for (size_t i = 0; i < chat.size(); i++) {
            std::string role(chat[i]->role);
            if (i == 0) {
                if (role == "system") {
                    ss << "<｜hy_begin▁of▁sentence｜>" << chat[i]->content << "<｜hy_place▁holder▁no▁3｜>";
                } else {
                    ss << "<｜hy_begin▁of▁sentence｜>";
                }
            }

            if (role == "assistant") {
                ss << "<｜hy_Assistant｜>" << chat[i]->content << "<｜hy_place▁holder▁no▁2｜>";
            } else if (role == "user") {
                ss << "<｜hy_User｜>" << chat[i]->content;
            }
        }
        if (add_ass) {
            ss << "<｜hy_Assistant｜>";
        } else {
            ss << "<｜hy_place▁holder▁no▁8｜>";
        }
    } else if (tmpl == LLM_CHAT_TEMPLATE_KIMI_K2) {
        // moonshotai/Kimi-K2-Instruct
        for (auto message : chat) {
            std::string role(message->role);
            if (role == "system") {
                ss << "
system
";
            } else if (role == "user") {
                ss << "
user
";
            } else if (role == "assistant") {
                ss << "
assistant
";
            } else if (role == "tool") {

Review comment (suggestion):
Unlike the jinja chat template you should not add `BOS` here, it will get automatically added depending on the `add_bos_token` metadata.

Code after:
            }
        }
        if (add_ass) {
            ss << "
";
        }
    } else if (tmpl == LLM_CHAT_TEMPLATE_HUNYUAN_MOE) {
        // tencent/Hunyuan-A13B-Instruct
        for (auto message : chat) {
            std::string role(message->role);
            if (role == "system") {
                ss << "
" << message->content << "
";
            } else if (role == "assistant") {
                ss << message->content << "
";
            } else {
                ss << "
" << message->content << "
";
            }
        }
    } else if (tmpl == LLM_CHAT_TEMPLATE_HUNYUAN_DENSE) {
        // tencent/Hunyuan-4B-Instruct
        for (size_t i = 0; i < chat.size(); i++) {
            std::string role(chat[i]->role);
            if (i == 0) {
                if (role == "system") {
                    ss << chat[i]->content << "<｜hy_place▁holder▁no▁3｜>";
                }
            }

            if (role == "assistant") {
                ss << "<｜hy_Assistant｜>" << chat[i]->content << "<｜hy_place▁holder▁no▁2｜>";
            } else if (role == "user") {
                ss << "<｜hy_User｜>" << chat[i]->content << "<｜hy_Assistant｜>";
            }
        }
    } else if (tmpl == LLM_CHAT_TEMPLATE_KIMI_K2) {
        // moonshotai/Kimi-K2-Instruct
        for (auto message : chat) {
            std::string role(message->role);
            if (role == "system") {
                ss << "
system
";
            } else if (role == "user") {
                ss << "
user
";
            } else if (role == "assistant") {
                ss << "
assistant
";
            } else if (role == "tool") {
                ss << "
tool
";
            }

            ss << message->content << "
";

            if (add_ass) {
                ss << "
assistant
";