| 44 | } |
| 45 | |
| 46 | std::string Gemma3::apply_chat_template(nlohmann::ordered_json& messages, nlohmann::ordered_json tools) { |
| 47 | minja::chat_template_inputs inputs; |
| 48 | inputs.add_generation_prompt = true; |
| 49 | inputs.messages = messages; |
| 50 | inputs.extra_context = this->extra_context; |
| 51 | return this->chat_tmpl->apply(inputs); |
| 52 | } |
| 53 | |
| 54 | bool Gemma3::insert(chat_meta_info_t& meta_info, lm_uniform_input_t& input, std::function<bool()> is_cancelled) { |
| 55 | static constexpr int IMAGE_TOKEN_ID = 262144; // replace with actual image token ID |