common : replace wrap_for_generation with a prefix convenience function and fix gpt-oss (#20912)
This commit is contained in:
parent
7cadbfce10
commit
312d870a89
6 changed files with 34 additions and 47 deletions
|
|
@ -802,6 +802,16 @@ common_peg_parser common_chat_peg_builder::build_json_tools_flat_keys(
|
|||
return tool_choices;
|
||||
}
|
||||
|
||||
common_peg_parser common_chat_peg_builder::prefix(const std::string & s, const std::string & delimiter) {
|
||||
if (s.empty()) {
|
||||
return eps();
|
||||
}
|
||||
if (delimiter.empty()) {
|
||||
return literal(s);
|
||||
}
|
||||
return literal(s.substr(0, s.rfind(delimiter)));
|
||||
}
|
||||
|
||||
common_peg_parser common_chat_peg_builder::standard_json_tools(
|
||||
const std::string & section_start,
|
||||
const std::string & section_end,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue