AI / LangGraph LangChain Interview questions
What are Chains in LangChain?
A Chain in LangChain is any sequence of processing steps that takes an input, passes it through one or more components (prompts, models, retrievers, tools), and produces an output. Chains are the fundamental unit of composition — everything from a single prompt+model call to a multi-step RAG pipeline is a chain.
The modern way to build chains is with LCEL (using the | operator). Legacy chain classes still exist but are deprecated:
| Legacy Class | LCEL Equivalent |
|---|---|
| LLMChain | prompt | llm | StrOutputParser() |
| SimpleSequentialChain | chain1 | chain2 | chain3 |
| RetrievalQA | (retriever | format_docs) | prompt | llm | StrOutputParser() |
| ConversationalRetrievalChain | RunnablePassthrough + retriever + prompt | llm |
Every LCEL chain is itself a Runnable, so chains compose recursively — a chain can be embedded inside another chain as a step. The main practical patterns are: simple prompt chain (question → answer), RAG chain (question → retrieve → augment → answer), and agent loop (question → plan → tool → observe → answer).
Invest now in Acorns!!! 🚀
Join Acorns and get your $5 bonus!
Acorns is a micro-investing app that automatically invests your "spare change" from daily purchases into diversified, expert-built portfolios of ETFs. It is designed for beginners, allowing you to start investing with as little as $5. The service automates saving and investing. Disclosure: I may receive a referral bonus.
Invest now!!! Get Free equity stock (US, UK only)!
Use Robinhood app to invest in stocks. It is safe and secure. Use the Referral link to claim your free stock when you sign up!.
The Robinhood app makes it easy to trade stocks, crypto and more.
Webull! Receive free stock by signing up using the link: Webull signup.
More Related questions...
