Skip to content

Commit b283f6d

Browse files
authored
Revert to OAI-compatible args (ggml-org#20213)
* Revert to OAI-compatible args * Apply workaround::func_args_not_string
1 parent ff52ee9 commit b283f6d

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

common/chat.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,7 @@ json common_chat_msg::to_json_oaicompat(bool concat_typed_text) const {
129129
{"type", "function"},
130130
{"function", {
131131
{"name", tool_call.name},
132-
{"arguments", json::parse(tool_call.arguments)},
132+
{"arguments", json(tool_call.arguments)},
133133
}},
134134
};
135135
if (!tool_call.id.empty()) {
@@ -1353,6 +1353,8 @@ static common_chat_params common_chat_templates_apply_jinja(const struct common_
13531353
params.add_bos = tmpls->add_bos;
13541354
params.add_eos = tmpls->add_eos;
13551355

1356+
workaround::func_args_not_string(params.messages);
1357+
13561358
if (!tmpl.original_caps().supports_system_role) {
13571359
workaround::system_message_not_supported(params.messages);
13581360
}

tests/test-chat.cpp

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1434,9 +1434,7 @@ static void test_msgs_oaicompat_json_conversion() {
14341434
" \"type\": \"function\",\n"
14351435
" \"function\": {\n"
14361436
" \"name\": \"python\",\n"
1437-
" \"arguments\": {\n"
1438-
" \"code\": \"print('hey')\"\n"
1439-
" }\n"
1437+
" \"arguments\": \"{\\\"code\\\":\\\"print('hey')\\\"}\"\n"
14401438
" }\n"
14411439
" }\n"
14421440
" ]\n"

0 commit comments

Comments
 (0)