| 1259 | return data; |
| 1260 | } |
| 1261 | static void common_chat_parse_deepseek_r1(common_chat_msg_parser & builder) { |
| 1262 | builder.try_parse_reasoning("<think>", "</think>"); |
| 1263 | if (!builder.syntax().parse_tool_calls) { |
| 1264 | builder.add_content(builder.consume_rest()); |
| 1265 | return; |
| 1266 | } |
| 1267 | |
| 1268 | static const common_regex tool_calls_begin("(?:<|tool▁calls▁begin|>|<|tool_calls_begin|>|<|tool calls begin|>|<|tool\\\\_calls\\\\_begin|>|<|tool▁calls|>)"); |
| 1269 | static const common_regex tool_calls_end("<|tool▁calls▁end|>"); |
| 1270 | static const common_regex function_regex("(?:<|tool▁call▁begin|>)?function<|tool▁sep|>([^\n]+)\n```json\n"); |
| 1271 | static const common_regex close_regex("```[\\s\\r\\n]*<|tool▁call▁end|>"); |
| 1272 | |
| 1273 | parse_json_tool_calls( |
| 1274 | builder, |
| 1275 | /* block_open= */ tool_calls_begin, |
| 1276 | /* function_regex_start_only= */ std::nullopt, |
| 1277 | function_regex, |
| 1278 | close_regex, |
| 1279 | tool_calls_end); |
| 1280 | } |
| 1281 | |
| 1282 | static common_chat_params common_chat_params_init_firefunction_v2(const common_chat_template & tmpl, const struct templates_params & inputs) { |
| 1283 | LOG_DBG("%s\n", __func__); |
no test coverage detected