What is LangChain?
LangChain is a framework that simplifies the development of applications using LLMs.
Instead of writing all the integration code yourself, LangChain provides reusable components to connect different AI capabilities.
Key features
- LLM integration: Connect to OpenAI, Anthropic, and other model providers.
- Prompt templates: Create reusable prompts with dynamic inputs.
- Retrieval-Augmented Generation (RAG): Retrieve information from vector databases and provide it to LLMs.
- Tool integration: Allow LLMs to interact with APIs, databases, and external services.
- Chains: Combine multiple operations into a sequence.
- Output parsers: Convert LLM responses into structured formats such as JSON.
Example: Simple RAG application
Suppose you want to build a chatbot that answers questions from internal banking documents.

Simple LangChain Python example
from langchain_openai import ChatOpenAI
from langchain_core.prompts import ChatPromptTemplate
llm = ChatOpenAI(model=”gpt-4.1″)
prompt = ChatPromptTemplate.from_template(
“Answer the question based on this context: {context}\n”
“Question: {question}”
)
chain = prompt | llm
response = chain.invoke({
“context”: “FD approval requires confirmation through Smart Approve.”,
“question”: “How is FD approval confirmed?”
})
print(response.content)
This example demonstrates a simple LLM chain. A production RAG application would additionally connect a document retriever.