@@ -64,6 +64,7 @@ static const std::map<std::string, llm_chat_template> LLM_CHAT_TEMPLATES = {
64
64
{ " bailing" , LLM_CHAT_TEMPLATE_BAILING },
65
65
{ " llama4" , LLM_CHAT_TEMPLATE_LLAMA4 },
66
66
{ " smolvlm" , LLM_CHAT_TEMPLATE_SMOLVLM },
67
+ { " seed-coder" , LLM_CHAT_TEMPLATE_SEED_CODER },
67
68
};
68
69
69
70
llm_chat_template llm_chat_template_from_str (const std::string & name) {
@@ -183,6 +184,9 @@ llm_chat_template llm_chat_detect_template(const std::string & tmpl) {
183
184
return LLM_CHAT_TEMPLATE_BAILING;
184
185
} else if (tmpl_contains (" <|header_start|>" ) && tmpl_contains (" <|header_end|>" )) {
185
186
return LLM_CHAT_TEMPLATE_LLAMA4;
187
+ } else if (tmpl_contains (" raise_exception" ) && tmpl_contains (" System role not supported" ) &&
188
+ tmpl_contains (" Conversation roles must alternate user/assistant/user/assistant/..." )) {
189
+ return LLM_CHAT_TEMPLATE_SEED_CODER;
186
190
}
187
191
return LLM_CHAT_TEMPLATE_UNKNOWN;
188
192
}
@@ -643,6 +647,17 @@ int32_t llm_chat_apply_template(
643
647
if (add_ass) {
644
648
ss << " Assistant:" ;
645
649
}
650
+ } else if (tmpl == LLM_CHAT_TEMPLATE_SEED_CODER) {
651
+ // Seed-Coder
652
+ for (auto message : chat) {
653
+ std::string role (message->role );
654
+ if (role == " user" ) {
655
+ ss << " <[begin▁of▁sentence]>" << role << " \n " << trim (message->content ) << " <[end▁of▁sentence]>" ;
656
+ }
657
+ }
658
+ if (add_ass) {
659
+ ss << " <[begin▁of▁sentence]>assistant\n " ;
660
+ }
646
661
} else {
647
662
// template not supported
648
663
return -1 ;
0 commit comments