How nathansebhastian/langchain-js works
This repository is a beginner’s LangChainJS book implemented as runnable, mostly independent chapter examples, rather than one integrated application. The learning path progresses from basic model calls and user prompts through chains, conversation history, agents, and retrieval over documents, YouTube transcripts, and images; chapters 15–16 add separate Next.js chat applications. The graph groups model-provider variants by chapter capability. Edges are limited to relationships visible in excerpts or README; dashed, uncited links indicate unverified chapter-level integration.
Main entry points: 13_Chat_YouTube/app_gemini.js YouTube Chat · 10_Agents_And_Tools/app_gemini.js Agents and Tools · 14_Chat_Images/app_gemini.js Image Chat · 09_Chat_History/app_gemini.js Chat History
Components 25
Model and Prompt Basics
- Basic Q&A
02_Simple_Q&A_Gemini/app_gemini.js - Model Providers
03_Using_OpenAI/app_gpt.js - User Input
05_Enabling_User_Input - Prompt Templates
06_Prompt_Template/app_gemini.js
Chains and Agents
- LCEL Chains
07_LCEL/create_chain.js - Sequential Chains
08_Sequential_Chain/app_gemini.js - Chat History
09_Chat_History/app_gemini.js - Agents and Tools
10_Agents_And_Tools/app_gemini.js - Search and Wiki
Retrieval and Media
- Document Chat
11_Chat_Documents - Text RAG
11_Chat_Documents/rag_app.js - Document Formats
12_Handle_Different_Docs/app_gemini.js - YouTube Chat
13_Chat_YouTube/app_gemini.js - Image Chat
14_Chat_Images/app_gemini.js - Image Encoding
14_Chat_Images/handle_image.js
Next.js Chat Apps
- Chat Interface
15_nextjs_langchain/components/chat - OpenAI Action
15_nextjs_langchain/actions/openai.action.ts - App Page
15_nextjs_langchain/app/page.tsx - Production Chat UI
16_nextjs_langchain_prod/components/chat - Production Action
16_nextjs_langchain_prod/actions/openai.action.ts - Production Page
16_nextjs_langchain_prod/app/page.tsx
Other components
- Learner
- Language Model APIs
- YouTube Transcript
- Chat User
Connections 35
- Learner → Basic Q&A: runs example
- Learner → User Input: provides input
- Learner → Prompt Templates: provides values
06_Prompt_Template/app_gemini.js - Prompt Templates → Language Model APIs: invokes model
06_Prompt_Template/app_gemini.js - Learner → Sequential Chains: provides topic
08_Sequential_Chain/app_gemini.js - Sequential Chains → Language Model APIs: invokes model
08_Sequential_Chain/app_gemini.js - Learner → Chat History: asks questions
09_Chat_History/app_gemini.js - Chat History → Language Model APIs: invokes model
09_Chat_History/app_gemini.js - Learner → Agents and Tools: asks question
10_Agents_And_Tools/app_gemini.js - Agents and Tools → Search and Wiki: dispatches tools
10_Agents_And_Tools/app_gemini.js - Agents and Tools → Language Model APIs: invokes model
10_Agents_And_Tools/app_gemini.js - Learner → Text RAG: asks question
11_Chat_Documents/rag_app.js - Text RAG → Language Model APIs: embeds and answers
11_Chat_Documents/rag_app.js - Learner → Document Formats: asks questions
12_Handle_Different_Docs/app_gemini.js - Document Formats → Language Model APIs: embeds and answers
12_Handle_Different_Docs/app_gemini.js - Learner → YouTube Chat: supplies URL
13_Chat_YouTube/app_gemini.js - YouTube Chat → YouTube Transcript: loads transcript
13_Chat_YouTube/app_gemini.js - YouTube Chat → Language Model APIs: embeds and answers
13_Chat_YouTube/app_gemini.js - Learner → Image Chat: asks questions
14_Chat_Images/app_gemini.js - Image Chat → Image Encoding: encodes image
- Image Chat → Language Model APIs: invokes model
14_Chat_Images/app_gemini.js - Chat User → App Page: opens chat
- App Page → Chat Interface: renders chat
- Chat Interface → OpenAI Action: submits messages
- OpenAI Action → Language Model APIs: requests completion
- Chat User → Production Page: opens chat
- Production Page → Production Chat UI: renders chat
- Production Chat UI → Production Action: submits messages
- Production Action → Language Model APIs: requests completion
- Basic Q&A → Language Model APIs: invokes model
- Model Providers → Language Model APIs: uses provider
- User Input → Language Model APIs: sends prompt
- LCEL Chains → Language Model APIs: invokes chain
07_LCEL/create_chain.js - Document Chat → Text RAG: offers retrieval example
- YouTube Chat → Chat History: retains conversation
13_Chat_YouTube/app_gemini.js