Back to Browse

Conversation Buffer Window Memory (4.2)

387 views
Sep 5, 2025
6:45

This video explores Conversation Buffer Memory in LangChain, expanding on the basics of building LLM-powered chat systems. The lesson introduces the SimpleConversation class, a lightweight wrapper that manages conversation state with OpenAI models. By combining a ChatPromptTemplate, an in-memory history store, and LangChain’s RunnableWithMessageHistory, this class allows users to hold multi-turn conversations where the AI recalls previous inputs. Students will learn how to start a conversation, inspect or print the chat history, and reset sessions. The notebook also demonstrates how Markdown output makes responses clearer, especially when returning formatted tables or code . Beyond basic memory handling, the tutorial highlights how system prompts can constrain discussions to specific domains—for example, making the bot answer only Washington University questions. It also shows how to examine the stored memory directly, giving insight into how LangChain tracks interactions. This provides a strong foundation for building more advanced conversational applications with features like persistence, rollback, and regeneration, which are introduced later in the module Code for This Video: https://github.com/jeffheaton/app_generative_ai/blob/main/t81_559_class_04_2_memory_buffer.ipynb ~~~~~~~~~~~~~~~ COURSE MATERIAL ~~~~~~~~~~~~~~~ 📖 Textbook - Coming soon 😸🐙 GitHub - https://github.com/jeffheaton/app_generative_ai ▶️ Play List - https://www.youtube.com/watch?v=FBmUxUt__rM&list=PLjy4p-07OYzui0nVZzMgoLBeXjG9Oy3hi&ab_channel=JeffHeaton ~~~~~~~~~~~~~~~ CONNECT ~~~~~~~~~~~~~~~ 🖥️ Website: https://www.heatonresearch.com/ 🐦 Twitter - https://twitter.com/jeffheaton 😸🐙 GitHub - https://github.com/jeffheaton 📸 Instagram - https://www.instagram.com/jeffheatondotcom/ 🦾 Discord: https://discord.gg/3bjthYv ▶️ Subscribe: https://www.youtube.com/c/heatonresearch?sub_confirmation=1 ~~~~~~~~~~~~~~ SUPPORT ME 🙏~~~~~~~~~~~~~~ 🅿 Patreon - https://www.patreon.com/jeffheaton 🙏 Other Ways to Support (some free) - https://www.heatonresearch.com/support.html ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ #LangChain #GenerativeAI #LLM #AIChat #Chatbots #PythonAI #OpenAI #JeffHeaton #ConversationMemory #MachineLearning

Download

0 formats

No download links available.

Conversation Buffer Window Memory (4.2) | NatokHD