Skip to content

LangChain Textbook

A free, self-paced textbook in 8 chapters. Read a chapter, then drill it with the 166 companion flashcards using spaced repetition.

8 chapters · 166 cards · Updated

Chapters

  1. 1Foundations of LangChain and the Runnable Interface

    LangChain is an open-source Python framework for composing applications powered by large language models. Rather than wrapping a single model call, it provides modular building blo...

  2. 2Prompts, Chat Models, and Output Parsers

    Prompts are how you talk to the model, and LangChain offers a small family of templates that interpolate variables, hold few-shot examples, or inject dynamic message lists. The sim...

  3. 3Composing Runnables and Controlling Execution

    LCEL's real power lies in its composition primitives, which let you express branching, fan-out, and routing as dataflow. RunnableSequence chains runnables sequentially, while Runna...

  4. 4Memory and Conversation History

    Conversational applications need to remember what the user has already said, and LangChain offers a layered set of tools, ranging from legacy Memory classes to the modern RunnableW...

  5. 5Documents, Embeddings, and Vector Stores

    The retrieval stack begins with the Document class, a tiny data wrapper with two fields: page_content as a string and metadata as a dict. Every loader, splitter, retriever, and vec...

  6. 6RAG Pipelines and Document Processing

    A retrieval-augmented generation pipeline combines a retriever, a prompt, and an LLM so the model answers questions grounded in your own data. The canonical LCEL pattern is to buil...

  7. 7Tools, Agents, and LangGraph

    Tools are how an LLM takes real action in the world. The tool decorator turns any Python function into a LangChain tool — the function's name becomes the tool's name, and its docst...

  8. 8Observability, Evaluation, Deployment, and Caching

    LangChain's observability story centers on callbacks and LangSmith. A BaseCallbackHandler subclass implements lifecycle hooks — on_llm_start, on_chat_model_start, on_llm_new_token,...

← Back to the LangChain deck