-
Notifications
You must be signed in to change notification settings - Fork 14.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: Add a feature to serialize and deserialize memory types to and from JSON #14032
Conversation
…from JSON * feat: Add serilization for memory * nit: added dummy file for testing * added tests and bug with vectorstore * added unit tests for ConversationEntityMemory and ConversationTokenBufferMemory * fix test cases * feat: added from_json Co-authored-by: Aditya Kulkarni <Aditya-k-23@users.noreply.github.com> * small fix to ConversationEntityMemory unit test * fix: fix vectorStoreRetriever * turned string assert to json assert * Add Conversation Summary Buffer * Serialize Conversation Summary * small fixes to unit tests * feat: fix from_json() Co-authored-by: Aditya Kulkarni <Aditya-k-23@users.noreply.github.com> * feat: Added from_json for memories with llms Co-authored-by: Aditya Kulkarni <Aditya-k-23@users.noreply.github.com> * feat: fix test_cases * feat: fix test cases * linting: fix linting * docs: started work on docs * Add documentation - Remove `trial.py` - Add serialization.ipynb * Update Formatting --------- Co-authored-by: D3nam <rahl302000@gmail.com> Co-authored-by: Ava Oveisi <87161280+avaove@users.noreply.github.com> Co-authored-by: Aditya Kulkarni <Aditya-k-23@users.noreply.github.com>
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
Our changes add the serialization and deserialization to and from the following memory types:
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
thanks for opening this up. i dont think we want to do this quite yet. a few reasons:
- the memory abstractions may not be the best/most stable, so we want to rethink
- we generally make things serializable in both python and js at the same time
Curious to hear - why the desire to have them serializable?
We understand. We chose this issue as there were a lot of user requests for making storage of memory types available in a JSON format. We chose to couple it with deserialization because we thought it made sense to continue where users left off their work. We think this feature provides the capability to efficiently share, reuse, and manage memory objects across sessions and even with other users. To add a particular use case I would like to reference the issue #11275. Maybe @lameTookan can shed more light on what their use case was. |
@hwchase17 Curious to hear - why the desire to have them serializable? Currently building a system where each step in the conversation is produced by invoking a stateless API. So any conversation state must be passed in to the parameters used to invoke the API. @Aditya-k-23 Why do these memory types require an llm to deserialize?
For example, to my thinking the ConversationSummaryBufferMemory contains a list of Human and AI conversation steps, a current buffer size or token count, and maybe a summary of the conversation so far to capture the overflow from the buffer. A serialized representation could hold these 3 things, and the state could be completely recovered from them. What we want to avoid is having to make extra calls to the llm to re-create the summary from the conversation steps when deserializing, as this is potentially costly/time consuming. |
i am going to close this. this isnt something we want to make serializable yet |
Description: Add a feature to serialize and deserialize the memory types into JSON format,
Issue: #11275,
Dependencies: No new dependencies,
Tag maintainer: @baskaryan, @eyurtsev, @hwchase17
Co-Authors: @D3nam, @avaove, @malharpandya