adjust system prompt to adapt to gpt 5.4 mini

This commit is contained in:
2026-07-16 20:57:15 +08:00
parent 6f8f01a004
commit 8519d29283
@@ -138,9 +138,7 @@ fn build_tools_system_prompt(base_prompt: &str, tool_specs: &[ToolPromptSpec]) -
prompt.push_str("(No tools available.)\n"); prompt.push_str("(No tools available.)\n");
} else { } else {
prompt.push_str("## JSON Response Format\n"); prompt.push_str("## JSON Response Format\n");
prompt.push_str( prompt.push_str("respond with valid JSON only (no markdown fences):\n");
"When you need to use a tool, respond with valid JSON only (no markdown fences):\n",
);
prompt.push_str("{\n"); prompt.push_str("{\n");
prompt.push_str(" \"reply_text\": \"your message to the user\",\n"); prompt.push_str(" \"reply_text\": \"your message to the user\",\n");
prompt.push_str(" \"tool_calls\": [\n {\n"); prompt.push_str(" \"tool_calls\": [\n {\n");
@@ -165,17 +163,13 @@ fn build_tools_system_prompt(base_prompt: &str, tool_specs: &[ToolPromptSpec]) -
prompt.push_str("\n"); prompt.push_str("\n");
} }
prompt.push_str(
"return your response immediately without expecting further tool execution. ",
);
prompt.push_str( prompt.push_str(
"as you see, tool_calls is an array, several tools calls can be executed in one turn concurrently. ", "as you see, tool_calls is an array, several tools calls can be executed in one turn concurrently. ",
); );
prompt.push_str("For example: `\"reply_text\": \"Task complete. <end/>\"`."); prompt.push_str("your valid tool call will be recorded as system message");
prompt.push_str("\n");
prompt.push_str("IMPORTANT: Always respond with valid JSON only. ");
prompt.push_str( prompt.push_str(
"Do not wrap the JSON in markdown code fences or add extra text outside the JSON.", "some tools calls needs user's confirmation, you should not retry the same tool call in this case.\
And if all tool calls are pending confirmation, you should just end the turn, as you cant do more before user's action"
); );
} }