Skip to content
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

Merged
merged 14 commits into from
Mar 7, 2023
Merged

Harrison/memory refactor #1478

merged 14 commits into from
Mar 7, 2023

Conversation

hwchase17
Copy link
Contributor

moves memory to own module, factors out common stuff

Copy link
Collaborator

@agola11 agola11 left a 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

@@ -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):
Copy link
Collaborator

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

self.messages = []


class ChatMemoryMixin(Memory):
Copy link
Collaborator

@agola11 agola11 Mar 6, 2023

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

@hwchase17 hwchase17 merged commit 7bec461 into master Mar 7, 2023
@hwchase17 hwchase17 deleted the harrison/memory-refactor branch March 7, 2023 15:59
zachschillaci27 pushed a commit to zachschillaci27/langchain that referenced this pull request Mar 8, 2023
moves memory to own module, factors out common stuff
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants