Skip to content

Instantly share code, notes, and snippets.

@JudahSan
Created May 9, 2024 12:51
Show Gist options
  • Save JudahSan/c9e40e11d46a547bd82895eb336a40b3 to your computer and use it in GitHub Desktop.
Save JudahSan/c9e40e11d46a547bd82895eb336a40b3 to your computer and use it in GitHub Desktop.
LangChain

Memory Types

ConversationBufferMemory

  • This memory allows for storing of messages and then extracts the messages in a variable.

CoversationBufferWindowMemory

  • This memory keeps a list of the interactions of the conversation over time. It only uses the last K interactions

ConversationTokenBufferMemory

  • This memory keeps a buffer of recent interactions in memory, and uses token length rather than number of interactions to determine when to flush interactions.

ConversationSummaryMemory

  • This memory creates a summary of the coversation over time.

Additional Memory Types

  • Vector data memory
    • Stores text (from conversation or elsewhere) in a vector database and retrieves the most relevent blocks of text.
  • Entity memories
    • Using an LLM, it remembers details about specific entities
  • You can also use multiple memories at one time. Eg. conversation memory + entity memory to recall individuals
  • You can also store the conversation in a conventional database (such as key-value store or SQL)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment