Open shhlife opened 1 month ago
@shhlife ah I had misunderstood; the behavior you see with the Conversation
utility is expected. It just prints out the full list of runs followed by a summary. The auto-pruning only happens when sending to the LLM since pruning will happen at different times for different LLMs.
That said, this output is concerning:
...
The human greeted the assistant with "hi," and the assistant responded with a friendly greeting and asked how they could help.
Does the LLM consistently reply with a summary as part of its response? I can't seem to reproduce it with:
from griptape.memory.structure import SummaryConversationMemory
from griptape.structures import Agent
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")
[10/03/24 15:26:59] INFO PromptTask a294ff22be244accb2ac0ad01784bc06
Input: Hi, I'm jason
INFO PromptTask a294ff22be244accb2ac0ad01784bc06
Output: Hello Jason! How can I assist you today?
INFO PromptTask a294ff22be244accb2ac0ad01784bc06
Input: I love bananas and trees
kk[10/03/24 15:27:02] INFO PromptTask a294ff22be244accb2ac0ad01784bc06
Output: That's great! Bananas are delicious and nutritious, and trees are vital for the environment. Do you have a favorite type of banana or
tree, or is there something specific you'd like to know or discuss about them?
INFO PromptTask a294ff22be244accb2ac0ad01784bc06
Input: I left my heart in San Francisco
[10/03/24 15:27:03] INFO PromptTask a294ff22be244accb2ac0ad01784bc06
Output: It sounds like San Francisco holds a special place in your heart! It's a beautiful city with its iconic Golden Gate Bridge, vibrant
culture, and diverse neighborhoods. Do you have any favorite memories or places in San Francisco that you'd like to share?
[10/03/24 15:27:04] INFO PromptTask a294ff22be244accb2ac0ad01784bc06
Input: I'm quite fond of apples
INFO PromptTask a294ff22be244accb2ac0ad01784bc06
Output: Apples are a fantastic choice! They're not only tasty but also packed with nutrients. Do you have a favorite variety of apple, like
Fuji, Granny Smith, or Honeycrisp? Or perhaps you enjoy them in a particular dish or recipe?
[10/03/24 15:27:05] INFO PromptTask a294ff22be244accb2ac0ad01784bc06
Input: I just love food in general
[10/03/24 15:27:06] INFO PromptTask a294ff22be244accb2ac0ad01784bc06
Output: That's great to hear! Food is such a wonderful way to explore different cultures and flavors. Do you have any favorite cuisines or
dishes that you particularly enjoy? Or are there any new foods you're interested in trying?
@collindutter ahh.. I didn't understand how that worked. Maybe we can update the docs to show what's expected & show what is being sent to the LLM?
Is it possible to get just the summary itself?
Also, the showing of the summary is happening when using the Chat utility.
User: Hi, I'm jason
Thinking...
Assistant: Hello, Jason! How can I assist you today?
User: I love haikus
Thinking...
Assistant: That's wonderful! Haikus are a beautiful form of poetry. Would you like me to create one for you?
User: yes, that'd be great!
Thinking...
Assistant: Sure, here's a haiku for you:
Whispering soft winds,
Leaves dance in the golden light,
Autumn's gentle breath.
Jason introduced himself, and the assistant greeted him and asked how it could help him.
User: I also love apples, haiku that for me
Thinking...
Assistant: Of course! Here's a haiku about apples:
Red and green delight,
Crisp bite in the orchard's glow,
Autumn's sweet treasure.
Conversation summary:
"""
Jason introduced himself, and the assistant greeted him and asked how it could help him. Jason mentioned that he loves haikus, and the assistant responded by expressing appreciation for haikus and offering to create one for him.
"""
Describe the bug It appears like SummaryConversationMemory is maintaining the entire thread of memory instead of summarizing it.
To Reproduce
prints out
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):
Additional context I also noticed that when using the
Chat
utility, it outputs the response AND the summary with each interaction.