| 565 | } |
| 566 | |
| 567 | std::string common_chat_templates_source(const struct common_chat_templates * tmpls, const std::string & variant) { |
| 568 | if (!variant.empty()) { |
| 569 | if (variant == "tool_use") { |
| 570 | if (tmpls->template_tool_use) { |
| 571 | return tmpls->template_tool_use->source(); |
| 572 | } |
| 573 | return ""; |
| 574 | } |
| 575 | LOG_DBG("%s: unknown template variant: %s\n", __func__, variant.c_str()); |
| 576 | } |
| 577 | return tmpls->template_default->source(); |
| 578 | } |
| 579 | |
| 580 | common_chat_templates_ptr common_chat_templates_init(const struct llama_model * model, |
| 581 | const std::string & chat_template_override, |