Not all prompts are created equal. Understanding the components of effective prompts is like learning the ingredients of a great recipe—once you know what goes where and why, you can create variations for any situation.
Multiple placeholders for different pieces of information:
Copy
Here is a sentence: {sentence1}Here is another sentence: {sentence2}Compute the semantic similarity between the two sentences.
Example:
Copy
Here is a sentence: The cat sat on the mat.Here is another sentence: A feline rested on the rug.Compute the semantic similarity between the two sentences.
You are a computer scientist with extensive knowledge in deep learning.Please explain the following concept to a 10-year-old child, using simple examples.Concept: {concept}
You are a professional copywriter specializing in e-commerce product descriptions. You excel at highlighting benefits while maintaining authenticity.Write a product description for: {product}
You are a helpful customer service representative. You are:- Patient and empathetic- Clear and concise in explanations- Focused on solving problems- Professional but friendlyCustomer inquiry: {inquiry}
Role assignment works because it activates relevant patterns in the model’s training data. When you say “You are a poet,” you’re essentially saying “generate text that matches patterns associated with poetry.”
You are a writing assistant. Analyze the following text and:IF the text is less than 100 words: - Expand it to at least 200 words - Add more descriptive detailsIF the text is more than 500 words: - Summarize to under 300 words - Keep key pointsText: {text}
Stage 1: Read and understand the following codeStage 2: Identify any bugs or issuesStage 3: Suggest improvementsStage 4: Provide corrected versionCode:{code}Analysis:
Task: Convert casual text to professional toneExample 1:Input: "Hey, can u send me that file?"Output: "Could you please send me that file?"Example 2:Input: "Thx for ur help!"Output: "Thank you for your assistance."Now convert:Input: "{casual_text}"Output:
You are a professional email assistant.Relationship: {relationship}Tone: {formal/friendly/neutral}Original email:"""{original_email}"""Write an appropriate response that:- Addresses all points raised- Maintains professional tone- Is concise (under 200 words)Response:
Exercise 2: Code Documentation Generator
Requirements:
Input: Code snippet
Output: Documentation with description, parameters, returns, examples
Sample Solution
Copy
You are a technical documentation specialist.Generate comprehensive documentation for the following code:Code:
Copy
Documentation should include:1. Brief description (1-2 sentences)2. Parameters (name, type, description)3. Return value (type, description)4. Usage example5. Edge cases or notesDocumentation:
Exercise 3: Content Summarizer
Requirements:
Input: Long article
Context: Target audience and purpose
Output: Summary with key points
Sample Solution
Copy
Task: Article SummarizationTarget audience: {audience}Purpose: {purpose}Length: {word_count} wordsArticle:"""{article_text}"""Create a summary that:- Captures main arguments- Highlights key data/facts- Maintains original tone- Is accessible to target audienceSummary: