Lesson 03 � Core Skill
PROMPT ENGINEERING:
AI SE SAHI RESULTS NIKALO.
Prompt engineering AI se better results lane ka art hai � sahi prompt = sahi output. Yeh skill AI jobs ke liye mandatory hai. Jaise chef ko sahi recipe chahiye, waise hi AI ko sahi prompt chahiye.
WHY: Prompt Engineering kyun zaroori hai?
AI models bahut powerful hain, lekin unhe sahi direction dena padta hai. Agar aapne vague prompt diya toh vague output milega. Agar aapne clear, structured prompt diya toh professional-quality output milega. Yeh skill data scientist, developer, aur kisi bhi AI user ke liye essential hai.
Specific instructions do. "Write about AI" mat bolo � "Write a 200-word blog post about Generative AI for beginners" bolo.
Background info do. AI ko batao kaun hai aapka audience, kya purpose hai, kya tone chahiye.
Few-shot learning use karo. 2-3 examples do AI ko ki aap expected output kaisa chahte ho.
Format specify karo � bullet points, numbered list, table, ya JSON. AI ko batao output kaisa dikhega.
Bad Prompt vs Good Prompt
Yeh dekho kaise ek basic prompt aur ek detailed prompt mein farq hota hai:
# Bad prompt � vague, no direction
bad = "Write about AI"
# Good prompt � clear, structured, specific
good = """Write a 200-word blog post about Generative AI for beginners.
Include:
1. What is GenAI
2. 3 real-world applications
3. Why it matters in 2024
Tone: Professional but friendly
Language: Hinglish"""Few-Shot Prompting: Examples do, AI seekh lega
Few-shot prompting mein aap AI ko 2-3 examples dete ho pattern samajhne ke liye. Phir AI usi pattern mein naya input process karta hai.
# Few-shot prompt � pattern seekinghao
few_shot = """Classify these reviews as positive or negative:
Review: "Bahut achha product hai!" ✓ Positive
Review: "Quality kharab thi" ✓ Negative
Review: "Delivery late hui" ?
Now classify this:"""Yahan AI ko sirf 2 examples diye � usne pattern samajh liya. Ab jab aap next review doge, AI correctly classify karega.
Chain of Thought: Step-by-step socho
Chain of Thought (CoT) prompting AI ko step-by-step sochne ke liye bolti hai. Complex problems solve karne mein yeh technique bahut useful hai.
# Chain of Thought � step-by-step reasoning
cot = """Solve step by step:
Q: If a train travels 100km in 2 hours, what is its speed?
Step 1: Speed = Distance / Time
Step 2: Speed = 100 / 2
Step 3: Speed = 50 km/h
Answer: 50 km/h"""Advanced Techniques
AI ko ek role do: "You are a senior data scientist with 10 years of experience..." Isse response quality improve hoti hai.
Boundaries set karo: "Write in exactly 3 sentences", "Use only simple words", "No jargon". AI follow karega.
Input aur instructions separate karo quotes, triple quotes, ya XML tags se. AI ko clearly samajh aata hai ki kya input hai aur kya instruction.
Pehla prompt perfect nahi hoga. Refine karo, output dekho, phir improve karo. Yeh process hai.
Try it: Prompt Practice
Yahan apne prompts likho aur dekho AI kaisa response deta hai. Different techniques try karo � few-shot, chain of thought, role play.
Exercise: Test Your Knowledge
Quick check
"Chain of Thought prompt kya hai?"
Socho: jab hum AI ko "step by step" bolte hain toh kya hota hai✓ AI kaise sochta hai?
Common Prompt Mistakes
- Vague prompts: "Write something about AI" � AI ko direction nahi milta. Specific bano.
- Context na dena: AI ko nahi pata audience kaun hai, kya tone chahiye. Background info do.
- Ek hi prompt expect karna: Prompt engineering iterative hai. Pehla attempt perfect nahi hoga � refine karo.
- Examples na dena: Few-shot learning powerful hai, use karo. 2-3 examples AI ko pattern samjha dete hain.
- Structure na dena: "List format mein do", "Table banao" � format specify karo, AI follow karega.
Ab fine-tuning par chalo � taaki aap samajh sako ki kab prompt engineering kaam nahi aati aur model ko directly train karna padta hai.