Improvement for system prompt with tool

Hello. In my chatbot I use system prompt and tools. In most situations it works ok. But sometimes it creates document which it shouldn’t do. In most cases it happens with translation (calls translation tool) though I don’t have translation tool. That’s why I need help for improving the system prompt. This is my prompt:

You are helpful AI Assistant.\n 
                You are chat assistant having knowledge in many fields. \n
                If there is a need to express feelings then show your emotions with emojis.\n 
                Speak in polite and friendly tone.\n 
                Today is ".date('d M Y').", System Time:".date('H:i:s').". \n 
                Name of person you are speaking to is ".$username".\n
                If user wants you translate something you must translate without a tool\n
                If user asks how to they can send file to the chat then tell that on the bottom right side of chat message box they can click icon and upload files.\n
                If user asks what you can do, then list your additional abilities: generating images, pdf and word documents, pdf invoices, power point presentations, plot/graph charts, get weather information, link reading.\n
                Use tool if user asks information about  you, what can you do, this chat or its settings, their subscriptions and limits.\n

Just in case this is my tool detector function (may be I also need to increase its description):


                'name' => 'tool_detector',
                'description' => "Call this tool if you can not do task yourself. Before using them you must: \n
            1. Determine if you can do task yourself or not. \n
            2. If not, then determine what you must do step by step.\n
            3. Determine if you have correct tool(s) for it\n
            4. Then determine which of given tools you need to use and send them in correct order with their prompt!. 
           \n
            ",
                'parameters' => [
                    'type' => 'object',
                    'properties' => [
                        'tools' => [
                            'type' => 'array',
                            'description' => "Array of tools. Call it if you need to use tools. \n
                            Add the same tool multiple times if there is a need. Example: if user wants weather information in two different cities then the same tool object must be added two times. \n
                            Each object in array must have these two properties: tool_name, prompt.",
                            "items" => [
                                "type"=> "object",
                                "properties" => [
                                    "tool_name" => [
                                        "type"=> "string",
                                        "description" => "Name of tool. You have these tools: [:tools] ",
                                        "enum" => [
                                            "image_generation",
                                            "link_reader",
                                            "document_generator",
                                            "invoice_generator",
                                            "weather_information",
                                            "powerpoint_presentation_generator",
                                            "information"
                                        ]
                                    ],
                                    "prompt"=> [
                                        "type"=> "string",
                                        "description" => "It must be string. It must be a prompt which must be used within selected tool"
                                    ]
                                ],
                                "required"=> ["tool_name", "prompt"],
                                "additionalProperties"=> false
                            ]
                        ]
                    ],
                    'required' => ['tools'],
                ],
            ]

remove that line. That should work.

And also remove this:

that is default behavior of the model

Instead of:

better do this:

You got the following tools:

  1. generating images, pdf and word documents, pdf invoices, power point presentations, plot/graph charts
  2. get weather information
  3. link reading
1 Like

Thanks for suggestions. I used openai’s playground and anthropic’s prompt improver. seems now it works correctly. but need some improvements for tool detector description part

AI models can’t prompt as good as humans can! They are infected by all the thousands of “get your 100,000 optimized business ready prompt” lists everywhere…

On top of that your prompt needs a lot of stuff to at least try to prevent people using prompt injections.