Uploaded August 2026 | Updated November 2026, 2 days ago
Day 3 of the free LangChain 10 Days Bootcamp. This lesson covers ChatPromptTemplate: how to stop rewriting the same prompt over and over, fill placeholders at runtime, and pass previous conversation history into a new chat.
We start with why prompt templates exist, using a customer support tool as the example (same boilerplate instructions, different email and tone every time). Then we build a template from scratch, fill it with a dictionary, add a second placeholder, and handle the missing-variable error the way you would in production. We also hit the curly braces trap that breaks templates containing real JSON, and fix it. The lesson ends with .partial() for filling placeholders in stages, and MessagesPlaceholder for carrying chat history across threads. Everything runs on a free API, so you can follow along without paying anything.
๐บ Full playlist (LangChain 10 Days Bootcamp): youtube.com/playlist?list=PLW4pPr9JCovI
โฑ Chapters:
0:00 Intro and Recap of Day 1 and Day 2
1:15 Why You Need a Prompt Template
2:40 Real Use Case: Support Reply Tone Dropdown
3:56 How System, Human and AI Messages Flow
6:09 What Happens If a Placeholder Is Missing
7:39 MessagesPlaceholder for Chat History
9:41 Recap: Free OpenRouter API Setup
10:34 Day 3 Notebook and LangSmith Tracing
12:23 Summarizing an Email the Brute Force Way
14:26 Building Your First ChatPromptTemplate
15:45 Filling the Email Placeholder at Runtime
17:35 Passing Filled Messages Straight to the Model
19:30 Checking input_variables on a Template
20:02 Adding a Second Placeholder for Tone
23:44 Switching the Tone from Warm to Formal
24:06 The Missing Placeholder Error in Practice
25:04 Handling Errors Cleanly with try/except
25:44 The Curly Braces Trap with JSON Data
27:25 The Fix: Double Curly Braces
28:38 Partial Fill with .partial()
30:40 MessagesPlaceholder in Code
33:48 Building the Prompt with Chat History
34:53 Testing History Against the Model
36:32 from_template vs from_messages
37:55 Wrap-Up and What's Next
๐ Resources:
Code + slides (GitHub): github.com/laxmimerit/Langchain-10-Days-Bootcamp
Browse free models on OpenRouter: openrouter.ai/models
LangSmith (free signup): smith.langchain.com
LangChain install docs: docs.langchain.com/oss/python/langchain/install
๐บ Watch first:
Day 1: LangChain Tutorial for Beginners: Free AI API Setup with OpenRouter
youtu.be/EMRRGr-uYkU
Day 2: LangChain Tutorial for Beginners: Messages, Roles and LangSmith Setup
youtu.be/T-J__9CS4jo
๐ Level up with my Udemy course:
Master LangChain v1 and Ollama - Chatbot, RAG and AI Agents: kgptalkie.com/langchain
If this made prompt templates click, leave a like and tell me in the comments which part tripped you up. Subscribe so you catch Day 4, where we chain the template, model, and parser into one line.
#LangChain #PromptEngineering #GenerativeAI #Python #LLM
Day 3 of the free LangChain 10 Days Bootcamp. This lesson covers ChatPromptTemplate: how to stop rewriting the same prompt over and over, fill placeholders at runtime, and pass previous conversation history into a new chat.
We start with why prompt templates exist, using a customer support tool as the example (same boilerplate instructions, different email and tone every time). Then we build a template from scratch, fill it with a dictionary, add a second placeholder, and handle the missing-variable error the way you would in production. We also hit the curly braces trap that breaks templates containing real JSON, and fix it. The lesson ends with .partial() for filling placeholders in stages, and MessagesPlaceholder for carrying chat history across threads. Everything runs on a free API, so you can follow along without paying anything.
๐บ Full playlist (LangChain 10 Days Bootcamp): youtube.com/playlist?list=PLW4pPr9JCovI
โฑ Chapters:
0:00 Intro and Recap of Day 1 and Day 2
1:15 Why You Need a Prompt Template
2:40 Real Use Case: Support Reply Tone Dropdown
3:56 How System, Human and AI Messages Flow
6:09 What Happens If a Placeholder Is Missing
7:39 MessagesPlaceholder for Chat History
9:41 Recap: Free OpenRouter API Setup
10:34 Day 3 Notebook and LangSmith Tracing
12:23 Summarizing an Email the Brute Force Way
14:26 Building Your First ChatPromptTemplate
15:45 Filling the Email Placeholder at Runtime
17:35 Passing Filled Messages Straight to the Model
19:30 Checking input_variables on a Template
20:02 Adding a Second Placeholder for Tone
23:44 Switching the Tone from Warm to Formal
24:06 The Missing Placeholder Error in Practice
25:04 Handling Errors Cleanly with try/except
25:44 The Curly Braces Trap with JSON Data
27:25 The Fix: Double Curly Braces
28:38 Partial Fill with .partial()
30:40 MessagesPlaceholder in Code
33:48 Building the Prompt with Chat History
34:53 Testing History Against the Model
36:32 from_template vs from_messages
37:55 Wrap-Up and What's Next
๐ Resources:
Code + slides (GitHub): github.com/laxmimerit/Langchain-10-Days-Bootcamp
Browse free models on OpenRouter: openrouter.ai/models
LangSmith (free signup): smith.langchain.com
LangChain install docs: docs.langchain.com/oss/python/langchain/install
๐บ Watch first:
Day 1: LangChain Tutorial for Beginners: Free AI API Setup with OpenRouter
youtu.be/EMRRGr-uYkU
Day 2: LangChain Tutorial for Beginners: Messages, Roles and LangSmith Setup
youtu.be/T-J__9CS4jo
๐ Level up with my Udemy course:
Master LangChain v1 and Ollama - Chatbot, RAG and AI Agents: kgptalkie.com/langchain
If this made prompt templates click, leave a like and tell me in the comments which part tripped you up. Subscribe so you catch Day 4, where we chain the template, model, and parser into one line.
#LangChain #PromptEngineering #GenerativeAI #Python #LLM










