Welcome to Day 8 of #10DaysOfLangChain — our daily scoop of LangChain learning, garnished with a hearty Indian storytelling flavor 🍛.
Today, we’re going on a nostalgic trip — to a simple Indian household, filled with chai, chatter, and cutting-edge AI disguised as age-old wisdom.
We’ll explore two powerful concepts:
- RAG: Retrieval-Augmented Generation
- Prompt Templates: A way to structure your AI conversations smartly
Let’s begin with someone who taught us more about "contextual responses" than any machine ever could — our Dadi (Grandma).
🧓 Dadi and the Never-Wrong Answers
Dadi never claimed to know everything. But somehow, she always gave the perfect answer — whether you asked how to cure a sore throat, how to impress a college professor, or even why your crush left your message on “seen”.
Her secret?
She didn’t just speak randomly. She always referred to something — a home remedy from her diary, a lesson from a bhajan, or wisdom from an old incident. Then she connected that information to your situation and gave you advice that made sense.
This is exactly what RAG brings to Artificial Intelligence.
🔍 What is RAG – Retrieval-Augmented Generation?
Let’s say you ask a basic language model:
“Tell me about India’s digital economy.”
Now, if the AI was trained months ago, it might give you general, outdated facts. Not very useful, right?
But with RAG, the AI first retrieves the most up-to-date and relevant documents — maybe a news article, a government report, or a research paper. Then it generates a response based on that content.
Think of it like this:
“Pehle jaake jaanch karo, fir bolna.” (First verify, then speak.)
That’s exactly what RAG enables:
- Retrieval: It finds accurate, recent, and context-specific information from trusted sources like PDFs, websites, or your private database.
- Augmented Generation: It uses that content to generate a thoughtful, articulate answer — not a guess, but a grounded explanation.
In Indian homes, this is what elders do — they don’t shoot in the dark. They dig up the right info, cross-check facts, and then speak. Whether it’s about stock markets or how much ajwain to use for a stomach ache.
With RAG, your AI becomes similarly trustworthy.
📜 Prompt Templates – The Art of Structured Questions
Now let’s talk about something equally important: how we ask questions.
Back in school, when we wanted a bathroom break, we didn’t shout “Toilet!” We carefully said:
“Ma’am, may I go to the washroom?”
The way we frame a question often decides how well the other person understands it. The same logic applies to AI.
Prompt Templates help us talk to AI in a clear, consistent, and structured way.
Imagine writing emails every day. You don’t want to write the full format from scratch each time. So, you create a template:
- “Dear {Name},”
- “As per our last discussion…”
- “Regards, {Your Name}”
Prompt Templates work the same way. You define a structure for your prompts, and just fill in the blanks when needed.
Why is this useful?
- It ensures the AI always understands the context.
- It maintains a professional or polite tone.
- It saves time and reduces confusion.
In short, Prompt Templates help your AI behave more like your well-trained office assistant — polite, sharp, and on point.
☕ Two Types of Prompt Templates – Desi Home Edition
Let’s go a bit deeper into the types of Prompt Templates you’ll use in LangChain.
1. String Prompt Templates – The Masala Chai Analogy
Everyone in India loves chai. But the base remains the same:
- Water
- Milk
- Tea leaves
- Sugar
What changes? The masala. Some add ginger, others prefer elaichi. But the format is fixed.
String Prompt Templates work the same way. You write a base prompt like:
“Tell me about the importance of {topic} in {field}.”
And then you just plug in values like:
- Topic = Yoga
- Field = Modern healthcare
Useful when you want quick, simple responses with specific variables.
2. Chat Prompt Templates – Like Our Family WhatsApp Group
In Indian families, the WhatsApp group is pure chaos and pure gold:
- Mummy sends a voice note.
- Papa replies with a thumbs up.
- Cousin drops a cricket meme.
- You respond with a joke.
In this back-and-forth, context matters.
Chat Prompt Templates help structure such multi-turn conversations in LangChain. You can define:
- A system message (e.g., "You are a helpful assistant.")
- A user message (e.g., "How do I file my taxes?")
- An AI reply (e.g., "To file taxes in India, follow these steps...")
Perfect for building chatbots or support agents that need to remember the tone, context, and role.
🗃️ Bonus: MessagesPlaceholder – Keeping the Full Conversation Alive
Ever had a friend say:
“But you said last week you loved pineapple on pizza!”
And you’re like, “Wait, how do you remember that?!”
That’s context retention.
LangChain gives us a magical tool called MessagesPlaceholder — it lets your AI remember the entire thread of conversation. This way, your assistant can respond based on what the user said five minutes ago — or five queries ago.
It brings continuity, natural flow, and memory to your chatbot.
In desi terms, it's like how your mom remembers what you promised last Diwali. You can’t escape it.
📚 When RAG Meets Prompt Templates – Power Combo, Desi Style
Let’s combine what we’ve learned.
- RAG is about getting the facts right. Think of your cousin searching Google mid-conversation to quote something accurately.
- Prompt Templates are about organizing the conversation. Like your mom telling a story step-by-step, with proper beginning, middle, and end.
When you use both together:
✅ You get rich, fact-based answers
✅ Your responses are structured and easy to follow
✅ The whole conversation feels natural and intelligent
It’s like hosting a well-planned family dinner:
- The food (facts) is fresh
- The order (conversation) is smooth
- The guests (users) leave impressed
🌺 Desi Takeaway
In our Indian culture, we’ve always respected two things:
- Gyaan (Knowledge) – The facts must be correct.
- Vaani (Speech) – The way you deliver it matters.
LangChain's RAG and Prompt Templates capture this beautifully:
- Don’t speak without substance.
- And when you do speak, say it properly.
Whether you're building a chatbot, a research tool, or a smart Q&A assistant, this combo is your foundation. It's like learning from your elders — grounded, respectful, and deeply insightful.
📎 Credits
This blog is inspired by the official LangChain Documentation — an incredible resource for learning how to build context-aware, agent-based applications powered by large language models (LLMs).
☁️ About Me
Hi, I’m Utkarsh Rastogi — an AWS Community Builder and Cloud Specialist helping teams build scalable, secure, and innovative solutions in the cloud.
🔗 Connect with me on LinkedIn
📝 Follow my blog on Hashnode
📚 Read more on Dev.to
⚠️ Disclaimer
This blog is intended for educational and learning purposes only.
Any characters, analogies, or cultural references are meant to make technical concepts easier to understand — they are not linked to real people or events.
Let’s learn with fun, facts, and desi flair 🇮🇳✨
🙏 Shukriya for reading today’s edition of LangChain with an Indian soul.
May your prompts be structured, your responses relevant, and your AI full of grace and gyaan.
Top comments (2)
Loved the desi analogies! Really curious to know—what’s your next step after RAG and Prompt Templates? Will you be diving into advanced features or showing a real-world project next? Looking forward to the updates!
I have Posted all 10 days blog for langchain series please check and for project part please wait for few weeks