File tree Expand file tree Collapse file tree 2 files changed +5
-3
lines changed Expand file tree Collapse file tree 2 files changed +5
-3
lines changed Original file line number Diff line number Diff line change @@ -1839,8 +1839,8 @@ std::string common_chat_apply_template(
18391839 toolcall::handler::ptr handler,
18401840 toolcall::sampling_updater * update_sparams)
18411841{
1842- const auto & tmpl_selected =
1843- handler != nullptr && tmpl. template_tool_use ? *tmpl.template_tool_use : *tmpl.template_default ;
1842+ bool use_tool_template = (use_jinja && handler != nullptr ) && tmpl. template_tool_use ;
1843+ const auto & tmpl_selected = use_tool_template ? *tmpl.template_tool_use : *tmpl.template_default ;
18441844
18451845 if (use_jinja) {
18461846 common_chat_inputs inputs;
Original file line number Diff line number Diff line change @@ -21,7 +21,9 @@ std::shared_ptr<toolcall::handler> toolcall::create_handler(const toolcall::para
2121 bool has_uri = std::holds_alternative<std::string>(tools);
2222 if (has_uri) {
2323 auto tools_str = std::get<std::string>(tools);
24- result.reset (new toolcall::handler (std::make_unique<toolcall::mcp_impl>(tools_str, choice)));
24+ if (! tools_str.empty ()) {
25+ result.reset (new toolcall::handler (std::make_unique<toolcall::mcp_impl>(tools_str, choice)));
26+ }
2527
2628 } else {
2729 auto tools_ptr = std::get<toolcall::json_ptr>(tools);
You can’t perform that action at this time.
0 commit comments