Text generation is where LLMs truly shine—creating everything from creative stories to functional code. But raw generation often produces generic or unfocused content. The key is learning to guide generation with precise constraints and attributes. In this lesson, you’ll master patterns that turn vague requests into targeted, high-quality outputs.
Provide a starting point and let the model continue naturally.
Copy
Ask AI
Continue this story in 2-3 sentences:"The old lighthouse keeper noticed something unusual in the fog that morning."
Output:
Copy
Ask AI
A massive ship, unlike any he'd seen in his forty years at the post, emerged silently from the mist. Its hull gleamed with an otherworldly luminescence, and no crew could be seen on deck. He reached for his radio, hands trembling, knowing no one would believe what he was about to report.
Continue this story with these constraints:- Exactly 3 sentences- Include a plot twist- End with a questionStory start: "Detective Martinez opened the sealed envelope, expecting another routine case."
Output:
Copy
Ask AI
Inside, she found a photograph of herself from yesterday—a day she had no memory of living. The timestamp showed she'd been at a location she'd never visited, meeting with someone she'd never seen. How could she investigate a crime when she was apparently the one who committed it?
Pro Tip: Constraints actually improve creativity by providing structure and focus.
Generate realistic conversations between characters.
Copy
Ask AI
Write a dialogue between a customer and a tech support agent. The customer is frustrated about a software bug, and the agent is empathetic and solution-focused.Requirements:- 6-8 exchanges- Show the agent de-escalating the situation- End with a resolutionDialogue:
Output:
Copy
Ask AI
Customer: This is the third time this week your app has crashed! I'm losing work and patience.Agent: I completely understand your frustration, and I sincerely apologize for the disruption to your work. Let me help you resolve this right away.Customer: I've already tried restarting it. Nothing works.Agent: I hear you. Let's try something different. Can you tell me what you're doing right before it crashes?Customer: I'm usually working with large files, around 50MB each.Agent: That's helpful information. It sounds like you might be hitting a memory limit in the current version. I can upgrade your account to our Pro tier right now at no charge, which handles larger files smoothly.Customer: Really? That would actually help a lot.Agent: Absolutely. I've just applied the upgrade to your account. You should see improved performance immediately. I'll also follow up with you tomorrow to make sure everything's working well.
Create a team meeting dialogue with 4 people discussing a project deadline.Participants:- Sarah (Project Manager, concerned about timeline)- Mike (Developer, optimistic)- Lisa (Designer, needs more time)- Tom (Client liaison, pushing for early delivery)Generate 8-10 exchanges showing different perspectives and reaching a compromise.
Specify multiple attributes to control the output precisely.
Copy
Ask AI
Generate a product description with these attributes:Product: Wireless earbudsTarget Audience: Fitness enthusiastsTone: Energetic and motivatingLength: 100-150 wordsKey Features: Water resistance, 12-hour battery, secure fitCall-to-Action: Include at endFormat: Two paragraphsDescription:
Output:
Copy
Ask AI
Push your limits without limits! These wireless earbuds are engineered for athletes who refuse to compromise. With IPX7 water resistance, they'll power through your most intense workouts—rain, sweat, or shine. The secure-fit design stays locked in place whether you're sprinting, lifting, or crushing that final rep.Fuel your entire training day with 12 hours of continuous battery life. No more mid-workout charging breaks. No more excuses. Just pure, uninterrupted motivation pumping through crystal-clear audio. Ready to elevate your performance? Grab your pair today and experience the difference that premium workout audio makes.
Tone Control
Specify: Professional, casual, energetic, empathetic, humorous, etc.
Length Control
Use word counts, sentence counts, or paragraph counts
Audience Targeting
Define: Technical experts, beginners, executives, consumers, etc.
Format Specification
Request: Paragraphs, bullets, numbered lists, sections, etc.
Generate content matching a particular style or voice.
Copy
Ask AI
Write a product announcement in the style of a tech startup founder's blog post.Product: AI-powered calendar assistantStyle elements:- Conversational and personal- Shares the "why" behind the product- Includes a brief origin story- Ends with vision for the futureLength: 200-250 words
Output:
Copy
Ask AI
We've all been there. You're juggling three meetings, trying to find time for deep work, and somehow your calendar looks like a game of Tetris gone wrong. Six months ago, I found myself canceling dinner with my family for the third time that week because of "calendar chaos." That's when I knew something had to change.Today, I'm excited to introduce CalendarAI—the assistant that actually understands how you work. We built this because scheduling shouldn't feel like a puzzle. CalendarAI learns your preferences, protects your focus time, and automatically suggests optimal meeting slots based on your energy patterns and priorities. It's like having a personal assistant who knows that you're sharpest in the morning and that Fridays after 3 PM are sacred.But here's what really excites me: this is just the beginning. We're not just building a smarter calendar—we're reimagining how people reclaim control of their time. Imagine a world where your calendar works for you, not against you. Where "finding time" isn't a negotiation but a seamless experience.Ready to take back your time? Join our beta at calendarai.com. Let's build the future of productivity together.
Generate code with clear requirements and constraints.
Copy
Ask AI
Generate a Python function with these specifications:Function name: calculate_discountPurpose: Calculate final price after applying tiered discountsParameters:- original_price (float)- quantity (int)Discount tiers:- 1-9 items: 0% discount- 10-49 items: 10% discount- 50-99 items: 15% discount- 100+ items: 20% discountReturn: Final price (float)Include: Docstring, type hints, input validation, error handlingCode:
Output:
Copy
Ask AI
def calculate_discount(original_price: float, quantity: int) -> float: """ Calculate the final price after applying quantity-based tiered discounts. Args: original_price: The original price per item quantity: The number of items being purchased Returns: The final total price after discount Raises: ValueError: If original_price is negative or quantity is less than 1 Discount Tiers: - 1-9 items: 0% discount - 10-49 items: 10% discount - 50-99 items: 15% discount - 100+ items: 20% discount """ # Input validation if original_price < 0: raise ValueError("Original price cannot be negative") if quantity < 1: raise ValueError("Quantity must be at least 1") # Calculate base total base_total = original_price * quantity # Apply tiered discount if quantity >= 100: discount_rate = 0.20 elif quantity >= 50: discount_rate = 0.15 elif quantity >= 10: discount_rate = 0.10 else: discount_rate = 0.0 # Calculate and return final price final_price = base_total * (1 - discount_rate) return round(final_price, 2)
Generate a JavaScript function to validate email addresses.Requirements:- Function name: isValidEmail- Include detailed comments explaining the regex- Add JSDoc documentation- Include 3 example usages in comments- Handle edge cases
Create marketing email copy with these specifications:Campaign: Summer sale announcementProduct: Outdoor furniture collectionTarget: Homeowners aged 35-55Tone: Warm and inviting, not pushyLength: 150-200 wordsStructure:- Attention-grabbing subject line- Personal greeting- Value proposition (2-3 sentences)- Featured products (brief mention)- Clear CTA- Friendly sign-offEmail:
Output:
Copy
Ask AI
Subject: Transform Your Backyard Into a Summer Oasis ☀️Hi [Name],Remember that feeling of relaxing in your backyard on a perfect summer evening? We want to help you create more of those moments.Our Summer Collection features handcrafted outdoor furniture designed for comfort and durability. Each piece is weather-resistant and built to last, so you can focus on making memories instead of maintenance. From cozy conversation sets to elegant dining arrangements, we've curated everything you need to turn your outdoor space into your favorite room.This week only, enjoy 25% off our entire collection. Whether you're hosting weekend barbecues or seeking a quiet morning coffee spot, we have the perfect pieces waiting for you.Browse the collection and imagine your ideal summer setup. Your backyard retreat is just a click away.Here's to sunny days ahead,The [Company] TeamP.S. Free delivery on orders over $500!
Generate API documentation for an endpoint.Endpoint: POST /api/usersPurpose: Create a new user accountInclude:- Endpoint description- Request parameters (with types and requirements)- Example request body (JSON)- Possible response codes- Example responses- Error handling notesFormat: Markdown
Output:
Copy
Ask AI
## Create User AccountCreates a new user account in the system.**Endpoint:** `POST /api/users`**Authentication:** Required (API Key)### Request Parameters| Parameter | Type | Required | Description ||-----------|------|----------|-------------|| email | string | Yes | Valid email address (unique) || username | string | Yes | 3-20 characters, alphanumeric || password | string | Yes | Minimum 8 characters || full_name | string | No | User's full name || role | string | No | User role (default: "user") |### Example Request```json{ "email": "user@example.com", "username": "johndoe", "password": "SecurePass123!", "full_name": "John Doe", "role": "user"}
## Multi-Step GenerationBreak complex generation into steps for better results.
Generate a blog post about remote work productivity. Use a multi-step approach:Step 1: Create an outline with 5 main sections
Step 2: Write an engaging introduction (100 words)
Step 3: Develop each section (150 words each)
Step 4: Write a conclusion with actionable takeaways (100 words)Target audience: Remote workers and managers
Tone: Professional but approachable
Include: Statistics, practical tips, real-world examples
Copy
Ask AI
## Best Practices for Generation<Accordion title="Be Specific About Constraints">**Vague:** "Write something about our product"**Specific:** "Write a 150-word product description for fitness enthusiasts, highlighting water resistance and battery life, with an energetic tone"</Accordion><Accordion title="Provide Examples When Possible">**Without Example:**
Write a customer testimonial.
Copy
Ask AI
**With Example:**
Write a customer testimonial similar to this style:
“I was skeptical at first, but after using [product] for a month, I can’t imagine going back. The [feature] alone has saved me hours each week.”Focus on: Time savings, initial skepticism, specific feature
Copy
Ask AI
</Accordion><Accordion title="Use Iterative Refinement">**First Pass:** Generate basic content**Second Pass:** Add specific constraints**Third Pass:** Refine tone and styleThis approach often yields better results than trying to get everything perfect in one prompt.</Accordion>## Practice Exercises### Exercise 1: Product Description GeneratorCreate a prompt to generate product descriptions for an e-commerce site.Requirements:- Include 3 different tone options (professional, casual, luxury)- Specify length (100-150 words)- Include key features and benefits- Add a call-to-action<Accordion title="Sample Solution">
Generate a product description with these specifications:Product: [PRODUCT NAME]
Key Features: [LIST FEATURES]
Target Audience: [AUDIENCE]
Tone: [Professional/Casual/Luxury]
Length: 100-150 words
Structure:
Opening hook (1 sentence)
Key benefits (2-3 sentences)
Features highlight (2-3 sentences)
Call-to-action (1 sentence)
Description:
Copy
Ask AI
</Accordion>### Exercise 2: Email Response GeneratorDesign a prompt to generate customer service email responses.<Accordion title="Sample Solution">
Generate a customer service email response with these parameters:Customer Issue: [DESCRIBE ISSUE]
Resolution: [DESCRIBE SOLUTION]
Tone: Empathetic and professional
Length: 150-200 words
Include:
Acknowledgment of issue
Apology (if appropriate)
Clear explanation of resolution
Next steps
Offer for further assistance
Email:
Copy
Ask AI
</Accordion>### Exercise 3: Social Media Content GeneratorCreate a prompt for generating social media posts across platforms.<Accordion title="Sample Solution">
Generate social media content for [TOPIC/ANNOUNCEMENT]:Platform: [Twitter/LinkedIn/Instagram]
Character limit: [SPECIFY]
Tone: [Professional/Casual/Inspirational]
Include:
Create a complete blog post about [TOPIC] using this multi-stage approach:Stage 1 - Planning:
Target audience: [DEFINE]
Primary goal: [Educate/Persuade/Entertain]
Key takeaways: [LIST 3-5]
SEO keywords: [LIST]
Stage 2 - Structure:
Headline: Attention-grabbing, includes primary keyword
Introduction: 100-150 words, hook + preview
Body: 3-4 sections, 200-300 words each
Conclusion: 100-150 words, summary + CTA
Stage 3 - Content Requirements:
Tone: [SPECIFY]
Include: Statistics, examples, actionable tips
Format: Use subheadings, bullet points, short paragraphs
Length: 1200-1500 words total
Stage 4 - Optimization:
Meta description: 150-160 characters
Social media snippet: 100 characters
Featured image suggestion
Generate the complete blog post following this structure.
Copy
Ask AI
## Key Takeaways<Check>Use specific constraints to guide generation (length, tone, format)</Check><Check>Provide examples to establish style and quality expectations</Check><Check>Break complex generation into multiple steps</Check><Check>Specify target audience to ensure appropriate content</Check><Check>Include clear calls-to-action when generating marketing content</Check>## Next StepsYou've mastered content generation. Now learn to transform existing text across styles, formats, and languages.<Card title="Next: Lesson 2.4 - Text Transformation Prompts" icon="arrow-right" href="/module-2/lesson-4"> Transform text across languages, styles, and formats</Card>