- What prompts are
- How to write great prompts
- A framework to structure your instructions
- Be specific: Clearly articulate your intent. Don’t write prompts like you would write a Google query with keywords. The more precise your ask, the better the AI can address it. Vague, open-ended or too complex prompts lead to unfocused responses.
- Provide context: Give the AI relevant background information to work with. This could include details about the topic, audience, desired format, etc. More context allows the AI to tailor its response.
- Use examples: Showing is often better than telling. Provide examples of what you’re looking for to give the AI a template to work from.
- Adopt a persona: Assigning the AI a specific role or persona in your instructions can yield outputs better fit for purpose. An AI acting as a “teacher of engineering students” will respond differently than one acting as a “sales representative.”
- Break it down: For complex tasks, guide the AI step-by-step with what is called “chain-of-thought” instructions. This makes the AI’s reasoning more transparent and debuggable.
- Read your instructions: as if you were a contractor tasked for this project. If you understand it, the model will understand as well. If not, the model won’t either.
- Iterate: If the output isn’t quite right, tweak your prompt or instructions and try again. View prompting as a conversation.
Framework to write good Instructions
Follow this framework to structure the instructions of your agents.- Role and goal: role and goal-based constraints limit the AI to a narrower, more appropriate range of responses
- [optional] Step-by-step instructions: if relevant, explain the steps your agent will have to follow to walk users through the process - i.e., “When the user asks you a question, start by asking them if they want A or B.” If instructions are easy for someone else to understand (who is unfamiliar with your specific request or domain), then the AI is more likely to understand your instructions.
- Expertise: this is the most important part; your knowledge and viewpoint are key to helping the AI action. Figure out what you want the agent to do and how it differs from its default behavior, which is generating text.
- Constraints: they are rules or conditions that guide the behavior of the agent in its interactions with the user - i.e., “only ask one question at a time”, “reply in bullet points”, “reply in French only,”….
- Specific output. there are many outputs that you can request: an explanation, a table, or an SQL query. Experiment with different approaches, and you might be surprised.