Update test-tool-call.cpp

This commit is contained in:
ochafik 2024-10-22 10:54:48 +01:00
parent 9f5ab97756
commit b53362a148

View file

@ -134,10 +134,7 @@ static void test_parsing() {
{"tools", tools} {"tools", tools}
}; };
test_parse_tool_call(llama_tool_call_style::Hermes2Pro, tools, const auto fooBarCall = json {
"<tool_call>{\"name\": \"foo\", \"arguments\": {\"bar\": 1}}</tool_call>",
"",
json {{
{"type", "function"}, {"type", "function"},
{"function", { {"function", {
{"name", "foo"}, {"name", "foo"},
@ -145,7 +142,21 @@ static void test_parsing() {
{"bar", 1} {"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,
"<tool_call>{\"name\": \"foo\", \"arguments\": {\"bar\": 1}}</tool_call>",
"",
json::array({fooBarCall}));
test_parse_tool_call(llama_tool_call_style::FunctionaryV3Llama3, tools, test_parse_tool_call(llama_tool_call_style::FunctionaryV3Llama3, tools,
">>>ipython\n{\"code\": \"print('Hello, world!')\"}", ">>>ipython\n{\"code\": \"print('Hello, world!')\"}",