You've found the most advanced, most complete, and most intensive masterclass online for learning how to integrate LangChain and ChatGPT into production-ready applications.
Thousands of engineers have learned how to build amazing applications using ChatGPT, and you can too. This course uses a time-tested, battle-proven method to make sure you understand exactly how ChatGPT works, and is the perfect pathway to help you get a new job as a software engineer working on AI-enabled apps.
You've found the most advanced, most complete, and most intensive masterclass online for learning how to integrate LangChain and ChatGPT into production-ready applications.
Thousands of engineers have learned how to build amazing applications using ChatGPT, and you can too. This course uses a time-tested, battle-proven method to make sure you understand exactly how ChatGPT works, and is the perfect pathway to help you get a new job as a software engineer working on AI-enabled apps.
The difference between this course and all the others: you will go far beyond the basics of simple ChatGPT prompts, and understand how companies are integrating text generation into their apps today.
ChatGPT is being used across industries to enhance applications with text generation. But with this new feature comes many challenges:
Building complex text generation pipelines that incorporate outside information
Creating reusable configuration components that can be reassembled in different ways
Applying user feedback (like upvotes/downvotes) to enhance ChatGPT's output
Wiring in observability and tracing to see how users are interacting with your AI
Generate text performantly using distributed processing
This course will walk you through production-ready, repeatable techniques for addressing each of these challenges and many more.
What will you build?
This course focuses on creating a series of different projects of increasing complexity. You'll start from the very basics, understanding how to access ChatGPT 4 programatically. From there, we will quickly increase in complexity, building more complex projects with many more features. By the end, you will make a fully-featured web app that implements a "Chat-with-a-PDF" feature. Note: no previous web development experience is required.
Here's a partial list of some of the topics you'll cover:
Understand how complex text-generation pipelines work
Write reusable code using chains provided by LangChain
Connect chains together in different ways to dramatically change your apps behavior with ease
Store, retrieve, and summarize chat messages using conversational memory
Implement semantic search for Retrieval-Augmented Generation using embeddings
Generate and store embeddings in vector databases like ChromaDB and Pinecone
Use retrievers to refine, reduce, and rank context documents, teaching ChatGPT new information
Create agents to automatically accomplish tasks for you using goals you define
Write tools and plugins to allow ChatGPT to access the outside world
Maintain a consistent focus on performance through distributed processing using Celery and Redis
Extend LangChain to implement server-to-browser text streaming
Improve ChatGPT's output quality through user-generated feedback mechanisms
Get visibility into how users interact with your text generation features by using tracing
There are a ton of courses that show how to use ChatGPT at a very basic level. This is one of the very few courses online that goes far beyond the basics to teach you advanced techniques that top companies are using today. I have a passion for teaching topics the right way - the way that you'll actually use technology in the real world. Sign up today and join me.
Explore foundational concepts of LangChain and ChatGPT while working on a series of hands-on projects. Assistance is available via the course's Udemy discussion boards, an official Discord server, and checkpoint zip files for project code throughout the course.
Explore the capabilities of LangChain through an analysis of PDF AI, a web application that integrates chat GPT to answer questions about PDF document contents. Understand the behind-the-scenes workings of PDF AI, including text extraction and interaction with chat GPT, to gain insight into LangChain's usefulness in text generation applications.
Delve into the architecture and algorithms behind a LangChain-enhanced application that intelligently handles user questions based on PDF content. Explore the process of text extraction, summarization, and embedding creation, which distills text into numerical arrays for efficient database storage and retrieval. Learn how embeddings are utilized to pinpoint relevant content that, alongside a user query, is fed into ChatGPT for accurate, cost-effective responses.
Explore the power of LangChain for automating the development of text-based applications. Learn to effortlessly manage complex tasks such as parsing PDFs with tools like the unstructured PDF loader and understand how LangChain simplifies interactions with various databases, including Pinecone and Redis, to handle embeddings in AI applications.
Harness the power of LangChain to generate text using OpenAI's API. Learn to securely manage sensitive API keys and explore a basic approach to text generation with LLMs. Understand the simplicity behind this method and prepare to identify its downsides before advancing to more sophisticated and commonly used techniques in the field.
Explore the concepts within LangChain that facilitate the construction of text generation programs. Understand the importance of being able to switch out language models like OpenAI, ChatGPT, or others with ease and connecting multiple text generation tools efficiently. Focus on the introduction and implementation of 'chains' in LangChain, which are foundational for creating reusable and extendable text processing pipelines.
Refactor code to utilize LangChain, transforming simple model access into a more robust LLM chain. Learn to craft a prompt template and integrate it with the language model to create dynamic and precise prompts, culminating in a structured result output that specifically includes the desired generated text.
Enhance program flexibility by incorporating command line argument parsing in Python. Learn to use the argparse library to receive task and language parameters dynamically, ensuring versatility in code execution with both defaults and custom arguments when running the LangChain application.
Explore secure API key management strategies to protect services like OpenAI from unauthorized usage. Learn how to safely store and reference keys using environment variables and the .env file, leveraging the python-dotenv package to load API keys confidentially, keeping them out of version control and away from public exposure.
Explore the process of connecting multiple LangChain sequences by building a second chain that takes the output of the first, generating code, and uses it to create a test in an integrated workflow. This session focuses on demonstrating how to create cohesive output keys for clearer communication between the chained components.
Learn to construct a second chain in LangChain, starting with creating a new prompt template that requires inputs of language and code. Discover the step-by-step process of building the template, developing the chain, and renaming the output key for clarity. Then, explore the concept of sequential actions and how to wire multiple chains together to form a comprehensive processing pipeline that yields both generated code and associated tests.
Dive into creating a classic terminal-based chatbot that interacts with users in real-time. Learn to handle text submission, communicate with a chat model, and process responses. Challenges will be faced, requiring a deeper understanding of chains. The setup includes transferring environment configurations to a new project directory, T chat, and preparing for coding.
Explore setting up a basic user input loop in Python to handle text inputs, where typing and pressing 'enter' triggers a response. Learn to prompt for input and print a confirmation of the entry, establishing foundational interactions essential for developing a ChatGPT application. Future steps will involve integrating LangChain for creating a functional chatbot.
Explore the intricacies of working with both completion and conversation style models, with an emphasis on understanding the technical differences and how they impact using LangChain. Delve into practical exercises that demonstrate managing conversations with ChatGPT, including how to maintain message histories for ongoing dialogue and leverage system messages to influence chatbot behavior.
Explore the transition from theory to practical application by learning how to work with chat-based models using LangChain. Delve into the nuances of system, human, and AI messaging within LangChain classes, and understand the creation and use of chat-prompt templates. Examine how LangChain replaces input variables to construct prompt values sent to ChatGPT, as demonstrated with a hands-on example in Python.
Explore the process of setting up a chat chain with a Chat OpenAI model using the LangChain library. Learn how to create a language model interface and a chain, and understand the importance of feeding the full conversation history to ChatGPT for coherent follow-up responses. Discover the distinction LangChain makes between LLMs and chat models in the implementation process.
Explore the usage of the 'memory' feature provided by LangChain to store and utilize data within a chain across multiple sessions. Learn how to implement 'conversation buffer memory' to remember and include past interactions in subsequent messages, enhancing the conversational context with ChatGPT. Discover how this tool maintains a list of messages and integrates with input variables to improve response accuracy.
Explore the integration of conversation history into ChatGPT prompts using LangChain's conversation buffer memory. Learn to properly set up memory handling and how to use messages placeholders to include past interactions, ensuring that ChatGPT generates contextual and consistent responses in a chatbot application. Understand these critical concepts to build advanced chatbot solutions with LangChain.
Explore the enhancement of the chatbot's functionality by adding persistent conversation history through LangChain's FileChatMessageHistory. Discover how to save chat exchanges in messages.json and retrieve them, thus continuing user conversations across sessions, and learn about the potential of storing data in various databases for scalable user interaction.
Explore the capabilities of conversation summary memory in LangChain to manage long-running conversations efficiently. Discover how conversation summary memory generates succinct summaries to replace the traditional conversation buffer, optimizing both cost and performance while circumventing the limitations of lengthy chat histories.
This course module covers creating a program that searches a text file containing trivia facts to answer user questions. The focus will be understanding how to load content from a file and effectively search it to find the most relevant fact to respond to queries with the potential for future expansion to more complex data sources.
Begin the project setup by creating a new 'fax' directory and preparing the environment. Replicate the .env file from the previous T-chat program, add the 'fax.text' file obtained earlier, and establish a main.py with initial code. Explore handling text files and external data with LangChain.
Explore the functionality of LangChain for loading data from various file types. Delve into the nuances of utilizing specialized loader classes for handling specific file formats like text, PDF, and JSON, and uncover the system for managing documents within LangChain, including the extraction of page content and metadata.
Explore advanced techniques to refine prompts for a language model in text-based projects, focusing on identifying the most pertinent facts from a given text file. Learn about the trade-offs between prompt length and processing cost, as well as the challenges of sifting through text to find relevant content without overloading the language model.
Explore the concept of semantic search and how it enhances the ability to comprehend and interpret user queries beyond mere keyword matching, utilizing the power of embeddings. Delve into the nuances of constructing embeddings to rate sentence attributes on a numeric scale and learn about measuring text similarity through techniques such as squared L2 distance and cosine similarity to improve search relevance.
Delve into the practical application of text embeddings, learning the process from pre-processing a facts text file to calculating embeddings and storing them in a vector store. Explore the advantages and considerations of different vector stores, and understand how to retrieve and utilize the most relevant embeddings in response to user queries for integration with a language model.
Learn to preprocess text documents with the LangChain library by using the CharacterTextSplitter class to break down text into manageable chunks. Explore configuring options like separator, chunk size, and chunk overlap to ensure optimal text segmentation for further processing, like embedding calculations.
Explore different methods for calculating text embeddings, focusing on sentence transformer models and OpenAI embeddings. Learn that dimensions indicate the qualities encoded in embeddings, with OpenAI yielding 1536-dimension embeddings and sentence transformers typically 768. Consider the trade-offs between free, locally-run algorithms and paid, more feature-rich embeddings from OpenAI. Demonstrate embedding generation using LangChain with OpenAI embeddings.
Explore the process of calculating text embeddings, storing them in a vector store using ChromaDB, and performing similarity searches in LangChain. Learn how to set up ChromaDB to integrate with LangChain for seamless storage and retrieval of embeddings, leveraging SQLite for persistence. Understand crucial considerations for utilizing this approach, like cost implications of computing embeddings and handling potential data duplication.
Explore handling duplicate embeddings in Pinecone vector storage with a practical solution that separates program functionality into two files. Learn to avoid duplicates in vector stores, implement a retrieval QA chain using LangChain, and create efficient question-answering programs that leverage context from a vector database for accurate and unique responses.
Explore the concept of a Retriever in LangChain, an object crucial for integrating diverse technologies through a method named `get_relevant_documents`. Additionally, delve into the 'chain type' configuration, beginning with 'stuff,' which articulates the process of integrating text context into a system message prompt template, with more complex chain types to be discussed.
Explore advanced LangChain chain types like map reduce, map re-rank, and refine in-depth. Understand their functions, see how they call ChatGPT multiple times for complex operations, and learn the underlying mechanics through examples and debugging. Discover why the default 'stuff' chain type might often be preferred for efficiency and cost.
Explore the technique to prevent duplicated records in embeddings using LangChain's Embeddings Redundant Filter within a custom retriever class. Learn to enhance query relevance by filtering out repetitive documents from the vector store and ensure a diverse source of information without recalculating embeddings unnecessarily.
Learn to build a custom retriever using Chroma to identify and eliminate duplicate documents effectively. Explore the step-by-step creation process, from extending the base retriever class to defining synchronous and asynchronous methods for document retrieval. Grasp advanced concepts like manual embedding computation, similarity search, and utilizing the max marginal relevance search function for refined results.
Explore the integration of a custom Redundant Filter Retriever into a LangChain-based program. Learn to import and invoke the Redundant Filter Retriever in prompt.py, replacing the standard Chroma instance. Customize embedding generation and instance setup to eliminate duplicate records. Debug outputs to verify distinct and relevant document retrieval, contrasting with the unfiltered results for optimized information sourcing.
Explore the provided Jupyter notebook to gain hands-on experience with text embeddings and their comparisons. Delve into the scoring of textual qualities, learn about L2 distance metrics for sentence similarity, and visualize the nuances of embeddings using custom text inputs. This notebook offers a practical tool to understand and contrast textual embeddings through examples and plots.
Explore integrating ChatGPT with an e-commerce database to answer complex queries without direct SQL knowledge. Learn how to enhance ChatGPT with prompts that generate SQL queries, retrieve data, and provide meaningful responses to business-critical questions. Begin setting up a project to implement these concepts using LangChain.
Learn to enhance ChatGPT's contextual understanding using tools and JSON formatting for queries. Discover how to instruct ChatGPT to request additional data from an application, and how to parse and execute these requests using SQLite for accurate responses to user inquiries. Understand the flow from the user's question to providing ChatGPT with instructions and receiving actionable data in return.
Explore the use of instructions in prompts to enhance the capabilities of language models like ChatGPT, enabling them to utilize tools for additional information. Uncover the transition from embedding complex direction within prompts to leveraging ChatGPT functions for a more programmer-friendly approach. This method streamlines interaction by structuring requests with named functions, detailed descriptions, and defined parameters, allowing ChatGPT to execute tasks like running SQL queries more efficiently.
Explore how LangChain facilitates the integration of ChatGPT with a SQLite database, enabling ChatGPT to access and use data from an e-commerce application. Learn about configuring and creating function objects, or 'tools', with LangChain's 'tool' class to execute SQL queries based on a user's prompt and return results for ChatGPT's response generation.
Explore the process of extending a ChatGPT tool by coding additional elements in the main.py file, such as prompt templates and chains using LangChain. The session covers integrating these components to function with chat models, including key imports, creating prompt templates, and setting up an agent executor to interact with an SQLite database. This setup aims to query and verify the number of users in the given database.
Dive into the function and structure of LangChain by understanding agents, agent executors, and the agent scratch pad and their roles in handling chat function calls. Learn how agents accept and utilize tools, converting them into JSON function descriptions, identical to chains but with an added functionality. Decode how the agent executor effectively acts as a loop, handling responses until no function call is requested by ChatGPT, despite its complex-sounding name. Explore the simplified memory system, agent scratch pad, used to track ongoing conversations with ChatGPT, retaining intermediate messages and calls. Uncover strategies for making agents more robust for complex tasks involving databases.
Learn to diagnose and resolve issues when ChatGPT generates incorrect SQL queries due to assumptions about database structure. Discover the importance of aligning ChatGPT's understanding with the actual schema, emphasizing the need to educate the AI on existing tables and columns to prevent errors like 'no such column'.
Discover strategies to enhance the resilience of a chatbot by adding error handling, a crucial step in fostering ChatGPT's understanding of a database's structure. Learn how to implement error captures in SQL queries, allowing ChatGPT to refine its responses and improve interaction with the database, though this is just the first of multiple necessary techniques.
Enhance ChatGPT's robustness in querying databases by introducing two techniques: a system message informing ChatGPT of accessible SQLite database tables, and a "describe tables" tool to clarify table column details. This minimizes initial input while allowing ChatGPT to request specific schema information as needed, optimizing interaction with the database.
Learn to integrate the 'describe tables' tool into LangChain by editing the SQL.py file. This tool extracts table columns using a SQL query, formats the data, and communicates results to ChatGPT. Discover how to define a function, handle string formatting in SQL queries, and add the new tool to the main agent, while addressing potential usage by ChatGPT.
Discover how to refine system messages to ensure ChatGPT effectively utilizes provided tools, such as the 'Describe Tables' function, in LangChain executions. Learn how explicitly instructing ChatGPT to not make assumptions about database schemas can lead to improved query results and tailored tool usage.
Learn to optimize a LangChain implementation to aid ChatGPT's interaction with provided functions by customizing argument names. Explore modifying LangChain's default argument naming to include descriptive identifiers instead of generic placeholders, and implement Pydantic to convey data types and enhance ChatGPT's comprehension of function parameters.
Explore building a custom 'right HTML report' tool using LangChain to allow users to query a database, receive data, and output it as an HTML file for sharing or future reference. Learn how to handle multiple arguments with Structured Tool and integrate the new functionality into the existing application.
Explore how memory and message history within LangChain's agent executor is managed to preserve context between prompts. Learn about the implementation of intermediate steps and their limitations, and delve into strategies for enhancing ChatGPT's memory recall in sequential task processing to overcome loss of context in multi-step operations.
Enhance your LangChain-powered agents by integrating the conversation buffer memory for message retention. Discover how to incorporate memory into the agent executor, ensuring ChatGPT accurately maintains a history of message objects. Learn the proper setup of memory keys, the significance of `return_messages`, and the placement of message placeholders in prompts.
Enhance the debugging experience in LangChain by using custom handler classes to surface internal program events. Learn to define specific function names within these classes to track actions such as message flow to ChatGPT, enabling improved inspection and logging capabilities for various objects such as chat models, tools, and agents.
Explore the creation of a custom handler class in LangChain to handle specific events such as 'on chat model start'. Delve into defining callback functions, learn how to interpret arguments like serialized messages, and understand the structure of messaging for batching in ChatGPT. Discover how to incorporate the handler into the main LangChain application and manage callback systems effectively.
Enhance the handling of messages in LangChain applications with a practical demonstration of installing and using the 'pyboxin’ package to organize output. Learn to distinguish between system, human, AI, and function call messages, and display them in easily identifiable colored boxes, improving clarity and debugging capability within the chat model.
Embark on creating a web-based PDF chat application, consolidating skills in text extraction, embeddings, and vector databases to enable similarity searches and language model integration. This comprehensive project focuses on integrating text generation technologies within a web app environment, addressing nuanced challenges beyond basic text outputs. Enjoy streamlined web development with provided boilerplate code, allowing a concentrated effort on leveraging LangChain for sophisticated text interaction.
Explore the design and functionality of a web application with full authentication, allowing users to upload, view, and interact with PDF documents through a chat interface. Delve into the complexities of a production-ready server-side implementation that facilitates document management and real-time conversation generation based on PDF content.
Begin by downloading and extracting the 'PDF.zip' file, which contains the starter code required for the project. Follow the initial setup instructions in the readme.md file, including creating a virtual environment, activating it, and installing dependencies. Then, learn to initialize the database and start the Python server for the app, with detailed guidance for running and stopping the server as needed. Cover the necessary steps to reach the authentication page and set up a user account, while noting that some functionalities like document upload and chat may not work just yet. Subsequent lessons will delve into the codebase and introduce other processes like the worker and Redis.
Explore the project's existing code base to understand its structure, focusing on the 'app/chat' and 'app/web' modules integral to LangChain development. Learn how the chat module will process PDFs, generate embeddings, and handle text generation. Discover essential environment variables and how the two modules interact through specific functions to enable future code reusability in personal projects.
Learn to implement the 'create embeddings for PDF' function within a ChatGPT and LangChain integrated web app. This vital component involves processing PDFs by extracting text, creating text chunks, and storing resultant embeddings in a vector store, laying the groundwork for the app's web-related functionality using built-in LangChain loaders and a vector store other than Chroma.
Explore the steps to implement a function in LangChain that extracts text from PDF documents using the piPDFloader and recursive character text splitter. Learn to create text chunks with overlap, load PDFs, and split text into manageable sizes, ensuring the foundation for vector store setup and metadata handling in subsequent lessons.
Explore the process of uploading a simple PDF document to a server and confirming its contents through terminal log statements. Learn to navigate the application hosted at localhost:8000, upload a PDF, and decipher how the system extracts text as document objects with page content and metadata, including temporary storage paths and source pages. The session sets the stage for introducing a vector store in subsequent steps.
Explore the setup of Pinecone, a cloud-hosted vector database, for storing document embeddings. Learn to create an account, set up an index with the correct dimensions for OpenAI's algorithm-generated vectors, generate an API key, and configure environment variables for integrating Pinecone with LangChain. Essential steps cover index and dimension specifications, which are crucial for error-free vector insertions.
Explore the process of integrating Pinecone with LangChain to simplify the management of various services in an application. Learn how to organize code effectively and instantiate a Pinecone client alongside an embeddings object, crucial for converting documents into embeddings for storage within an index. The setup will streamline interactions with language models and agents within the project.
Explore the integration of a vector store with a PDF embedding process using Pinecone. Learn to import the vector store and use it to create embeddings for documents, then handle the embeddings with Pinecone. Dive into troubleshooting an issue with PDF processing delays and investigate ways to optimize the embedding creation workflow.
Discover techniques for enhancing the upload user experience in a Pinecone vector database. Learn how to tackle delays in the embedding generation process from the OpenAI API and improve the perceived speed by analyzing YouTube's efficient upload and processing flow to apply a similar background job strategy in our application.
Explore the concept and architecture of background processing, a critical pattern in web application development for tasks like email dispatch, file conversion, and search indexing that require extensive processing time. Learn when and why to implement it, particularly in text generation applications, and the rare exceptions, such as real-time interactions, where immediate response is necessary. Discover the role of message brokers like Redis and how to scale the system with workers for efficient job distribution and processing.
Explore the integration of Celery with Redis for background worker pattern implementation to enhance job queuing in Python projects. Delve into the convenience Celery offers in managing tasks within a Python server and worker setup, and prepare for hands-on experience configuring Redis, an essential in-memory database for countless online applications.
Learn the setup process for a Redis Server and initializing a worker process to interact with a Python server. Installation details for various operating systems are provided, ensuring the correct Redis URI configuration. Introduction to Celery for task management, with encouragement to refer to official documentation for in-depth understanding.
Learn how to streamline the handling of PDF uploads by setting up a job queue. After an upload, instead of generating embeddings immediately, discover how to use a Celery worker to defer the task. The use of the shared task decorator and the .delay modifier is discussed to ensure efficient asynchronous processing and integration with Pinecone for vector insertion.
Explore the process of updating document metadata in a Pinecone index to ensure accurate retrieval of embeddings for specific PDFs during similarity searches. Learn how to replace non-meaningful path data with relevant metadata properties, including PDF ID, to maintain document-source integrity for effective retrieval QA chains.
OpenCourser helps millions of learners each year. People visit us to learn workspace skills, ace their exams, and nurture their curiosity.
Our extensive catalog contains over 50,000 courses and twice as many books. Browse by search, by topic, or even by career interests. We'll match you to the right resources quickly.
Find this site helpful? Tell a friend about us.
We're supported by our community of learners. When you purchase or subscribe to courses and programs or purchase books, we may earn a commission from our partners.
Your purchases help us maintain our catalog and keep our servers humming without ads.
Thank you for supporting OpenCourser.