Skip to content

Commit ed7a722

Browse files
committed
feat(prompt): update instructions for tool usage
I am updating the instructions for the `gemini_ask` and `gemini_search` tools to emphasize their mandatory use and clarify the formatting requirements for time parameters. This change aims to improve the reliability of tool calls by ensuring the model correctly interprets and generates these calls.
1 parent bc32f8c commit ed7a722

File tree

1 file changed

+15
-24
lines changed

1 file changed

+15
-24
lines changed

prompt_handlers.go

Lines changed: 15 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ import (
1010

1111
// createTaskInstructions generates the instructional text for the MCP client
1212
func createTaskInstructions(problemStatement, systemPrompt string) string {
13-
return fmt.Sprintf("You MUST use the `gemini_ask` tool to solve this problem.\n\n"+
13+
return fmt.Sprintf("You MUST NOW use the `gemini_ask` tool to solve this problem.\n\n"+
1414
"Follow these instructions carefully:\n"+
1515
"1. Set the `query` argument to a clear and concise request based on the user's problem statement.\n"+
1616
"2. Provide the code to be analyzed using ONE of the following methods:\n"+
@@ -23,29 +23,20 @@ func createTaskInstructions(problemStatement, systemPrompt string) string {
2323

2424
// createSearchInstructions generates instructions for gemini_search tool
2525
func createSearchInstructions(problemStatement string) string {
26-
return fmt.Sprintf(`You are an AI assistant. Your task is to answer the user's question by generating a call to the 'gemini_search' tool.
27-
28-
Read the user's question below and then create a 'gemini_search' tool call.
29-
30-
**User's Question:**
31-
"%s"
32-
33-
**Instructions for the 'gemini_search' tool:**
34-
35-
* **'query' parameter (required):** Create a search query from the user's question.
36-
* **'start_time' and 'end_time' parameters (optional):**
37-
* Use these only if the question is about a specific time period (e.g., "this year", "last month", "in 2023").
38-
* If you use them, you must provide both 'start_time' and 'end_time'.
39-
* The format is "YYYY-MM-DDTHH:MM:SSZ".
40-
41-
**Example:**
42-
43-
If the user's question is: "What were the most popular movies of 2023?"
44-
45-
Your response should be the following tool call:
46-
'gemini_search(query="most popular movies of 2023", start_time="2023-01-01T00:00:00Z", end_time="2023-12-31T23:59:59Z")'
47-
48-
Now, generate the 'gemini_search' tool call for the user's question.`, problemStatement)
26+
return fmt.Sprintf("You MUST NOW use `gemini_search` tool to answer user's question.\n\n"+
27+
"Read carefully the user's question below and then THINK about how to create a 'gemini_seaarch` tool call.\n"+
28+
"<user_question>\n%s\n</user_question>\n"+
29+
"**Instructions for the 'gemini_search' tool:**\n\n"+
30+
"* **'query' parameter (required):** Create a search query from the user's question.\n"+
31+
"* **'start_time' and 'end_time' parameters (optional):**\n"+
32+
"* Use these only if the user question is defining timeframe (e.g., 'this year', 'last month', 'in 2023')\n"+
33+
"* If you use them, you must provide at least 'start_time'\n"+
34+
"* The format is 'YYYY-MM-DDTHH:MM:SSZ'\n"+
35+
"* **Example:**\n\n"+
36+
"If the user`s question is: 'What were the most popular movies of 2023?'\n"+
37+
"Your response should be the following tool call:\n"+
38+
"'gemini_search(query='most popular movies of 2023', start_time='2023-01-01T00:00:00Z', end_time='2023-12-31T23:59:59Z')\n"+
39+
"Now, generate the best 'gemini_search' tool call to answer the user's question.", problemStatement)
4940
}
5041

5142
// promptHandler is the generic handler for all prompts

0 commit comments

Comments
 (0)