Artificial Intelligence Lesson 2 of 4
Prompt Engineering Architectures: Chain-of-Thought & Few-Shot
24:15 AI for Everyday Problem Solving
Move beyond basic prompts. Master structured system instructions, few-shot demonstration examples, and reasoning step enforcement.
Lesson notes
Prompt engineering is the art of structuring instructions so an AI model operates at peak precision. Providing clear constraints and intermediate reasoning steps dramatically elevates output quality.
What you'll learn
- The Role-Context-Task-Constraint (RCTC) prompting framework
- Few-Shot prompting: Teaching by showing concrete input/output examples
- Chain-of-Thought (CoT) prompting to eliminate logical calculation errors
1. The RCTC Framework
Every high-stakes prompt should include four components: Role (Who is the AI?), Context (What background situation exists?), Task (What exact deliverable is needed?), and Constraints (What must it NOT do, and in what format?).
2. Chain-of-Thought Prompting
When you force a model to output its intermediate deduction steps before stating its final answer ('Think step-by-step before answering'), reasoning benchmarks jump from 40% accuracy to over 85%.
System: You are an expert data parsing assistant.
Context: We receive messy customer support emails that need automated routing.
Task: Extract the customer sentiment, urgency (P1/P2/P3), and core topic.
Format: Return strictly valid JSON with keys: sentiment, urgency, category, summary.
Constraints: Do not write conversational pleasantries. If uncertain, mark urgency as P2.
Example 1:
Input: 'System is totally down, my team cannot work!'
Output: {"sentiment": "negative", "urgency": "P1", "category": "outage", "summary": "Team blocked by total outage."}This demonstrates a Few-Shot RCTC prompt with rigid constraints.