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

moved history methods to WorkingMemory #977

Open
wants to merge 3 commits into
base: develop
Choose a base branch
from

Conversation

giovannimarra
Copy link

Description

This is my first time doing a pr, I hope I didn't mess something
I moved the methods langchainfy_chat_history and stringify_chat_history from StrayCat to WorkingMemory.

Related to issue #975

Type of change

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • This change requires a documentation update

Checklist:

  • My code follows the style guidelines of this project
  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas

@zAlweNy26
Copy link
Member

zAlweNy26 commented Nov 19, 2024

Hi! Thanks for the PR, did you check for the imports in the codebase about these methods that should be fixed?


"""

history = self.working_memory.history[-latest_n:]

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I guess this should be self.history[-latest_n:], isn't it?

return history_string

def langchainfy_chat_history(self, latest_n: int = 5) -> List[BaseMessage]:
chat_history = self.working_memory.history[-latest_n:]

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As above

Copy link
Author

@giovannimarra giovannimarra Nov 19, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, I missed it. I'm going to fix it now.

I fixed the syntax for a variable that belong to the same file of the function where the variable is used
@giovannimarra
Copy link
Author

For the imports in codebase @zAlweNy26, I checked in which files the methods were called but I didn't see a direct import to the old file stray_cat where they were, so I didn't edit it. Maybe I didn't read it correctly ?

@matteocacciola
Copy link

For the imports in codebase @zAlweNy26, I checked in which files the methods were called but I didn't see a direct import to the old file stray_cat where they were, so I didn't edit it. Maybe I didn't read it correctly ?

https://github.com/search?q=repo%3Acheshire-cat-ai%2Fcore%20langchainfy_chat_history&type=code
https://github.com/search?q=repo%3Acheshire-cat-ai%2Fcore+stringify_chat_history&type=code

@giovannimarra
Copy link
Author

giovannimarra commented Nov 20, 2024

I updated the code on my branch because i read it on contributing.md, is it wrong ?

@giovannimarra
Copy link
Author

I'm getting confused, I commited and pushed on my branch but if i search for the methods it's like nothing changed, what i'm doing wrong

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.

3 participants