-
Notifications
You must be signed in to change notification settings - Fork 175
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
Fix Conversation Memory Autoload #1033
Conversation
Codecov ReportAll modified and coverable lines are covered by tests ✅ 📢 Thoughts on this report? Let us know! |
def conversation_memory_driver(self) -> Optional[BaseConversationMemoryDriver]: | ||
if self._conversation_memory_driver is None: | ||
if hasattr(self, "structure"): | ||
return self.structure.config.conversation_memory_driver | ||
else: | ||
return None | ||
return self._conversation_memory_driver | ||
|
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.
should the strucuture just set the driver rather than setting the structure itself? also why the hasattr
? should it just default to None
?
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.
This pattern is easier to apply to other areas of the framework (tasks) if the Structure sets itself.
init=False
because we don't want users to set the Structure, it should only be done by the Structure itself.
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.
Love the bug fixes
Just one comment/question
if self.conversation_memory.autoload: | ||
self.conversation_memory.load() |
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.
Feels to me like this autoloading decision should be made from within the conversation memory class. Like either in the structure
setter, or in another method called maybe preprocess
(if we wanna be consistent with the way tasks are added to structures)
Also, won't load()
get called twice? (Once in the __attrs_post_init__
, when there is no structure, then once here after the structure is added) Is that ok?
Should be fixed by #1045 |
[x] I have read and agree to the contributing guidelines for submitting new pull requests.
Describe your changes
Refactors Conversation Memory to support using a Driver set in Structure Config. For instance:
Issue ticket number and link
NA
📚 Documentation preview 📚: https://griptape--1033.org.readthedocs.build//1033/