langchain/docs/snippets/modules/memory
Shantanu Nair 53f3793504
Fast load conversationsummarymemory from existing summary (#7533)
- Description: Adds an optional buffer arg to the memory's
from_messages() method. If provided the existing memory will be loaded
instead of regenerating a summary from the loaded messages.
 
Why? If we have past messages to load from, it is likely we also have an
existing summary. This is particularly helpful in cases where the chat
is ephemeral and/or is backed by serverless where the chat history is
not stored but where the updated chat history is passed back and forth
between a backend/frontend.

Eg: Take a stateless qa backend implementation that loads messages on
every request and generates a response — without this addition, each
time the messages are loaded via from_messages, the summaries are
recomputed even though they may have just been computed during the
previous response. With this, the previously computed summary can be
passed in and avoid:
  1) spending extra $$$ on tokens, and 
2) increased response time by avoiding regenerating previously generated
summary.

Tag maintainer: @hwchase17
Twitter handle: https://twitter.com/ShantanuNair

---------

Co-authored-by: Harrison Chase <hw.chase.17@gmail.com>
2023-07-31 18:14:11 -07:00
..
chat_messages Harrison/update memory docs (#8384) 2023-07-27 17:18:19 -07:00
types Fast load conversationsummarymemory from existing summary (#7533) 2023-07-31 18:14:11 -07:00
get_started.mdx Harrison/update memory docs (#8384) 2023-07-27 17:18:19 -07:00