Step by Step
C
Core abstractions — PromptTemplate, LLM, OutputParser
PromptTemplate provides reusable prompts with variable slots; LLM/ChatModel provides a unified interface across different model providers; OutputParser parses raw model output into structured data.
Example: a PromptTemplate with a variable slot for {topic}, reused across many different specific topics without rewriting the prompt each time.
H
Higher-level components — Chain, Agent, Memory, Retriever
A Chain represents a sequence of steps; an Agent combines an LLM with tools and a reasoning loop; Memory persists state across interactions; a Retriever fetches relevant documents (as used in RAG).
Example: combining a Retriever (fetching relevant documents) with an LLM and OutputParser into a single Chain implementing a complete RAG pipeline.
L
LCEL — chaining components with pipe syntax
LangChain Expression Language (LCEL) chains components together using a pipe operator, such as prompt | LLM | parser, expressing a clear, readable pipeline.
Example: writing `prompt | llm | output_parser` in LCEL syntax to clearly express a pipeline where a prompt feeds into an LLM, whose output then feeds into a parser.
⭐
LangSmith — observability and debugging
LangSmith provides observability and debugging specifically for LangChain applications, allowing developers to trace every step of a complex chain or agent's execution. LlamaIndex is a related alternative framework focused specifically on RAG and document indexing.
Example: using LangSmith to trace exactly which step in a multi-stage LangChain pipeline produced an unexpected or incorrect result, rather than debugging blindly.
Applied Walkthrough
1
A developer builds a complex LangChain application combining a retriever, a prompt template, an LLM, and an output parser into a single pipeline.
2
Using LCEL's pipe syntax, they express this pipeline clearly: retriever feeding into the prompt, which feeds into the LLM, which feeds into the output parser.
3
When the pipeline produces an unexpected result, they use LangSmith to trace exactly which specific step in this multi-stage pipeline is responsible for the problem.
4
This targeted debugging, made possible by LangSmith's step-by-step tracing, is far more efficient than trying to debug the entire complex pipeline's behavior as one indivisible black box.
Exam Application
Exams test whether you can name LangChain's core abstractions (PromptTemplate, LLM/ChatModel, OutputParser, Chain, Agent, Memory, Retriever) and whether you understand LCEL's pipe syntax for chaining components, along with LangSmith's specific role in observability and debugging.
⚠ Common Trap
The most common trap is confusing LangChain (the framework for building LLM application pipelines) with LangSmith (the separate observability and debugging tool for those pipelines) or LlamaIndex (an alternative framework focused specifically on RAG and document indexing). These are related but distinct tools serving different specific purposes.
✓ Quick Self-Check
1. What does a PromptTemplate provide?
A reusable prompt with variable slots.
Tap to reveal / hide
2. What does an OutputParser do?
Parses raw model output into structured data.
Tap to reveal / hide
3. What does LCEL's pipe syntax express?
A clear pipeline chaining components together, such as prompt | LLM | parser.
Tap to reveal / hide
4. What does LangSmith specifically provide?
Observability and debugging for LangChain applications, tracing every step of execution.
Tap to reveal / hide
5. What is LlamaIndex, and how does it differ from LangChain?
An alternative framework focused specifically on RAG and document indexing, distinct from LangChain's broader pipeline-building focus.
Tap to reveal / hide