In this article, we will delve into the art of crafting effective queries (i.e., prompts) for AI language models like ChatGPT, Bard, and Bing.
A well-formed prompt can make a significant difference in the quality of the responses you receive, saving you time and effort in refining your questions. We will unveil a simple, adaptable formula applicable to various situations, ensuring that you maximize the benefits of these incredible language technologies — and stay on the right side of change.
After grasping the underlying principles of prompt engineering and exploring real-life examples, you’ll be able to harness the full potential of AI-supported language systems.
7 General Prompting Tips
Before giving you the perfect prompting formula, let’s recap some basic prompting tips you may have already considered, but that may not be on your mind. π
- Be specific: Offer as much detail as possible to ensure the answer is relevant and tailored to your needs. Sounds simple but many people actually skip this step. It’s like talking to your friend; if you don’t share the details of your problems, you’ll get generic “fluff” advice.
- State your intentions: Clarifying your intentions helps the AI tailor its response to your specific requirements. For example, if you’re helping a child with homework, specify the need for a simple explanation suitable for their age.
- Ensure correct spelling and grammar: Though the AI might figure out most mistakes, addressing any errors in your prompt steers it in the right direction.
- Direct the output format: For instance, asking the AI to provide information as a numbered list or a paragraph helps you receive answers in the desired layout.
- Follow up with questions: Sometimes, even the perfect prompt might need clarification or additional input to achieve the desired results. Iterative prompting is a powerful technique and many beginners stop the iterative refinement too early.
- Experiment with phrasing: If the AI doesn’t understand your query, change or rephrase your prompt for better comprehension. Sometimes a single word can make all the difference. Here’s where prompting is more an art than a science.
- Fact-check when necessary: Feed the AIβs output back into the system to verify statements and ensure accuracy. You can even ask ChatGPT to grade its own output and edit or rewrite according to its own grading.
With this out of the way, here’s …
The Perfect Prompting Formula π§ββοΈπͺ
The formula to achieve this is Context + Specific Information + Intent + Response Format. Use this formula, adapt it to fit your unique inquiries, and you’ll receive valuable results from your AI tools.
Here’s an example prompt that adheres to this formula:
π§βπ» Prompt Example:
"I'm a teacher preparing a lesson on the solar system for my 5th-grade students. I want to focus on the planet Mars. Can you provide a brief overview? Please present it in a simple, bullet-point format suitable for 10-year-olds."
Let’s examine how this prompt adheres to our perfect prompting formula:
- Context: “I’m a teacher preparing a lesson on the solar system for my 5th-grade students.”
- Specific Information: “I want to focus on the planet Mars.”
- Intent: “Can you provide a brief overview?”
- Response Format: “Please present it in a simple, bullet-point format suitable for 10-year-olds.”
It provides a beautiful output that can be used right away:
So remember the perfect 4-step prompting formula:
- Context
- Specific Information
- Intent
- Response Format
Deep Dive Into the Four Steps and Examples
(1) Context
When using AI platforms like ChatGPT, Bard, or Bing, providing the proper context is crucial. By introducing yourself or your specific situation, you help the AI better understand your needs and deliver a more relevant answer.
Examples:
- Medical Research Context: “I’m a medical researcher studying the effects of prolonged screen time on children’s eyesight. Given the rise in virtual learning and increased screen usage, I’m keen to understand the long-term implications.”
- Historical Analysis Context: “I’m a history teacher preparing a lesson on the Renaissance period for high school students. I want to emphasize the influence of this era on modern art, science, and philosophy.”
- Entrepreneurial Context: “I’m an entrepreneur in the early stages of developing a sustainable fashion brand. With the growing concern about fast fashion’s environmental impact, I’m looking for insights into sustainable materials and ethical manufacturing processes.”
(2) Specific Information
Be as precise as possible in your request to receive more relevant answers. Instead of simply asking about different dog breeds, for example, narrow down the focus by asking about small breeds suitable for apartment living.
Examples:
- Medical Research Specific Information: “I’m focusing on children in the age range of 6-12 years old and the effects of screen exposure on their eyesight.”
- Historical Analysis Specific Information: “I’m particularly interested in Leonardo da Vinci’s contributions during the Renaissance, especially his innovations in both art and science.”
- Entrepreneurial Specific Information: “I’m considering organic cotton and recycled polyester as potential materials for my fashion brand.”
(3) Intent
Always make your goals clear in the prompt. This could involve explaining the purpose behind your request, such as needing a simple explanation of quantum physics for your son’s science homework. With your intention clearly stated, the AI will generate a response tailored to your needs.
Examples:
- Medical Research Intent: “I want to understand the recommended guidelines for screen time for this age group to ensure their eye health.”
- Historical Analysis Intent: “I aim to create a lesson plan that highlights da Vinci’s influence on modern disciplines. Can you help me outline his major achievements?”
- Entrepreneurial Intent: “I’m looking to make an informed decision on which material to prioritize for my brand. Can you provide insights on their sustainability and market demand?”
(4) Response Format
Guide the output format to receive the information the way you want it. For instance, if you need a step-by-step guide, ask for a list of steps. If you prefer a concise explanation, request that the information be provided in a paragraph. By specifying the format, you ensure that the AI’s response is organized and easy to comprehend.
Examples:
- Medical Research Response Format: “Please provide the guidelines in a bullet-point list so I can easily share them with parents.”
- Historical Analysis Response Format: “Could you present da Vinci’s achievements in a timeline format, highlighting the years and his corresponding innovations?”
- Entrepreneurial Response Format: “I’d appreciate a side-by-side comparison table of the two materials, detailing their sustainability metrics and market demand.”
Let’s try these three full prompts to check the quality of the output with GPT-4 (ChatGPT):
Practical Examples
Example 1: Medical Research Prompt
π§βπ» Prompt Example:
"I'm a medical researcher studying the effects of prolonged screen time on children's eyesight, focusing on children in the age range of 6-12 years old and the effects of screen exposure on their eyesight. I want to understand the recommended guidelines for screen time for this age group to ensure their eye health. Please provide the guidelines in a bullet-point list so I can easily share them with parents."
Example 2: Historical Analysis Prompt
π§βπ» Prompt Example:
"I'm a history teacher preparing a lesson on the Renaissance period for high school students. I'm particularly interested in Leonardo da Vinci's contributions during the Renaissance, especially his innovations in both art and science. I aim to create a lesson plan that highlights da Vinci's influence on modern disciplines. Could you present da Vinci's achievements in a timeline format, highlighting the years and his corresponding innovations?"
Example 3: Entrepreneurial Prompt
π§βπ» Prompt Example:
"I'm an entrepreneur in the early stages of developing a sustainable fashion brand. I'm considering organic cotton and recycled polyester as potential materials for my fashion brand. I'm looking to make an informed decision on which material to prioritize for my brand. Can you provide insights on their sustainability and market demand? I'd appreciate a side-by-side comparison table of the two materials, detailing their sustainability metrics and market demand."
Bonus Example: Python Developer
π§βπ» Prompt Example:
"I'm a Python developer working on a web application using the Flask framework. I've encountered an issue where my application isn't connecting to my PostgreSQL database correctly. I need help troubleshooting this connection problem. Could you provide a step-by-step guide to ensure proper database connectivity using Flask and PostgreSQL?"
TLDR & Next Steps
Let’s recap our simple formula: The perfect prompting formula consists of
- context,
- specific information,
- intent, and
- response format.
Applying this approach to ChatGPT, Bard, and Bing will significantly improve your results and save time.
Feel free to check out our other Finxter article on Alien technology, aka LLMs, and how they work: π
πͺ Recommended: Alien Technology: Catching Up on LLMs, Prompting, ChatGPT Plugins & Embeddings
Prompt Engineering with Python and OpenAI
You can check out the whole course on OpenAI Prompt Engineering using Python on the Finxter academy. We cover topics such as:
- Embeddings
- Semantic search
- Web scraping
- Query embeddings
- Movie recommendation
- Sentiment analysis
π¨βπ» Academy: Prompt Engineering with Python and OpenAI