Skip to content

Commit 7aa735f

Browse files
committed
Ensure there's a non empty tool call id
1 parent 1e2f78a commit 7aa735f

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

examples/server/server.cpp

+4-1
Original file line numberDiff line numberDiff line change
@@ -750,7 +750,10 @@ struct server_task_result_cmpl_final : server_task_result {
750750
{"name", tc.name},
751751
{"arguments", tc.arguments},
752752
}},
753-
{"id", tc.id},
753+
// Some templates generate and require and id (sometimes in a very specific format).
754+
// We only generate a random id for the ones that don't generate one by themselves
755+
// (they also won't get to see it as their template likely doesn't use it, so it's all for the client)
756+
{"id", tc.id.empty() ? gen_tool_call_id() : tc.id},
754757
});
755758
}
756759
message["tool_calls"] = tool_calls;

0 commit comments

Comments
 (0)