diff --git a/common/chat.cpp b/common/chat.cpp index 8ce430abc..99dfef936 100644 --- a/common/chat.cpp +++ b/common/chat.cpp @@ -140,7 +140,6 @@ static common_chat_msg parse_json_tool_calls( LOG_WRN("Content found with tool calls: %s", result.content.c_str()); } result.content = ""; - result.role = "user"; } return result; } diff --git a/tests/test-chat.cpp b/tests/test-chat.cpp index 6ed3d2060..c40a77ca2 100644 --- a/tests/test-chat.cpp +++ b/tests/test-chat.cpp @@ -465,18 +465,18 @@ static void test_template_output_parsers() { " ]\n" "}"); } - // { - // const common_chat_template tmpl(read_file("models/templates/mistralai-Mistral-Nemo-Instruct-2407.jinja"), "", - // ""); - // std::vector end_tokens{ "" }; + { + const common_chat_template tmpl(read_file("models/templates/mistralai-Mistral-Nemo-Instruct-2407.jinja"), "", + ""); + std::vector end_tokens{ "" }; - // assert_equals(COMMON_CHAT_FORMAT_MISTRAL_NEMO, common_chat_params_init(tmpl, inputs_tools).format); + assert_equals(COMMON_CHAT_FORMAT_MISTRAL_NEMO, common_chat_params_init(tmpl, inputs_tools).format); - // test_template(tmpl, end_tokens, text_message, tools, "Hello, world!", /* expect_grammar_triggered= */ false); - // test_template( - // tmpl, end_tokens, tool_call_message_with_id, tools, - // "[TOOL_CALLS][{\"name\": \"special_function\", \"arguments\": {\"arg1\": 1}, \"id\": \"123456789\"}]"); - // } + test_template(tmpl, end_tokens, text_message, tools, "Hello, world!", /* expect_grammar_triggered= */ false); + test_template( + tmpl, end_tokens, tool_call_message_with_id, tools, + "[TOOL_CALLS][{\"name\": \"special_function\", \"arguments\": {\"arg1\": 1}, \"id\": \"123456789\"}]"); + } { const common_chat_template tmpl( read_file("models/templates/NousResearch-Hermes-2-Pro-Llama-3-8B-tool_use.jinja"), "", "");