File tree Expand file tree Collapse file tree 1 file changed +2
-0
lines changed Expand file tree Collapse file tree 1 file changed +2
-0
lines changed Original file line number Diff line number Diff line change @@ -691,6 +691,8 @@ static common_chat_params common_chat_params_init_hermes_2_pro(const common_chat
691
691
auto tool_call = " \" <tool_call>\" space " + builder.add_rule (" tool_call" , string_join (tool_rules, " | " )) + " \" </tool_call>\" space" ;
692
692
builder.add_rule (" root" , inputs.parallel_tool_calls ? " (" + tool_call + " )+" : tool_call);
693
693
data.grammar_triggers .push_back ({" <tool_call>" , /* .at_start = */ false });
694
+ // Not really a trigger but need to print this special token to get a successful parse.
695
+ data.grammar_triggers .push_back ({" </tool_call>" , /* .at_start = */ false });
694
696
}, grammar_options);
695
697
696
698
data.prompt = tmpl.apply (inputs.messages , inputs.tools .empty () ? json () : inputs.tools , inputs.add_generation_prompt );
You can’t perform that action at this time.
0 commit comments