Skip to content

Commit 4a2b196

Browse files
authored
server : fix --jinja when there's no tools or schema (typo was forcing JSON) (#11531)
1 parent 1bd3047 commit 4a2b196

File tree

2 files changed

+4
-5
lines changed

2 files changed

+4
-5
lines changed

examples/server/tests/unit/test_chat_completion.py

+3-4
Original file line numberDiff line numberDiff line change
@@ -14,11 +14,10 @@ def create_server():
1414
"model,system_prompt,user_prompt,max_tokens,re_content,n_prompt,n_predicted,finish_reason,jinja,chat_template",
1515
[
1616
(None, "Book", "What is the best book", 8, "(Suddenly)+|\\{ \" Sarax.", 77, 8, "length", False, None),
17+
(None, "Book", "What is the best book", 8, "(Suddenly)+|\\{ \" Sarax.", 77, 8, "length", True, None),
18+
(None, "Book", "What is the best book", 8, "^ blue", 23, 8, "length", True, "This is not a chat template, it is"),
1719
("codellama70b", "You are a coding assistant.", "Write the fibonacci function in c++.", 128, "(Aside|she|felter|alonger)+", 104, 64, "length", False, None),
18-
# TODO: fix testing of non-tool jinja mode
19-
# (None, "Book", "What is the best book", 8, "(Suddenly)+|\\{ \" Sarax.", 77, 8, "length", True, None),
20-
# (None, "Book", "What is the best book", 8, "I want to play with", 23, 8, "length", True, "This is not a chat template, it is"),
21-
# ("codellama70b", "You are a coding assistant.", "Write the fibonacci function in c++.", 128, "(Aside|she|felter|alonger)+", 104, 64, "length", True, None),
20+
("codellama70b", "You are a coding assistant.", "Write the fibonacci function in c++.", 128, "(Aside|she|felter|alonger)+", 104, 64, "length", True, None),
2221
]
2322
)
2423
def test_chat_completion(model, system_prompt, user_prompt, max_tokens, re_content, n_prompt, n_predicted, finish_reason, jinja, chat_template):

examples/server/utils.hpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -642,7 +642,7 @@ static json oaicompat_completion_params_parse(
642642
inputs.parallel_tool_calls = json_value(body, "parallel_tool_calls", false);
643643
inputs.stream = stream;
644644
// TODO: support mixing schema w/ tools beyond generic format.
645-
inputs.json_schema = json_value(llama_params, "json_schema", json::object());
645+
inputs.json_schema = json_value(llama_params, "json_schema", json());
646646
auto chat_params = common_chat_params_init(tmpl, inputs);
647647

648648
llama_params["chat_format"] = static_cast<int>(chat_params.format);

0 commit comments

Comments
 (0)