Skip to content

Commit dec5ca5

Browse files
authored
server : Add id to tool call responses api (ggml-org#24882)
1 parent 9c0ac88 commit dec5ca5

1 file changed

Lines changed: 6 additions & 3 deletions

File tree

tools/server/server-task.cpp

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -591,10 +591,11 @@ json server_task_result_cmpl_final::to_json_oaicompat_resp() {
591591

592592
for (const common_chat_tool_call & tool_call : oaicompat_msg.tool_calls) {
593593
output.push_back(json {
594+
{"id", "fc_" + tool_call.id},
594595
{"type", "function_call"},
595596
{"status", "completed"},
596597
{"arguments", tool_call.arguments},
597-
{"call_id", "fc_" + tool_call.id},
598+
{"call_id", "call_" + tool_call.id},
598599
{"name", tool_call.name},
599600
});
600601
}
@@ -690,10 +691,11 @@ json server_task_result_cmpl_final::to_json_oaicompat_resp_stream() {
690691

691692
for (const common_chat_tool_call & tool_call : oaicompat_msg.tool_calls) {
692693
const json output_item = {
694+
{"id", "fc_" + tool_call.id},
693695
{"type", "function_call"},
694696
{"status", "completed"},
695697
{"arguments", tool_call.arguments},
696-
{"call_id", "fc_" + tool_call.id},
698+
{"call_id", "call_" + tool_call.id},
697699
{"name", tool_call.name}
698700
};
699701
server_sent_events.push_back(json {
@@ -1277,8 +1279,9 @@ json server_task_result_cmpl_partial::to_json_oaicompat_resp() {
12771279
{"data", json {
12781280
{"type", "response.output_item.added"},
12791281
{"item", json {
1282+
{"id", "fc_" + diff.tool_call_delta.id},
12801283
{"arguments", ""},
1281-
{"call_id", "fc_" + diff.tool_call_delta.id},
1284+
{"call_id", "call_" + diff.tool_call_delta.id},
12821285
{"name", diff.tool_call_delta.name},
12831286
{"type", "function_call"},
12841287
{"status", "in_progress"},

0 commit comments

Comments
 (0)