diff --git a/tests/test-tool-call.cpp b/tests/test-tool-call.cpp index 18a4b052e..5e47464ce 100644 --- a/tests/test-tool-call.cpp +++ b/tests/test-tool-call.cpp @@ -134,18 +134,29 @@ static void test_parsing() { {"tools", tools} }; + const auto fooBarCall = json { + {"type", "function"}, + {"function", { + {"name", "foo"}, + {"arguments", dump({ + {"bar", 1} + })} + }} + }; + + test_parse_tool_call(llama_tool_call_style::Generic, tools, + "{\"tool_call\": {\"name\": \"foo\", \"arguments\": {\"bar\": 1}}}", + "", + json::array({fooBarCall})); + test_parse_tool_call(llama_tool_call_style::Generic, tools, + "{\"tool_calls\": [{\"name\": \"foo\", \"arguments\": {\"bar\": 1}}]}", + "", + json::array({fooBarCall})); + test_parse_tool_call(llama_tool_call_style::Hermes2Pro, tools, "{\"name\": \"foo\", \"arguments\": {\"bar\": 1}}", "", - json {{ - {"type", "function"}, - {"function", { - {"name", "foo"}, - {"arguments", dump({ - {"bar", 1} - })} - }} - }}); + json::array({fooBarCall})); test_parse_tool_call(llama_tool_call_style::FunctionaryV3Llama3, tools, ">>>ipython\n{\"code\": \"print('Hello, world!')\"}",