-
Notifications
You must be signed in to change notification settings - Fork 15.4k
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
Harrison/memory refactor #1478
Harrison/memory refactor #1478
Conversation
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.
a couple of comments
langchain/schema.py
Outdated
@@ -133,3 +133,33 @@ def get_num_tokens(self, text: str) -> int: | |||
|
|||
# calculate the number of tokens in the tokenized text | |||
return len(tokenized_text) | |||
|
|||
|
|||
class Memory(BaseModel, ABC): |
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.
While we're at it, might as well rename Memory
to BaseMemory
and add an alias for bw-compat
langchain/memory/chat_memory.py
Outdated
self.messages = [] | ||
|
||
|
||
class ChatMemoryMixin(Memory): |
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 isn't really a mixin -- it's a base class. Rename to BaseChatMemory
? and inherit ABC
moves memory to own module, factors out common stuff
moves memory to own module, factors out common stuff