simplify hack to fix original template's backfill from minja
This commit is contained in:
parent
bbd45bf6a2
commit
bff549deb6
1 changed files with 4 additions and 7 deletions
|
@ -604,13 +604,10 @@ static common_chat_params common_chat_params_init_deepseek_r1(const common_chat_
|
|||
}
|
||||
}
|
||||
// Fix up tool call delta example added by Minja
|
||||
std::string marker = "<|tool▁call▁end|>\n";
|
||||
auto pos = prompt.rfind(marker);
|
||||
if (pos != std::string::npos) {
|
||||
prompt.insert(pos + marker.size() - 1, "<|tool▁calls▁end|>");
|
||||
} else {
|
||||
LOG_WRN("Failed to find expected broken tool call example marker in prompt\n");
|
||||
}
|
||||
prompt = std::regex_replace(
|
||||
prompt,
|
||||
std::regex("<|tool▁call▁end|>[\\s\\r\\n]*<|User|>"),
|
||||
"<|tool▁call▁end|><|tool▁calls▁end|><|User|>");
|
||||
}
|
||||
data.prompt = prompt;
|
||||
data.format = COMMON_CHAT_FORMAT_DEEPSEEK_R1;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue