Lesson 1 / 31
Why Use an LLM Framework
Understand what frameworks add over calling a model API directly.
Common plumbing, written once
Every LLM application repeats the same plumbing: building prompts from templates, calling a provider, parsing output, loading and splitting documents, embedding and searching them, calling tools, keeping chat history, retrying failures, streaming tokens and logging. LangChain and LlamaIndex provide tested building blocks for these tasks and a common interface across many providers, so switching a model or vector store is a small change. The trade-offs are an extra layer to learn, fast-moving APIs and abstractions that can hide what is actually sent to the model. For a very simple app, calling the provider's SDK directly can be cleaner; frameworks pay off as pipelines, retrieval and tools grow.
Building blocks for LLM apps
LangChain composes steps; LlamaIndex connects your data; both wrap models, prompts, tools and retrievers.
Kitchen appliances versus cooking by hand
A mixer saves effort once you cook often, but for boiling one egg it is overkill. Use a framework when the repeated plumbing is bigger than the learning cost.
Inspect what is sent
Whatever framework you use, log the final prompt and the raw model reply while developing. Most debugging happens there.
Quick check: What do LLM frameworks mainly provide?
- Free GPUs
- A new language model
- Reusable building blocks and common interfaces for prompts, retrieval, tools and models
- A replacement for Python
Answer
Reusable building blocks and common interfaces for prompts, retrieval, tools and models — They standardise common plumbing around the model.