from collections import deque class MemoryBuffer: def __init__(self, capacity=10): self.buffer = deque(maxlen=capacity) def add_interaction(self, user_input, bot_response): self.buffer.append((user_input, bot_response)) def get_data(self): return list(self.buffer)