Elffuss BraidHub

kikocis/Based-Agent public

a87f47c62cfe · 849 BRawPermalink
1class Conversation:
2 def __init__(self):
3 self.history = [] # Stores all messages, tool calls, and outputs
4 self.current_messages = [] # Stores messages of the current interaction
5 self.summary = None
6
7 def add_tool_call(self, tool_call):
8 self.history.append(tool_call)
9
10 def add_output(self, output):
11 self.history.append(output)
12
13 def summarize(self):
14 # Implement summarization logic here
15 self.summary = "Summary of the conversation"
16
17 def get_summary(self):
18 if not self.summary:
19 self.summarize()
20 return self.summary
21
22 def clear_current_messages(self):
23 self.current_messages = []
24
25 def __repr__(self):
26 return f"Conversation(History: {len(self.history)}, Current Messages: {len(self.current_messages)}, Summary: {self.summary})"