Introduction
Creating clear and useful instructions for AI can be tricky. Prompt templates and variables help by making these instructions flexible and easy to reuse for different situations.
Jump into concepts and practice - no test required
Imagine you have a greeting card with a blank space for the recipient's name. You keep the card design the same but write different names in the blank space for each person you send it to. This way, you don’t have to make a new card every time.
┌─────────────────────────────┐ │ Prompt Template │ │ "Write a story about {X}" │ └─────────────┬───────────────┘ │ ┌───────▼────────┐ │ Variables │ │ {X} = "a cat" │ └───────┬────────┘ │ ┌───────▼─────────────┐ │ Final Prompt │ │ "Write a story about a cat" │ └─────────────────────┘
name?"Translate '{text}' to French." and the variable text = 'Good morning', what is the final prompt sent to the AI?"Summarize the article: {content}". But when you run it, the AI returns an error. What is the most likely mistake?content is missing, the placeholder {content} remains unresolved, causing errors.content -> Option Btext and task to handle this?task should specify the action (summary or sentiment), and text is the content to analyze.