// What's Next · Done · The Associate Track
Developing LLM Applications with LangChain
Completed Nov 07, 2026 · 3 hrs
Covers building LLM apps with LangChain: prompting OpenAI and Hugging Face models, prompt templates, few-shot prompting, LCEL chains, ReAct agents with custom tools, and a full RAG workflow using document loaders, splitters, and ChromaDB vector storage.
Models and Prompting
- ChatOpenAI: Calls the OpenAI API to define a model, accepting parameters like temperature and max_completion_tokens.
- HuggingFacePipeline: Downloads an open-source model locally from a model ID and task, prompted the same way with .invoke().
- PromptTemplate: Creates reusable prompt recipes from a template string, inserting variables with curly braces.
- ChatPromptTemplate: Builds prompts with chat message roles such as system, human, and ai using .from_messages.
Few-Shot Prompting
- FewShotPromptTemplate: Converts a list of question-answer dictionaries into a few-shot prompt template for extra model context.
- example_prompt: A PromptTemplate that formats how each example question and answer is structured.
- suffix: Formats the user input and specifies which variable that input is assigned to.
- input_variables: Declares the variables, like the user query, that the few-shot template expects.
Chains and Agents
- LCEL pipe operator: Chains prompts, models, and output parsers into a sequence where data flows from one component to the next.
- Sequential chains: Feed the output of one chain into another, passing parsed strings through a dictionary of keys.
- ReAct agents: Reasoning and Acting agents that loop through thinking, acting, and observing to solve problems with tools.
- create_react_agent: LangGraph function that builds a ReAct agent from an LLM and a list of tools.
- Custom tools: Python functions converted with the @tool decorator, needing a name, description, and return_direct.
RAG Workflow
- Document loaders: Classes like PyPDFLoader, CSVLoader, and UnstructuredHTMLLoader that load documents into memory with .load().
- Chunk overlap: Shared text between chunks that helps retain context when splitting long documents.
- CharacterTextSplitter: Splits on a single separator, but may fail to keep chunks below the specified chunk_size.
- RecursiveCharacterTextSplitter: Works through a list of separators left to right, combining chunks to stay under chunk_size.
- ChromaDB: Lightweight vector database used to embed, store, and retrieve document chunks via a retriever.
Ecosystem and Resources
- LangSmith: For troubleshooting and evaluating applications in the LangChain ecosystem.
- LangServe: For deploying applications to production.
- LangGraph: Branch of the ecosystem for designing agentic systems and multi-agent knowledge graphs.
- LangChain Hub: Catalog of prompts for a range of tasks that can be searched, used, and added to.
- LangChain templates: Ready-to-use code blocks covering common use cases, often needing minor modifications.
// Module notes
Models and Prompt Templates
LangChain's real trick is that swapping models changes almost nothing. ChatOpenAI calls the OpenAI API with parameters like temperature and max_completion_tokens; HuggingFacePipeline downloads an open-source model locally, and you still prompt it the same way with .invoke(). Prompt templates turn one-off prompts into reusable recipes: PromptTemplate.from_template inserts variables with curly braces, while ChatPromptTemplate.from_messages adds chat roles such as system, human, and ai. The LCEL pipe operator chains a prompt to a model, and .invoke() takes a dictionary. Watch for the trap: pass a dictionary, not raw variables.
Few-Shot Prompting
Plain PromptTemplate classes handle a single example but do not scale to a dataset, so FewShotPromptTemplate converts a list of question-answer dictionaries into a few-shot prompt template. Build an example set, format it with a PromptTemplate example_prompt, then pass both to FewShotPromptTemplate along with a suffix and input_variables. Invoke the template to inspect the exact context the model will see, then pipe it to an LLM in an LCEL chain and invoke with a dictionary. Few-shot prompting steers behavior without fine-tuning.
Chains and Agents
Sequential chains feed the output of one chain into another, using a dictionary to pass the first chain's parsed string to the second prompt template. Agents go further: they use language models to decide actions and call tools. ReAct agents loop through thinking, acting, and observing, built with create_react_agent and load_tools from LangGraph. Custom tools need a name, description, and return_direct, created by adding the @tool decorator to a Python function. Watch that the LLM rewords the tool output in its final answer, so check the raw result.
Retrieval Augmented Generation
RAG embeds a user query, retrieves relevant documents, and adds them to the model prompt so the answer has context beyond training data. The workflow has three stages. Load documents with loaders like PyPDFLoader, CSVLoader, and UnstructuredHTMLLoader. Split into chunks, where RecursiveCharacterTextSplitter handles large documents better than CharacterTextSplitter, and chunk overlap keeps context from leaking away at the edges. Encode and store chunks in ChromaDB, then convert it to a retriever with .as_retriever(). Splitting and retrieval quality decide whether RAG works.
Wrap-Up and Ecosystem
LangChain's core library is only part of the picture. LangSmith handles troubleshooting and evaluating applications, LangServe deploys them to production, and LangGraph designs multi-agent knowledge graphs. Two resources are worth bookmarking: LangChain Hub offers a searchable catalog of prompts for many tasks, and LangChain templates provide ready-to-use code blocks for common use cases, often needing only minor modifications. The takeaway is that models, prompts, chains, and agents combine through LCEL, and RAG is how external data gets in.
In plain terms
LangChain is the plumbing of an LLM app: prompt templates are the fittings, chains are the pipes, and tools are the taps an agent can turn. You write a prompt once, connect it to any model, and let data flow through a chain until an answer comes out. When the model needs outside knowledge, RAG works like a librarian who pulls the right shelf before the model answers.
Worth sitting with
- When a ReAct agent loops through thinking, acting, and observing, what decides when it stops, and what happens when a tool returns a plausible but wrong result?
- If chunk overlap is what keeps meaning across split boundaries, how do you find the right amount before retrieval quality degrades?
- Since the LLM can reword a tool's output before it reaches the user, what would it take to keep the final answer faithful to the raw data?
// Where this fits
The concepts above are the ones this module turns on, and the notes below explain each in turn. The course page carries the whole track, and the certificate page carries the plan it belongs to.