griptape
griptape copied to clipboard
`SummaryConversationMemory` maintaining entire thread of memory, even with `offset` set
- [x] I have read and agree to the contributing guidelines.
Describe the bug It appears like SummaryConversationMemory is maintaining the entire thread of memory instead of summarizing it.
To Reproduce
from griptape.memory.structure import SummaryConversationMemory
from griptape.structures import Agent
from griptape.utils import Conversation
agent = Agent(
conversation_memory=SummaryConversationMemory(offset=2, autoprune=True), stream=True
)
agent.run("Hi, I'm jason")
agent.run("I love bananas and trees")
agent.run("I left my heart in San Francisco")
agent.run("I'm quite fond of apples")
agent.run("I just love food in general")
# Chat(agent).start()
print(Conversation(agent.conversation_memory))
prints out
Q: Hi, I'm jason
A: Hello, Jason! How can I assist you today?
Q: I love bananas and trees
A: That's great to hear, Jason! Bananas are delicious and nutritious, and trees are essential for the environment. Do you have a favorite type of tree or a particular way you like to enjoy bananas?
Q: I left my heart in San Francisco
A: That's a beautiful sentiment, Jason! San Francisco is a city that captures the hearts of many with its iconic landmarks, vibrant culture, and stunning scenery. Do you have any special memories or favorite places in San Francisco that you'd like to share?
Q: I'm quite fond of apples
A: It sounds like you have a love for fruits! Apples are another fantastic choice—crisp, sweet, and versatile. Do you have a favorite variety of apple, or perhaps a favorite way to enjoy them, like in a pie or as a snack?
Q: I just love food in general
A: That's wonderful! Food can be such a delightful and diverse experience. Do you have any favorite cuisines or dishes that you particularly enjoy? Whether it's something savory, sweet, or a specific type of cuisine, I'd love to hear more about your food preferences!
Summary: Jason introduces himself, and the assistant responds by greeting him and asking how it can help. Jason mentions that he loves bananas and trees. The assistant responds by expressing enthusiasm about bananas and trees, noting their benefits, and asking Jason if he has a favorite type of tree or a particular way he likes to enjoy bananas. Jason then shares that he left his heart in San Francisco. The assistant responds by acknowledging the sentiment and asking if Jason has any special memories or favorite places in San Francisco that he'd like to share.
Expected behavior I would expect it to just have the last 2 Q/A entries, and the summary.
Screenshots If applicable, add screenshots to help explain your problem.
Desktop (please complete the following information):
- OS: [e.g. iOS]
- Version [e.g. 0.5.1]
Additional context
I also noticed that when using the Chat
utility, it outputs the response AND the summary with each interaction.