AI Foundations · Module 03
LangChain Framework and Core Components
The LangChain building blocks a RAG application is made of: documents and loaders, embeddings, vector stores and retrievers, and how the LangChain ecosystem is organised today.
Học xong bạn làm được
- Load documents with LangChain document loaders
- Create embeddings and store them in a vector store
- Query a vector store through a retriever
- Place LangChain, LangGraph and LangSmith in the ecosystem
Bài học
- LangChain Framework and Core Components
LangChain is an open-source framework that links data, logic and models, covering the whole lifecycle of a RAG application. Its core components are document loaders, splitters, embedding models, vector stores and retrievers, used in an indexing phase and a retrieval phase.
- Documents and Document Loaders
In LangChain the basic unit of information is the Document, with page_content, metadata and id. Document loaders such as PyPDFLoader turn hundreds of kinds of source into Documents, and text splitters such as RecursiveCharacterTextSplitter cut long pages into overlapping chunks to make retrieval more accurate.
- Embeddings and Vector Stores
An embedding model turns text into a vector, so that texts with similar meanings lie close together and cosine similarity can measure how alike they are. A vector store keeps Documents with their vectors and offers add_documents for indexing and similarity_search for querying, from in-memory FAISS to databases such as Chroma, Pinecone and Postgres.
- Retrievers
A vector store stores; a retriever queries. Retrievers are Runnables, so they slot into chains; the simplest one comes from vector_store.as_retriever(), with search_type similarity, mmr or similarity_score_threshold and search_kwargs such as k. The lesson ends with the 2026 package layout of LangChain and what changed from earlier versions.