Skip to content

LLM inference in C/C++

C++ ggml

server : Add id to tool call responses api (#24882)

Matt Thompsondec5ca5577d6
diff --git a/tools/server/server-task.cpp b/tools/server/server-task.cpp
index 9ba039c8b8..a9ebac013f 100644
--- a/tools/server/server-task.cpp
+++ b/tools/server/server-task.cpp
@@ -591,10 +591,11 @@ json server_task_result_cmpl_final::to_json_oaicompat_resp() {
for (const common_chat_tool_call & tool_call : oaicompat_msg.tool_calls) {
output.push_back(json {
+ {"id", "fc_" + tool_call.id},
{"type", "function_call"},
{"status", "completed"},
{"arguments", tool_call.arguments},
- {"call_id", "fc_" + tool_call.id},
+ {"call_id", "call_" + tool_call.id},
{"name", tool_call.name},
});
}
@@ -690,10 +691,11 @@ json server_task_result_cmpl_final::to_json_oaicompat_resp_stream() {
for (const common_chat_tool_call & tool_call : oaicompat_msg.tool_calls) {
const json output_item = {
+ {"id", "fc_" + tool_call.id},
{"type", "function_call"},
{"status", "completed"},
{"arguments", tool_call.arguments},
- {"call_id", "fc_" + tool_call.id},
+ {"call_id", "call_" + tool_call.id},
{"name", tool_call.name}
};
server_sent_events.push_back(json {
@@ -1277,8 +1279,9 @@ json server_task_result_cmpl_partial::to_json_oaicompat_resp() {
{"data", json {
{"type", "response.output_item.added"},
{"item", json {
+ {"id", "fc_" + diff.tool_call_delta.id},
{"arguments", ""},
- {"call_id", "fc_" + diff.tool_call_delta.id},
+ {"call_id", "call_" + diff.tool_call_delta.id},
{"name", diff.tool_call_delta.name},
{"type", "function_call"},
{"status", "in_progress"},