Advanced Prompting Techniques
Chain-of-thought, few-shot examples, system prompts, and other techniques covered in the later modules.
Once you've mastered the basics, these techniques take your prompting from good to professional-grade.
Chain-of-thought prompting
Ask the AI to think through a problem step by step before giving its answer. This dramatically improves accuracy on complex reasoning tasks.
What is 17 × 24?
What is 17 × 24? Think through this step by step before giving your final answer.
Few-shot prompting
Show the AI 2–3 examples of the input/output format you want before asking your real question. The model pattern-matches from the examples.
Classify the sentiment: "I love this product!" → Positive "It broke after one day." → Negative "It arrived on time." → Neutral Now classify: "The instructions were confusing but it works well."
Role prompting
Assign the AI a specific persona to get more consistent, expert-level answers:
You are a senior data scientist with 10 years of experience in NLP. Explain transformer architecture to a junior engineer joining the team.
System prompts (for developers)
When building with the OpenAI API directly, the system message sets the AI's behaviour for the whole conversation. Think of it as a persistent instruction sheet:
System: You are a helpful cooking assistant. Always recommend seasonal ingredients, keep recipes under 30 minutes, and avoid nuts in all dishes.
Structured output
Ask the AI to return data in a specific format — JSON, Markdown tables, or bullet lists — so you can use the output programmatically:
Return your response as a JSON object with keys: "summary" (string), "pros" (list of 3), "cons" (list of 3).
Iterative refinement
Treat prompting as a conversation. If the first response isn't quite right:
- "Make it shorter / longer / simpler / more formal"
- "Add an example"
- "Focus more on X, less on Y"
- "Now do the same for a different audience: …"
When prompting doesn't help
Prompting can't overcome fundamental model limitations. If the AI consistently gets something wrong, it may not have the knowledge, or the task may require real-time data, tools, or human judgment.