diff --git a/engine/utils/function_calling/common.h b/engine/utils/function_calling/common.h index d01f22423..eb0d45cf4 100644 --- a/engine/utils/function_calling/common.h +++ b/engine/utils/function_calling/common.h @@ -158,6 +158,10 @@ inline void UpdateMessages(std::string& system_prompt, tool_choice["function"]["name"].asString() + "' to answer the user's question."; } + bool parallel_tool_calls = request->get("parallel_tool_calls", true).asBool(); + if (!parallel_tool_calls) { + system_prompt += "\n\nNow this is your first priority: You must call the only one function at a time."; + } bool tools_call_in_user_message = request->get("tools_call_in_user_message", false).asBool(); diff --git a/engine/utils/function_calling/llama3.1.h b/engine/utils/function_calling/llama3.1.h index 5c2e6ffdb..a0ebe941e 100644 --- a/engine/utils/function_calling/llama3.1.h +++ b/engine/utils/function_calling/llama3.1.h @@ -30,14 +30,15 @@ Here is an example, Reminder: - Function calls MUST follow the specified format - Required parameters MUST be specified -- Only call one function at a time +- You can call one or more functions at a time - Put the entire function call reply on one line - Always add your sources when using search results to answer the user query -- If can not find correct parameters corresponding to function, ask user again to provide. +- If you can not find correct parameters or arguments corresponding to function in the user's message, ask user again to provide, do not make assumptions. - No explanation are needed when calling a function. You are a helpful assistant. )"; -constexpr auto tool_role = "<|eot_id|>\n<|start_header_id|>ipython<|end_header_id|>\n"; +constexpr auto tool_role = + "<|eot_id|>\n<|start_header_id|>ipython<|end_header_id|>\n"; } // namespace function_calling_llama3_1_utils