tool-call: fix missing initializer errors

This commit is contained in:
ochafik 2024-10-30 12:38:34 +00:00
parent 3ebdb2b805
commit 35ac17f3f1

View file

@ -207,8 +207,13 @@ static llama_tool_calls parse_llama_3_tool_calls(const json & tools, const std::
std::smatch match; std::smatch match;
if (std::regex_search(input, match, python_tag_regex)) { if (std::regex_search(input, match, python_tag_regex)) {
return { return {
match.prefix().str(), { /* .content = */ match.prefix().str(),
{"ipython", (json {{"code", match[1].str()}}).dump()}, /* .tool_calls = */ {
{
/* .name = */ "ipython",
/* .arguments = */ (json {{"code", match[1].str()}}).dump(),
/* .id = */ "",
},
} }
}; };
} }
@ -224,8 +229,13 @@ static llama_tool_calls parse_functionary_v3_llama_3_1_tool_calls(const json & t
std::smatch match; std::smatch match;
if (std::regex_search(input, match, python_tag_regex)) { if (std::regex_search(input, match, python_tag_regex)) {
return { return {
match.prefix().str(), { /* .content = */ match.prefix().str(),
{"ipython", (json {{"code", match[1].str()}}).dump()}, /* .tool_calls = */ {
{
/* .name = */ "ipython",
/* .arguments = */ (json {{"code", match[1].str()}}).dump(),
/* .id = */ "",
},
} }
}; };
} }