Prompt Engineering
The Only Formula You’ll Ever Need to Master Prompting on ChatGPT and Google Bard
If you’ve ever wondered why some prompts generate outputs that are super generic, while others give you exactly what you’re looking for, you’re not alone. Prompting is an essential skill, but its nuances can be elusive. After spending hundreds of hours taking prompt engineering courses and applying what
I’ve learned, I’ve distilled the process into six core building blocks. These will help you consistently create high-quality prompts and get the most out of AI tools like ChatGPT and Google Bard.
The Six Building Blocks of a Good PromptThe six components that make up a good prompt are task, context, exemples, personal, format, and tone. While all six are important, there’s a hierarchy of importance. To understand why, consider this example: “I’m a 70kg male; give me a three-month training program.”
The task is the most critical element. Without it, the AI won’t generate any meaningful output. While the context provides additional useful information, it’s not as essential as the task The other components, such as personal, format, and tone, further refine the output but are optional.
When crafting prompts, think of these six building blocks as a mental checklist. This formular will remind you to include just enough relevant information to achieve your desired output.
Breaking Down the Six ComponentsTaskAlways start your task sentence with an action verb—generate, give, write, analyze, etc.—and clearly articulate your goal. Tasks can range from simple, like “generate a three-month training program,” to complex, like “analyze hundreds of user feedback entries, share the top three takeaways, and categorize the feedback by the responsible team.”
ContextContext is often the trickiest to get right because there’s no limit to the information you could provide. To make it manageable, ask yourself these three questions:
What’s the user’s background?
What does success look like?
What environment are they in?
For instance, in the workout example, you might say: “I’m a 70kg male looking to put on 5kg of muscle over the next three months. I can go to the gym twice a week for one
hour per session.” This information is sufficient to constrain the possibilities and focus the AI’s output.
Exemple Examples, can significantly improve the quality of AI outputs. For instance, if you’re rewriting a resume bullet point, provide a structure like: “I accomplished X by doing Y, resulting in Z.” Another example could be: “Rewrite this feedback into a structured table with columns for ‘original feedback,’ ‘team responsible,’ and ‘priority.’” Providing examples or frameworks enhances the AI’s ability to deliver precise results.
PersonalDefine who you want the AI to emulate. For instance, you might ask it to act as a recruiter, a senior product manager, or even a fictional character like Batman. Adding a persona helps align the AI’s tone and style with your intended audience or task.
FormatVisualize how you want the output to look. Should it be a table, a list, bullet points, or paragraphs? For example, you could say: “Summarize this report using H2 headers for each topic, and bold any changes you make.” This clarity helps the AI deliver outputs you can easily use.
ToneSpecify the tone you want—formal, casual, witty, enthusiastic, etc. For example, if you’re writing to a new team and want to sound serious but approachable, ask the AI to use a “friendly yet confident tone.” If you’re unsure, you can even ask the AI for tone suggestions based on the situation.
Putting It All TogetherHere’s an example of a comprehensive prompt that incorporates all six components:“You are a senior product marketing manager at Apple. You’ve just unveiled the Apple Car in collaboration with Tesla and received 12,000 pre-orders, 200% higher than the target. Write an email to your boss, Tim Cook, sharing this positive news. The email should include: a TL;DR section, project background, business results with quantifiable metrics, and a thank-you note for the product and engineering teams. Use clear and concise language with a confident yet friendly tone.”
Compare this to a simpler prompt: “I launched the Apple Car and received 12,000 pre-orders. Write an email to my boss.” The difference in output quality is significant.
ConclusionMastering the art of prompting isn’t just about knowing the components; it’s about applying them effectively. By using the formula of task, context, exemplars, persona, format, and tone, you’ll be able to consistently craft prompts that generate high-quality outputs. Start experimenting with these techniques, and you’ll quickly see a difference in how AI tools respond to your queries.
Prompt:“You are a virtual travel assistant specializing in customer service for a global travel agency. Your primary goal is to provide personalized, efficient, and delightful experiences for travelers. Use clear and concise language, and ensure a friendly and professional tone in all responses. Follow the guidelines below:
Task: Answer customer inquiries related to booking flights, hotels, car rentals, or travel packages. Assist with itinerary changes, cancellations, or upgrades.
Context: The customer may be new to travel or experienced, so adapt responses based on their level of expertise. Ensure you consider their preferences, such as budget, travel dates, and destinations.
Exemples:
For a query like “Can I change my flight to a later date?”, respond with:“Yes, I can help you with that. Please provide your booking reference number and the new preferred date, and I’ll check availability for you.”
If the customer asks about travel recommendations, use a format like:“Based on your interests in adventure and a tropical destination, I recommend Bali, Indonesia. You can enjoy activities like surfing, hiking Mount Batur, and visiting the Uluwatu Temple.”
Personal: Act as a knowledgeable, empathetic, and approachable travel concierge who is well-versed in international travel policies and local tourism insights.
Format:
Use bullet points for presenting travel options.
Use tables to compare pricing or availability of flights and hotels.
Write detailed, yet concise paragraphs when explaining travel policies or destination highlights.
Tone: Maintain a warm, inviting tone that conveys enthusiasm for travel while ensuring professionalism. Avoid technical jargon unless the customer is experienced.
For example, if a customer says: “I need help planning a family vacation to Europe,” your response could look like this:
“Thank you for reaching out! I’d be happy to help plan your European family vacation. Could you share the dates, number of travelers, and your preferred destinations? Based on your preferences, I can suggest a few itineraries. Here’s one example:
Day 1-3: Explore Paris, including the Eiffel Tower and Disneyland Paris.
Day 4-6: Visit Rome for a tour of the Colosseum and family-friendly cooking classes.
Day 7-8: Relax in Switzerland with scenic train rides through the Alps.Let me know if this aligns with your vision, or if you’d like alternative options.”
Always ask follow-up questions to provide a tailored experience, and conclude with an offer to assist further.”
- Task (Purpose of the Response)The chatbot addresses a general inquiry about investments in Bali and provides a recommendation.
What’s Good: It identifies a specific development, the Amazona Jungle Resort, and gives some details about its competitive edge and profitability.
What’s Missing: The response doesn’t explicitly confirm the user’s exact intent or clarify the query.
Improvement: Include a quick validation of the user's needs, e.g.,"Are you specifically looking for investment opportunities in Bali, or would you like to know more about our developments in the region?"
2. Context (Adaptation to Customer Needs)The response provides context about the competitive landscape and financial viability of the Amazona Jungle Resort.
What’s Good: The comparison with Ulan Uman and the pricing model adds depth.
What’s Missing: The chatbot doesn’t inquire about the user's investment preferences, such as budget, ROI expectations, or location interests.
Improvement: Tailor the context further by asking personalized questions, e.g.,"Are you more interested in short-term returns or long-term value? This will help me recommend the most suitable option for you."
3. Exemplars (Clarity with Specific Examples)The chatbot uses the Amazona Jungle Resort as an example and compares it to a competitor.
What’s Good: The example is detailed and includes financial metrics (e.g., nightly rates, profit margin).
What’s Missing: The explanation could benefit from more structured and concise delivery.
Improvement: Use bullet points or a table to highlight the differences:
Amazona Jungle Resort: $120/night, 15% net profit, 20 minutes from Canggu.
Ulan Uman: $250/night, established competitor.
This structure improves readability and professionalism.
4. Persona (Tone and Approach)The tone is friendly and conversational, with an informal style.
What’s Good: The chatbot comes across as approachable and enthusiastic about the product.
What’s Missing: The tone could be more professional to establish credibility, especially when discussing investment opportunities.
Improvement: Maintain a balance between friendliness and professionalism, e.g.,"The Amazona Jungle Resort offers a unique investment opportunity with its competitive pricing model and strategic location. Would you like more details on its financial performance or operational model?"
5. Format (Clarity of Structure)The response is presented in a conversational flow but lacks structure.
What’s Good: The conversational format engages the user.
What’s Missing: The response could benefit from segmentation, like short paragraphs or bullet points, to make key points easier to follow.
Improvement: Use concise paragraphs for each point or format the response as:
Recommendation
Why It’s Special
Competitive Advantage
6. Tone (Consistency and Suitability)The tone is consistent and friendly but could better align with a professional investment pitch.
What’s Good: The enthusiasm helps keep the user engaged.
What’s Missing: The tone should inspire confidence in the investment opportunity.
Improvement: Use professional but accessible language to establish trust, e.g.,"This development has been carefully planned to maximize returns while offering a distinctive jungle experience for guests, making it a standout choice in Bali's competitive market."
Final Feedback and SuggestionsValidate the User's Intent: Clarify what the customer is looking for.
Structure the Response: Use bullet points or segments for clarity.
Ask Follow-Up Questions: Personalize the recommendation based on the user's goals.
Balance Tone: Combine friendliness with professionalism to convey credibility.
Improved Example Response:"Thank you for your interest! If you're exploring investment opportunities in Bali, I highly recommend our Amazona Jungle Resort. Here's why:
Unique Offering: One of only two jungle resorts in the Canggu area.
Strategic Location: Just 20 minutes from Canggu, a popular destination.
Competitive Pricing: Our nightly rate is $120 with a 15% net profit, compared to Ulan Uman’s $250/night minimum.
Would you like to know more about the financial details or the development timeline? Also, where are you located? This can help us provide additional insights tailored to your preferences."
Prompt for AI Chatbot:
"You are an AI investment advisor specializing in luxury travel and real estate opportunities. Your role is to provide personalized recommendations, detailed information, and clear comparisons to help users make informed decisions. Follow these guidelines:
Identify the Customer's Intent: Always confirm the user's needs before giving a detailed response. Example: "Are you looking for a property to invest in or a vacation rental opportunity?"
Provide Clear and Concise Answers: Use short paragraphs or bullet points to structure your response for better readability.
Personalize Recommendations: Ask relevant follow-up questions, such as:
"What is your budget?"
"Are you more focused on long-term ROI or short-term gains?"
Use Data to Support Claims: Include specific metrics like pricing, ROI, competitive advantages, and location benefits. For example:
"The Amazona Jungle Resort offers a 15% net profit with a nightly rate of $120, while its main competitor charges $250 per night."
Be Friendly but Professional: Keep the tone approachable and trustworthy. Avoid jargon and offer assistance for further inquiries.
End with a Call to Action: Encourage engagement by asking a direct question or offering additional help. For example: "Would you like to schedule a virtual tour or get a detailed breakdown of the investment plan?"
This prompt ensures that the chatbot engages users effectively, provides relevant information, and maintains a professional yet friendly tone suitable for investment discussions.
Response from the AI Chatbot:"Hi there, um I'm not 100% sure what you're searching for but if you're looking for a good investment case out of our six developments in Bali my highest recommendation would be our Amazona Jungle Resort.Great question, Will! The Amazona Jungle Resort is really special because you see jungle accommodations in Bali are among the highest revenue-generating properties. We've strategically chosen a location just 20 minutes from Canggu, which is super interesting because there are only two jungle resorts in the area—us and Ulam.Ulam's been around for a while and is quite popular, but what's fascinating is that our pricing model is very competitive. We aim for a 15% net profit with a nightly rate of $120, while Ulam's minimum is $250 per night.So yeah, it's a very promising investment opportunity. By the way, where are you currently located?"
Evaluation Against the Formula:Identify the Customer's Intent:
Formula: Confirm user needs before giving detailed answers.
Chatbot: The chatbot assumes the user's intent but does not clarify or confirm what the user is searching for.
Improvement: Start by asking something like, "Are you looking for details on one of our developments or general investment advice?"
Provide Clear and Concise Answers:
Formula: Structure responses in a clear, readable format.
Chatbot: While the information is relevant, it is presented in a long paragraph that could be broken into bullet points or shorter sections for clarity.
Improvement: Use structured formatting:
"Here’s why Amazona Jungle Resort is a standout option:
Strategic location: 20 minutes from Canggu.
Competitive pricing: $120 per night, compared to $250 at Ulam.
High revenue potential: Aiming for a 15% net profit."
Personalize Recommendations:
Formula: Ask follow-up questions to tailor recommendations.
Chatbot: The chatbot does not ask any personalized questions beyond the user’s location.
Improvement: Include questions such as:
"Are you interested in short-term rentals or long-term investments?"
"Do you have a preference for specific amenities or locations?"
Use Data to Support Claims:
Formula: Include metrics like pricing, ROI, and competitive analysis.
Chatbot: Metrics such as nightly rates and profit percentage are provided. This aligns with the formula.
Improvement: Add a bit more context or explain the significance of those metrics. For example:
"At $120 per night, our competitive pricing ensures faster occupancy rates, which is critical for generating ROI."
Be Friendly but Professional:
Formula: Maintain an approachable and trustworthy tone.
Chatbot: The tone is friendly but lacks polish. Phrases like "great question, Will!" and "so yeah" feel overly casual.
Improvement: Adjust the tone to sound more professional:
"That's a great question, Will! Let me share why the Amazona Jungle Resort is a top choice."
End with a Call to Action:
Formula: Encourage engagement with a direct question or next step.
Chatbot: Ends by asking where the user is located, which is helpful for personalization but not a clear call to action.
Improvement: Suggest actionable next steps:
"Would you like to see a detailed investment breakdown or schedule a virtual tour?"
Overall Feedback:The response partially follows the formula but could improve in the following areas:
Confirming the user's intent.
Structuring the response more clearly.
Asking personalized questions for tailored recommendations.
Ending with a stronger call to action.
Revised Response Example:*"Hi there! Are you looking for a great investment opportunity in Bali? If so, my top recommendation is the Amazona Jungle Resort.
Here’s why it stands out:
Prime location: Just 20 minutes from Canggu, a high-demand area.
High revenue potential: Jungle accommodations in Bali are among the top-performing properties.
Competitive pricing: Our nightly rate is $120, targeting a 15% net profit, while our competitor’s minimum rate is $250.