| 496 | } |
| 497 | |
| 498 | const char * common_chat_templates_source(const struct common_chat_templates * tmpls, const char * variant) { |
| 499 | if (variant != nullptr) { |
| 500 | if (strcmp(variant, "tool_use") == 0) { |
| 501 | if (tmpls->template_tool_use) { |
| 502 | return tmpls->template_tool_use->source().c_str(); |
| 503 | } |
| 504 | return nullptr; |
| 505 | } else { |
| 506 | LOG_DBG("%s: unknown template variant: %s\n", __func__, variant); |
| 507 | } |
| 508 | } |
| 509 | return tmpls->template_default->source().c_str(); |
| 510 | } |
| 511 | |
| 512 | common_chat_templates_ptr common_chat_templates_init( |
| 513 | const struct llama_model * model, |