Course Content
LangChain Mastery
7 sections · 109 lessons
What are the core components of LangChain?
What you need to know
Think of the components in the order data flows through them in a request.
| Component | Job | Current example |
|---|---|---|
| Chat model | Sends messages to an LLM, returns an AIMessage | init_chat_model, ChatOpenAI, ChatAnthropic |
| Prompt template | Builds the message list from variables | ChatPromptTemplate, MessagesPlaceholder |
| Output parser / structured output | Turns the reply into a string or typed object | StrOutputParser, llm.with_structured_output(Model) |
| Document loader and splitter | Reads files and cuts them into chunks | PyPDFLoader, RecursiveCharacterTextSplitter |
| Embeddings and vector store | Turns chunks into vectors and searches them | OpenAIEmbeddings, FAISS, pgvector |
| Retriever | "Given a query, return documents" | vectorstore.as_retriever() |
| Tool | A function the model can ask to call | the @tool decorator |
| Agent | A model calling tools in a loop | create_agent (from langchain.agents) |
| Memory / persistence | Keeps conversation state between turns | LangGraph checkpointer, e.g. InMemorySaver, PostgresSaver |
| Callbacks / tracing | Observes every step | BaseCallbackHandler, LangSmith |
The glue: Runnables
Every component above is a Runnable, so prompt | llm | parser works, and so does putting a retriever inside a dict that feeds a prompt. You learn one interface and it applies everywhere.
What changed in 1.0
- The old
Memoryclasses (ConversationBufferMemoryand friends) are legacy. EvenRunnableWithMessageHistoryis deprecated in recentlangchain-corereleases in favour of LangGraph persistence. - Legacy chains such as
LLMChainandRetrievalQAmoved tolangchain-classic. create_agentreplacedinitialize_agent,AgentExecutorand LangGraph'screate_react_agent.
A real-life example
An accounts-payable team at a Chennai logistics firm receives 900 supplier invoices a week as PDFs. Their extraction pipeline touches almost every component: PyPDFLoader reads the PDF, a ChatPromptTemplate asks for the vendor name, GSTIN, invoice number, date and total, the chat model reads it, and with_structured_output(Invoice) returns a validated Pydantic object. A callback logs cost per invoice. No retriever or agent is needed, which is itself a good interview point: you use the components the job needs, not all of them.
Follow-up questions to expect
- "Where does conversation memory live now?" — In LangGraph persistence: pass a checkpointer and a
thread_id, and the message list is saved after every step. - "What is the difference between a retriever and a vector store?" — A vector store stores and searches vectors; a retriever is the simpler interface "query in, documents out", which may wrap a vector store, a keyword index, or a web search.
- "What is
langchain-corefor?" — It holds the base interfaces every other package depends on, so provider packages can release on their own schedule.