# KodeKloud: Courses LangChain ## LangChain ### Introduction - [Course: LangChain](https://notes.kodekloud.com/docs/LangChain/index.md): Introductory course teaching how to build modern AI applications with LangChain, covering models, prompts, chains, memory, tools, agents, and hands-on labs - [Course Introduction](https://notes.kodekloud.com/docs/LangChain/Introduction/Course-Introduction/page.md): Introductory course teaching how to build modern AI applications with LangChain, covering models, prompts, chains, memory, tools, agents, and hands-on labs - [Configuring the Development Environment](https://notes.kodekloud.com/docs/LangChain/Introduction/Configuring-the-Development-Environment/page.md): Guide to configuring a local Python environment for using the OpenAI API including installing Python and packages, creating and exporting an API key, and testing with curl and Jupyter ### Overview of LangChain - [What is LangChain](https://notes.kodekloud.com/docs/LangChain/Overview-of-LangChain/What-is-LangChain/page.md): Explains LangChain framework and SDK for integrating LLMs, embeddings, vector databases, and external data to build production-ready generative AI applications. - [Why LangChain](https://notes.kodekloud.com/docs/LangChain/Overview-of-LangChain/Why-LangChain/page.md): Overview of LangChain, a framework for building portable, composable generative AI apps with unified data connectors, prompt tooling, and agent orchestration. - [Key Use Cases](https://notes.kodekloud.com/docs/LangChain/Overview-of-LangChain/Key-Use-Cases/page.md): Overview of LangChain use cases and components for building production LLM applications such as summarization, RAG chatbots, classification, NLP pipelines, and autonomous agents ### Key Components of LangChain - [Building Blocks of LangChain](https://notes.kodekloud.com/docs/LangChain/Key-Components-of-LangChain/Building-Blocks-of-LangChain/page.md): Overview of LangChain's core components and how they integrate LLMs, embeddings, vector stores, prompts, chains, memory, retrieval, and agents to build modular AI applications. - [Model IO](https://notes.kodekloud.com/docs/LangChain/Key-Components-of-LangChain/Model-IO/page.md): Explains Model I/O for LLMs, covering prompt templating, output parsing, schema validation and safety for reliable integrations. - [Memory](https://notes.kodekloud.com/docs/LangChain/Key-Components-of-LangChain/Memory/page.md): Explains how LLMs are stateless and how LangChain adds short term and long term memory layers to persist and retrieve conversation context across sessions - [Retrieval](https://notes.kodekloud.com/docs/LangChain/Key-Components-of-LangChain/Retrieval/page.md): Explains retrieval pipelines for LLMs, covering offline ingestion, embeddings, vector databases, online similarity search, document splitting, metadata and best practices to improve relevant contextual responses. - [Chains](https://notes.kodekloud.com/docs/LangChain/Key-Components-of-LangChain/Chains/page.md): Explains LangChain chains as modular, composable pipelines connecting prompts, models, retrieval, parsing, memory, and functions to build sequential, parallel, conditional, and stateful workflows. - [Tools](https://notes.kodekloud.com/docs/LangChain/Key-Components-of-LangChain/Tools/page.md): Explains LangChain tools that connect LLMs to external APIs and services, built-in and custom tool creation, usage patterns, security practices, and organizing tools into reusable toolkits - [Agents](https://notes.kodekloud.com/docs/LangChain/Key-Components-of-LangChain/Agents/page.md): Explains LangChain agents that combine LLM reasoning with external tools and data to perform multi-step, context-rich tasks, including workflows, examples, and best practices. ### Interacting with LLMs - [Setting up Environment](https://notes.kodekloud.com/docs/LangChain/Interacting-with-LLMs/Setting-up-Environment/page.md): Guide to setting up LangChain environment, installing specific package versions, configuring OpenAI API key, and learning model calls, prompt engineering, and response parsing - [Types of Language Models](https://notes.kodekloud.com/docs/LangChain/Interacting-with-LLMs/Types-of-Language-Models/page.md): Comparison of Base LLMs and Chat models, explaining their differences, interaction patterns, use cases, and guidance for choosing between single-turn generation and multi-turn conversational models. - [Getting Started with LLMs](https://notes.kodekloud.com/docs/LangChain/Interacting-with-LLMs/Getting-Started-with-LLMs/page.md): Intro guide to using LangChain LLM wrappers, showing minimal code, provider switching between OpenAI and Google Gemini, authentication via environment variables, and practical examples and best practices. - [Messages in ChatModel](https://notes.kodekloud.com/docs/LangChain/Interacting-with-LLMs/Messages-in-ChatModel/page.md): Explains chat model message types, ordered message lists, and best practices for building multi-turn conversational prompts and personas using LangChain - [Messages in ChatModel Demo](https://notes.kodekloud.com/docs/LangChain/Interacting-with-LLMs/Messages-in-ChatModel-Demo/page.md): Guide to using message objects and best practices for constructing prompts with chat models, including examples, environment setup, and troubleshooting for SDKs like LangChain - [Prompt Templates](https://notes.kodekloud.com/docs/LangChain/Interacting-with-LLMs/Prompt-Templates/page.md): Explains LangChain prompt templates for system human and AI messages, showing usage patterns, Python example, best practices, and use cases for building reusable chat prompts. - [Prompt Templates Demo](https://notes.kodekloud.com/docs/LangChain/Interacting-with-LLMs/Prompt-Templates-Demo/page.md): Guide to building and using LangChain chat prompt templates, populating them at runtime, and invoking ChatOpenAI to generate assistant responses, with examples and best practices. - [Few shot Prompt Templates](https://notes.kodekloud.com/docs/LangChain/Interacting-with-LLMs/Few-shot-Prompt-Templates/page.md): Explains building few-shot chat prompt templates with LangChain to teach models transformations via examples and format and invoke a chat model, demonstrated by reversing strings. - [Parsing Model Output](https://notes.kodekloud.com/docs/LangChain/Interacting-with-LLMs/Parsing-Model-Output/page.md): Explains converting LLM text into structured, validated data using format instructions and output parsers to produce typed objects like JSON, XML, YAML or Pydantic models for reliable integration. - [Parsing Model Output Demo 1](https://notes.kodekloud.com/docs/LangChain/Interacting-with-LLMs/Parsing-Model-Output-Demo-1/page.md): Demonstrates using output parsers to enforce LLM response formats and convert comma separated model outputs into native Python lists for reliable downstream processing. - [Parsing Model Output Demo 2](https://notes.kodekloud.com/docs/LangChain/Interacting-with-LLMs/Parsing-Model-Output-Demo-2/page.md): Demonstrates using LangChain to prompt an LLM to emit valid JSON via JsonOutputParser and parse model responses into native Python structures for reliable downstream use. - [Parsing Model Output Demo 3](https://notes.kodekloud.com/docs/LangChain/Interacting-with-LLMs/Parsing-Model-Output-Demo-3/page.md): Explains using a Pydantic output parser to convert LLM responses into typed Python objects ### Tips, Tricks, and Resources - [Key Libraries](https://notes.kodekloud.com/docs/LangChain/Tips-Tricks-and-Resources/Key-Libraries/page.md): Overview of LangChain's layered ecosystem explaining Core runtime, community integrations, and the primary library for building chains agents and retrievers. - [Key Libraries Demo](https://notes.kodekloud.com/docs/LangChain/Tips-Tricks-and-Resources/Key-Libraries-Demo/page.md): Explains LangChain library organization, core implementation-agnostic abstractions, and how provider-specific integrations extend them with examples in a short notebook-style demo. - [Tips and Tricks](https://notes.kodekloud.com/docs/LangChain/Tips-Tricks-and-Resources/Tips-and-Tricks/page.md): Practical tips to add observability and debug LangChain apps using verbose logging, custom callbacks, and intermediate capture patterns to trace prompts, outputs, agents, and parsers. - [Debugging LangChain Applications](https://notes.kodekloud.com/docs/LangChain/Tips-Tricks-and-Resources/Debugging-LangChain-Applications/page.md): Guide to enabling and interpreting LangChain global debug logging, with minimal chain example, sample logs, and tips for diagnosing, measuring latency, and inspecting prompts. - [Using Verbose Flag](https://notes.kodekloud.com/docs/LangChain/Tips-Tricks-and-Resources/Using-Verbose-Flag/page.md): Explains enabling verbose logging in LangChain to inspect formatted prompts, lifecycle events, and outputs, how to set verbose True, use it selectively, and route logs via callbacks - [Callbacks](https://notes.kodekloud.com/docs/LangChain/Tips-Tricks-and-Resources/Callbacks/page.md): Explains LangChain callbacks, using built-in and custom handlers to capture lifecycle events for logging, observability, telemetry, debugging, and production best practices. - [Resources](https://notes.kodekloud.com/docs/LangChain/Tips-Tricks-and-Resources/Resources/page.md): Overview of LangChain resources, documentation, setup tips, integrations, and examples for building chains, agents, embeddings, and retrieval-based applications ### Introduction to LCEL - [Overview of LCEL](https://notes.kodekloud.com/docs/LangChain/Introduction-to-LCEL/Overview-of-LCEL/page.md): Introduction to LangChain Expression Language, a concise declarative DSL using pipe-style chains to compose reusable LLM pipelines, Runnables, retrievers, transformers, and parsers. - [LCEL Demo 1](https://notes.kodekloud.com/docs/LangChain/Introduction-to-LCEL/LCEL-Demo-1/page.md): Tutorial demonstrating a minimal LangChain LCEL chain composing a prompt, ChatOpenAI LLM, and StrOutputParser via pipe operator and inspecting input and output schemas. - [LCEL Demo 2](https://notes.kodekloud.com/docs/LangChain/Introduction-to-LCEL/LCEL-Demo-2/page.md): Demonstrates synchronous, streaming, and batch execution modes for LangChain-style chains with examples, usage guidelines, and best practices for invoke, stream, and batch workflows. - [LCEL Demo 3](https://notes.kodekloud.com/docs/LangChain/Introduction-to-LCEL/LCEL-Demo-3/page.md): Explains batching inputs for LangChain chains to run multiple prompt-variable dictionaries concurrently, boosting throughput while preserving input order and addressing concurrency limits and error handling. - [LCEL Demo 4](https://notes.kodekloud.com/docs/LangChain/Introduction-to-LCEL/LCEL-Demo-4/page.md): Explains LCEL RunnablePassthrough usage to forward inputs or inject and compute runtime keys in LangChain pipelines with examples and best practices - [LCEL Demo 5](https://notes.kodekloud.com/docs/LangChain/Introduction-to-LCEL/LCEL-Demo-5/page.md): Demonstrates an LCEL chain-of-chains pipeline that generates a title, outline, 200-word blog post, and social-media summary using prompts, LLMs, parsers, and passthroughs. - [LCEL Demo 6](https://notes.kodekloud.com/docs/LangChain/Introduction-to-LCEL/LCEL-Demo-6/page.md): Demonstrates building LCEL pipelines combining prompts, models, parsers, and RunnableLambda functions to transform, inspect, and debug model outputs and visualize pipeline graphs. ### Adding Memory to LLM Apps - [Adding Memory to LLM Apps](https://notes.kodekloud.com/docs/LangChain/Adding-Memory-to-LLM-Apps/Adding-Memory-to-LLM-Apps/page.md): Explains how to add short and long term memory to LLM applications using stores like Redis and vector databases, plus persistence, retrieval, and privacy best practices. - [Demo Adding Short Term Memory](https://notes.kodekloud.com/docs/LangChain/Adding-Memory-to-LLM-Apps/Demo-Adding-Short-Term-Memory/page.md): Explains adding short term memory to chat models by using a MessagesPlaceholder in ChatPromptTemplate to include conversation history for contextual responses - [Exploring Configurable Parameters](https://notes.kodekloud.com/docs/LangChain/Adding-Memory-to-LLM-Apps/Exploring-Configurable-Parameters/page.md): Explains configurable fields for runnables to override runtime parameters like LLM model per invocation, enabling cost control and flexible per-request model selection. - [Dealing with Memory](https://notes.kodekloud.com/docs/LangChain/Adding-Memory-to-LLM-Apps/Dealing-with-Memory/page.md): Explains adding persistent long term memory to LLM applications using external datastores like Redis, managing session histories, RunnableWithMessageHistory, and best practices for privacy and cost management. ### Performing Retrieval - [Performing Retrieval](https://notes.kodekloud.com/docs/LangChain/Performing-Retrieval/Performing-Retrieval/page.md): Describes Retrieval-Augmented Generation and RAG pipelines for retrieving context, embeddings, and vector search to ground LLM outputs, reduce hallucinations, and enable citations. - [Loading PDFs](https://notes.kodekloud.com/docs/LangChain/Performing-Retrieval/Loading-PDFs/page.md): Demonstrates loading a PDF with PyPDFLoader, splitting into page documents, inspecting content and metadata, and preparing pages for embeddings and RAG pipelines. - [Loading Webpages](https://notes.kodekloud.com/docs/LangChain/Performing-Retrieval/Loading-Webpages/page.md): Guide to loading webpages into LangChain, inspecting Documents, chunking text for embeddings and indexing, using WebBaseLoader and RecursiveCharacterTextSplitter with a Verge article example - [Chunking Documents](https://notes.kodekloud.com/docs/LangChain/Performing-Retrieval/Chunking-Documents/page.md): Explains splitting PDFs into overlapping text chunks using LangChain for embedding and retrieval in RAG pipelines - [Generating Embeddings](https://notes.kodekloud.com/docs/LangChain/Performing-Retrieval/Generating-Embeddings/page.md): Explains how to create text embeddings, convert documents to numeric vectors, and use them for semantic search and retrieval augmented generation workflows. - [Performing Semantic Search](https://notes.kodekloud.com/docs/LangChain/Performing-Retrieval/Performing-Semantic-Search/page.md): Guide to creating embeddings with OpenAI, storing them in Chroma, and performing semantic similarity search using LangChain for retrieval augmented applications - [RAG with PDFs](https://notes.kodekloud.com/docs/LangChain/Performing-Retrieval/RAG-with-PDFs/page.md): Step-by-step guide to building a PDF-based RAG pipeline with LangChain, covering PDF loading, chunking, embeddings, Chroma indexing, retrieval, prompt composition, and LCEL chain for document-grounded QA. - [RAG with Webpages](https://notes.kodekloud.com/docs/LangChain/Performing-Retrieval/RAG-with-Webpages/page.md): Explains RAG pipeline using webpages instead of PDFs, swapping only the document loader while keeping embeddings and retrieval unchanged. ### Implementing Chains - [Overview of Chains](https://notes.kodekloud.com/docs/LangChain/Implementing-Chains/Overview-of-Chains/page.md): Explains LangChain chain patterns, comparing 'stuff' and retrieval RAG workflows for combining documents, summarization, and choosing combine strategies like map_reduce and refine. - [Using Document Chain](https://notes.kodekloud.com/docs/LangChain/Implementing-Chains/Using-Document-Chain/page.md): Tutorial showing how to use LangChain to load two TechCrunch articles, concatenate their text into a single prompt, and synthesize information with a stuff documents chain. - [Using Retrieval Chain](https://notes.kodekloud.com/docs/LangChain/Implementing-Chains/Using-Retrieval-Chain/page.md): Guide to building a retrieval augmented generation pipeline using embeddings, FAISS vector store, and an LLM constrained to retrieved document context for accurate question answering ### Using Tools - [Understanding and Using tools](https://notes.kodekloud.com/docs/LangChain/Using-Tools/Understanding-and-Using-tools/page.md): Describes LangChain tools, their difference from RAG, and how to use external APIs and runtimes for live data, computation, and agent workflows. - [Using Wikipedia Tool](https://notes.kodekloud.com/docs/LangChain/Using-Tools/Using-Wikipedia-Tool/page.md): Guide to using LangChain's Wikipedia integration, showing configuration, API wrapper and tool usage, parameters, examples, and recommendations for retrieval augmented generation workflows. - [Using Tavily Search Tool](https://notes.kodekloud.com/docs/LangChain/Using-Tools/Using-Tavily-Search-Tool/page.md): Guide to using the Tavily Search API with LangChain to fetch, aggregate, and cite web search results for retrieval augmented generation while securely managing API keys - [Using Yahoo Finance News Tool](https://notes.kodekloud.com/docs/LangChain/Using-Tools/Using-Yahoo-Finance-News-Tool/page.md): Explains a lightweight Yahoo Finance News Tool that scrapes and returns recent headlines and short summaries for a given stock ticker, with usage, features, and best practices. - [Building a Custom Tool](https://notes.kodekloud.com/docs/LangChain/Using-Tools/Building-a-Custom-Tool/page.md): Explains building a LangChain custom tool that returns flight status, inspects tool metadata, and integrates the tool output into a prompt, LLM, and output parser chain ### Building Agents - [What are Agents](https://notes.kodekloud.com/docs/LangChain/Building-Agents/What-are-Agents/page.md): Explains how LangChain agents combine LLMs, memory, tools, and RAG to orchestrate multi-step reliable workflows that mitigate LLM limitations like hallucinations and lack of internet - [Building an Agent with Search Tool](https://notes.kodekloud.com/docs/LangChain/Building-Agents/Building-an-Agent-with-Search-Tool/page.md): Guide to building a session-aware agent that combines a ChatOpenAI LLM with a Tavily search tool, using message history and an agent scratchpad for multi-step queries. - [Adding Python REPL to Tool](https://notes.kodekloud.com/docs/LangChain/Building-Agents/Adding-Python-REPL-to-Tool/page.md): Guide for integrating a Python REPL into a LangChain agent to combine web search (Tavily) with exact programmatic computations for reliable multi-step answers - [Building a Real time Flight Agent](https://notes.kodekloud.com/docs/LangChain/Building-Agents/Building-a-Real-time-Flight-Agent/page.md): Guide to building a LangChain ReAct agent that fetches real time flight status via FlightAware AeroAPI and performs datetime calculations ### Conclusion - [Conclusion](https://notes.kodekloud.com/docs/LangChain/Conclusion/Conclusion/page.md): Course conclusion summarizing LangChain fundamentals, key components, practical takeaways, and recommended next steps for prototyping, iterating, and hardening generative AI applications. ### Building Blocks of LLM Apps - [Building Blocks of an LLM Application](https://notes.kodekloud.com/docs/LangChain/Building-Blocks-of-LLM-Apps/Building-Blocks-of-an-LLM-Application/page.md): Overview of core components and interactions of LLM applications including UI, prompts, models, contextual retrieval, responses, and conversation history for building production-grade generative AI systems - [Prompts and LLM](https://notes.kodekloud.com/docs/LangChain/Building-Blocks-of-LLM-Apps/Prompts-and-LLM/page.md): Guide to prompt engineering and how prompts interact with large language models, covering design elements, best practices, limitations, and evaluation. - [LLM Context](https://notes.kodekloud.com/docs/LangChain/Building-Blocks-of-LLM-Apps/LLM-Context/page.md): How to supply programmatic external context and use retrieval augmented generation to reduce LLM hallucinations via ingestion, embeddings, vector stores, chunking, and prompt construction - [LLM Response](https://notes.kodekloud.com/docs/LangChain/Building-Blocks-of-LLM-Apps/LLM-Response/page.md): Guidance on requesting, parsing, validating, and normalizing LLM outputs with examples for date handling, schema enforcement, and security to ensure reliable and safe consumption - [History](https://notes.kodekloud.com/docs/LangChain/Building-Blocks-of-LLM-Apps/History/page.md): Explains importance and practices for recording, storing, summarizing, and retrieving conversation history to maintain context, enable auditing, and scale LLM applications.