Unlocking Memory for Language Models

This module teaches you how to add both short-term and long-term memory to language models, enabling AI systems to remember interactions and use them for smarter, more personalized conversations. You'll start with Langchain for session-based memory, then move on to MemGPT for retaining information across multiple sessions.

You'll also explore real-world applications, such as analyzing documents with MemGPT and OpenAI, and building a Yoda-inspired AI assistant with voice synthesis. By the end, you'll know how to create AI systems that maintain memory and provide more engaging, intelligent interactions.

Lesson 1

Implementing Short-Term Memory for LLMs Using Langchain

In this video, we'll show you how to give your LLM short-term memory using Langchain, allowing it to remember previous user interactions within the same session. By integrating a conversation buffer, we’ll make the model capable of holding context-aware, continuous conversations.

You'll learn how to:

  • Set up a Python script to communicate with OpenAI’s API.
  • Use Langchain’s conversation buffer memory to store chat history.
  • Retrieve conversation history using memory variables for continuous prompts.
  • Incorporate user and AI messages into a buffer for session-based memory.
  • Test your model to verify it remembers past interactions during a session.

By the end, you'll have a conversational AI that can hold a continuous conversation, providing a more intelligent and seamless interaction experience.

Full Video & Source Code
 

Lesson 2

Implementing Long-Term Memory in Chatbots with MemGPT

In this video, we'll show you how to implement long-term memory in language models using MemGPT. This allows your chatbot to store and recall information across multiple sessions, making interactions more personalized and smarter over time.

You'll learn how to:

  • Set up MemGPT and choose between free or custom API endpoints
  • Create human profiles to personalize interactions for each user
  • Add and manage personas for your chatbot, giving it different roles or personalities
  • Run MemGPT with specific personas and human profiles for personalized conversations
  • Use MemGPT’s memory to recall and adjust to past conversations, ensuring continuity

By the end, your chatbot will be able to remember users, take on specific roles, and provide more intelligent, long-term interactions.

Full Video & Source Code
 

Lesson 3

Using MemGPT to Analyze Documents

In this video, we'll guide you through configuring MemGPT with OpenAI and using it to analyze documents like employee contracts. You'll learn how to ask specific questions and extract detailed information with ease.

You'll learn how to:

  • Set up MemGPT with OpenAI API and select GPT-4 as the default model
  • Configure embeddings using OpenAI and store them in Chroma's vector store
  • Load and process employee contracts in MemGPT
  • Attach documents to MemGPT agents for efficient document querying
  • Ask specific questions and retrieve precise data from contracts

By the end, you'll be able to use MemGPT to query documents like contracts, extracting key details effortlessly.

Full Video & Source Code
 

Lesson 4

Building a Yoda-Inspired AI Assistant with MemGPT and Eleven Labs

In this video, we'll show you how to build an AI assistant that speaks like Yoda. By combining MemGPT for continuous memory and ElevenLabs for voice cloning, we create an intelligent agent that remembers past conversations and responds in Yoda's unique style. This assistant is capable of ongoing dialogues, delivering insights in a voice straight from the Star Wars universe.

You'll learn how to:

  • Set up MemGPT with OpenAI and Chroma for persistent data storage
  • Create a MemGPT server, user, and agent with a Yoda persona
  • Build a continuous dialogue system where the assistant remembers user inputs
  • Integrate Eleven Labs and Pygame to convert responses into audible Yoda speech
  • Develop an interactive AI that combines memory, language generation, and voice

By the end, you'll have built a fully functional Yoda-inspired assistant, capable of real-time conversations with voice output. 

Full Video & Source Code