Black Friday50% off your first month on any monthly plan with EARLY50 See plans
All 29 lessons
  1. Foundations: what RAG is and a working pipeline

    1. 1. Getting started: what RAG is and when to use it
    2. 2. Types of RAG: a map from naive to agentic
    3. 3. Lab: build the smallest RAG pipeline end to end
    4. 4. How embeddings and vector search find meaning
    5. 5. Document types: what each one breaks, and how to prepare it
  2. Better retrieval: chunking and search

    1. 6. Chunking documents so answers survive
    2. 7. Chunking strategies compared: which to use when
    3. 8. Keyword search vs vector search, and fusing both
    4. 9. Retrieval algorithms compared: which to use when
    5. 10. Reranking the top results before the model reads them
    6. 11. Rewriting the question before you search
  3. Answers you can trust, measure and debug

    1. 12. Lab: grounded answers with citations and refusals
    2. 13. Measuring a RAG system with an evaluation set
    3. 14. Lab: evaluation methods and frameworks: Ragas and DeepEval
    4. 15. Troubleshooting a RAG system, symptom by symptom
  4. Production in a company

    1. 16. Access control: only retrieve what the user may see
    2. 17. Defending against prompt injection in retrieved text
    3. 18. Running RAG in production: freshness, cost and monitoring
    4. 19. Real-world RAG: what worked, what failed, and why
  5. Agentic RAG

    1. 20. Lab: from a fixed pipeline to an agent with a search tool
    2. 21. Self-correcting retrieval: grade, retry, fall back
    3. 22. GraphRAG and routing across many sources
    4. 23. Lab: numbers, tables and financial documents
  6. Frameworks: LangChain, LangGraph and LangSmith

    1. 24. The RAG toolbox: what each library does and why you import it
    2. 25. The framework landscape: LangChain, LangGraph, LlamaIndex, Haystack
    3. 26. Lab: Ask Brightline in LangChain
    4. 27. Lab: agentic RAG as a LangGraph graph
    5. 28. Lab: tracing, evaluating and monitoring with LangSmith
    6. 29. Wrap-up: your production agentic RAG checklist
See the leaderboard

15 min

The RAG toolbox: what each library does and why you import it

Open up what pip installs for RAG: what each library contains, which depend on which, and which you can skip.

By the end of this lesson you can

  • Say what each common RAG library is for and what you import from it
  • Read the dependency chain: which package pulls in which
  • Decide which libraries are required, which are optional, and what replaces them

From earlier lessons · 1 of 2

Why should a model never do the arithmetic in a financial answer?

Pick one answer.

From earlier lessons · 2 of 2

Where does a LangGraph agent's loop cap live?

Pick one answer.

You type one line, pip install sentence-transformers, and wait. The download is past 500 MB before it finishes. You only wanted a 90 MB embedding model. What else just arrived, and do you need it?

The one line, and what it really installs

Every lab in this course starts with a pip install. Each package you name pulls in others it depends on, its dependencies, and those pull in theirs. Here's the line for the LangChain lab, and the packages it actually brings in. All figures come from each package's PyPI metadata, checked on 16 November 2026. Versions move fast, so check again before you pin.

[47][50]

bash
pip install langchain langchain-anthropic langchain-huggingface sentence-transformers
# langchain -> langchain-core, langgraph, pydantic
# langchain-core -> langsmith, pydantic, httpx, tenacity
# langchain-anthropic -> langchain-core, anthropic
# langchain-huggingface -> langchain-core, huggingface-hub, tokenizers
# sentence-transformers -> transformers, torch, huggingface-hub, numpy, scikit-learn, scipy
Terminal. Each comment line lists the most important direct dependencies, from PyPI.
Rendering diagram…
Everything in the LangChain family rests on langchain-core, not on langchain. And langchain itself depends on langgraph, not the other way round.

Open the box: six groups of libraries

1. Running models locally.

  • numpy holds vectors as arrays and does the cosine maths. Nearly everything depends on it. Import it as import numpy as np.
  • sentence-transformers gives you SentenceTransformer for embeddings and CrossEncoder for reranking. It's optional: an embedding API replaces it.
  • transformers holds the model definitions and tokenizers underneath. You rarely import it directly.
  • torch (PyTorch) does the computing. It's the big one: about 139 MB on a Mac and 539 MB on Linux, before CUDA libraries for GPUs. You need it only for local models.
  • huggingface-hub downloads model weights the first time you load a model.

2. Talking to a hosted model. anthropic (from anthropic import Anthropic) and openai are thin API clients. You need one client for generation. They're small and depend mainly on pydantic and an HTTP library.

[50]

3. Search.

  • rank-bm25 gives you BM25Okapi for keyword search. It does no tokenising, so you pass lists of words. Its last release was in 2022; Postgres full-text search is a maintained alternative.
  • faiss-cpu holds in-memory vector indexes: IndexFlatL2, IndexHNSWFlat, and IVF and PQ variants. It wants float32 arrays.
  • pgvector, the Python package, only adapts the vector type for Postgres drivers such as psycopg and SQLAlchemy. It has no dependencies of its own. The vector extension must also be installed in the Postgres server itself.

[53]

4. The LangChain family.

  • langchain-core holds the base pieces: Document, prompts, messages, the vector-store interface and InMemoryVectorStore. Every other LangChain package depends on it.
  • langchain is the application layer: create_agent and init_chat_model. Since 1.x it depends on langgraph.
  • Integration packages connect one provider each: langchain-anthropic (ChatAnthropic), langchain-openai, langchain-huggingface (HuggingFaceEmbeddings) and langchain-postgres (PGVector). They depend on langchain-core, not on langchain, so you can use them without it.
  • langchain-text-splitters holds the splitters, and needs its own install.
  • langchain-classic holds the pre-1.0 chains and retrievers. Install it only to run old code.
  • langchain-community holds older third-party integrations. LangChain's docs now describe it as no longer maintained.

[48][54]

5. Agents and graphs. langgraph holds StateGraph, MessagesState, START and END. It brings langgraph-prebuilt (ToolNode, tools_condition) and langgraph-checkpoint (saved state) with it. It needs langchain-core, but not the langchain package.

6. Tracing and evaluation. langsmith gives you traceable and Client. It arrives with every langchain-core install, but sends nothing until you set LANGSMITH_TRACING=true. ragas and deepeval are the evaluation frameworks from lesson 14, and they're heavy. Ragas depends on langchain, langchain-community and the OpenAI packages. DeepEval depends on pytest and openai.

[28][49]

See it yourself

python
from importlib.metadata import requires, version
for pkg in ["langchain", "langchain-core", "langchain-anthropic", "langgraph"]:
deps = [r.split(";")[0].split(">")[0].split("<")[0].strip()
for r in (requires(pkg) or []) if "extra ==" not in r]
print(f"{pkg} {version(pkg)}: {', '.join(deps[:5])}")
Run it in your own environment. Expected, for the November 2026 versions: langchain 1.5.0 lists langchain-core, langgraph, pydantic; langchain-anthropic 1.7.10 lists langchain-core, anthropic, pydantic. Your versions may differ.

Pip names and import names differ. That's a common first-day error, so here are the ones in this course:

  • faiss-cpu is imported as faiss.
  • rank-bm25 is imported as rank_bm25.
  • sentence-transformers is imported as sentence_transformers.
  • haystack-ai is imported as haystack.
  • llama-index-core is imported as llama_index.core.
  • Every langchain-x is imported as langchain_x.

Why one import line per package? Python only loads what you import, so each line says exactly which piece you use. That keeps start-up fast and makes dependencies visible to the next reader.

[51][52]

Match

Match each need to the package you install

Pick an item on the left, then its match on the right.

Worth keeping

  1. Each pip line pulls a tree of dependencies; sentence-transformers alone brings PyTorch.
  2. LangChain integrations depend on langchain-core, so you can skip the langchain package.
  3. LangGraph and LangSmith work without LangChain; langchain itself depends on LangGraph.
  4. Use Python 3.12+, watch for pip and import names that differ, and pin versions once it works.

You know what's in the box. Next lesson compares the frameworks built from these parts, LangChain, LangGraph, LlamaIndex and Haystack, and when plain Python beats all of them.

Leaderboard

Loading…

50 XP for each lesson you finish, 10 for each right answer. Names show only for learners who turn on Show me on leaderboards.

Sources for this lesson (9)

Each fact in the lesson is marked with the number of the page it comes from.

  1. [28]LangGraph docs: Overview
  2. [47]PyPI: langchain (dependencies and Python version)
  3. [48]PyPI: langchain-core
  4. [49]PyPI: langgraph
  5. [50]PyPI: sentence-transformers
  6. [51]PyPI: langchain-huggingface
  7. [52]PyPI: numpy
  8. [53]pgvector-python README
  9. [54]LangChain docs: Vector store integrations