Skip to content

Commit 76f5d27

Browse files
author
ochafik
committed
tool-call: allow empty tools w/ auto + grammar
1 parent cb31f08 commit 76f5d27

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

examples/server/utils.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -601,7 +601,7 @@ static json oaicompat_completion_params_parse(
601601
inputs.use_jinja = use_jinja;
602602
inputs.parallel_tool_calls = json_value(body, "parallel_tool_calls", false);
603603
inputs.extract_reasoning = reasoning_format != COMMON_REASONING_FORMAT_NONE;
604-
if (inputs.tool_choice != COMMON_CHAT_TOOL_CHOICE_NONE && llama_params.contains("grammar")) {
604+
if (!inputs.tools.empty() && inputs.tool_choice != COMMON_CHAT_TOOL_CHOICE_NONE && llama_params.contains("grammar")) {
605605
throw std::runtime_error("Cannot use custom grammar constraints with tools.");
606606
}
607607

0 commit comments

Comments
 (0)