File tree Expand file tree Collapse file tree 2 files changed +8
-1
lines changed Expand file tree Collapse file tree 2 files changed +8
-1
lines changed Original file line number Diff line number Diff 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 an id (sometimes in a very specific format, e.g. Mistral Nemo).
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;
Original file line number Diff line number Diff line change @@ -435,6 +435,10 @@ static std::string gen_chatcmplid() {
435435 return " chatcmpl-" + random_string ();
436436}
437437
438+ static std::string gen_tool_call_id () {
439+ return random_string ();
440+ }
441+
438442//
439443// other common utils
440444//
You can’t perform that action at this time.
0 commit comments