Revert to OAI-compatible args (#20213)
* Revert to OAI-compatible args * Apply workaround::func_args_not_string
This commit is contained in:
parent
ff52ee964d
commit
b283f6d5b3
|
|
@ -129,7 +129,7 @@ json common_chat_msg::to_json_oaicompat(bool concat_typed_text) const {
|
||||||
{"type", "function"},
|
{"type", "function"},
|
||||||
{"function", {
|
{"function", {
|
||||||
{"name", tool_call.name},
|
{"name", tool_call.name},
|
||||||
{"arguments", json::parse(tool_call.arguments)},
|
{"arguments", json(tool_call.arguments)},
|
||||||
}},
|
}},
|
||||||
};
|
};
|
||||||
if (!tool_call.id.empty()) {
|
if (!tool_call.id.empty()) {
|
||||||
|
|
@ -1353,6 +1353,8 @@ static common_chat_params common_chat_templates_apply_jinja(const struct common_
|
||||||
params.add_bos = tmpls->add_bos;
|
params.add_bos = tmpls->add_bos;
|
||||||
params.add_eos = tmpls->add_eos;
|
params.add_eos = tmpls->add_eos;
|
||||||
|
|
||||||
|
workaround::func_args_not_string(params.messages);
|
||||||
|
|
||||||
if (!tmpl.original_caps().supports_system_role) {
|
if (!tmpl.original_caps().supports_system_role) {
|
||||||
workaround::system_message_not_supported(params.messages);
|
workaround::system_message_not_supported(params.messages);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1434,9 +1434,7 @@ static void test_msgs_oaicompat_json_conversion() {
|
||||||
" \"type\": \"function\",\n"
|
" \"type\": \"function\",\n"
|
||||||
" \"function\": {\n"
|
" \"function\": {\n"
|
||||||
" \"name\": \"python\",\n"
|
" \"name\": \"python\",\n"
|
||||||
" \"arguments\": {\n"
|
" \"arguments\": \"{\\\"code\\\":\\\"print('hey')\\\"}\"\n"
|
||||||
" \"code\": \"print('hey')\"\n"
|
|
||||||
" }\n"
|
|
||||||
" }\n"
|
" }\n"
|
||||||
" }\n"
|
" }\n"
|
||||||
" ]\n"
|
" ]\n"
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue