| 47 | } |
| 48 | |
| 49 | std::string Qwen3::apply_chat_template(nlohmann::ordered_json& messages, nlohmann::ordered_json tools) { |
| 50 | minja::chat_template_inputs inputs; |
| 51 | inputs.add_generation_prompt = true; |
| 52 | inputs.messages = messages; |
| 53 | inputs.extra_context = this->extra_context; |
| 54 | inputs.extra_context["enable_thinking"] = this->enable_think; |
| 55 | if (!tools.empty() && this->enable_tool) |
| 56 | inputs.tools = tools; |
| 57 | return this->chat_tmpl->apply(inputs); |
| 58 | } |
| 59 | |
| 60 | bool Qwen3::insert(chat_meta_info_t& meta_info, lm_uniform_input_t& input, std::function<bool()> is_cancelled) { |
| 61 | // preprocess |