Yousefsalem commited on
Commit
3ee48bb
·
verified ·
1 Parent(s): 8a61428

Update src/memory.py

Browse files
Files changed (1) hide show
  1. src/memory.py +1 -9
src/memory.py CHANGED
@@ -7,7 +7,6 @@ from datetime import datetime
7
  class EnhancedInMemoryHistory(BaseMemory):
8
  """
9
  Custom memory class for storing chat history with timestamps.
10
-
11
  Attributes:
12
  messages (List[BaseMessage]): A list of messages exchanged between the user and the bot.
13
  timestamps (List[datetime]): A list of timestamps when the messages were exchanged.
@@ -24,7 +23,6 @@ class EnhancedInMemoryHistory(BaseMemory):
24
  def add_messages(self, messages: List[BaseMessage]):
25
  """
26
  Adds new messages to the memory and timestamps them.
27
-
28
  Parameters:
29
  messages (List[BaseMessage]): A list of messages to add to the memory.
30
  """
@@ -35,10 +33,8 @@ class EnhancedInMemoryHistory(BaseMemory):
35
  def get_recent_messages(self, limit: int = 5):
36
  """
37
  Retrieves the most recent messages.
38
-
39
  Parameters:
40
  limit (int): Number of recent messages to retrieve (default is 5).
41
-
42
  Returns:
43
  List[BaseMessage]: A list of the most recent messages.
44
  """
@@ -52,10 +48,8 @@ class EnhancedInMemoryHistory(BaseMemory):
52
  def load_memory_variables(self, inputs: dict):
53
  """
54
  Loads memory variables for the conversation chain.
55
-
56
  Parameters:
57
  inputs (dict): Input data for the conversation chain.
58
-
59
  Returns:
60
  dict: A dictionary with the conversation history.
61
  """
@@ -64,7 +58,6 @@ class EnhancedInMemoryHistory(BaseMemory):
64
  def save_context(self, inputs: dict, outputs: str):
65
  """
66
  Saves the context of the conversation by storing the user input and bot output.
67
-
68
  Parameters:
69
  inputs (dict): The user input.
70
  outputs (str): The bot's response.
@@ -73,5 +66,4 @@ class EnhancedInMemoryHistory(BaseMemory):
73
 
74
  def clear_memory(self):
75
  """Clears the memory (alias for the clear function)."""
76
- self.clear()
77
-
 
7
  class EnhancedInMemoryHistory(BaseMemory):
8
  """
9
  Custom memory class for storing chat history with timestamps.
 
10
  Attributes:
11
  messages (List[BaseMessage]): A list of messages exchanged between the user and the bot.
12
  timestamps (List[datetime]): A list of timestamps when the messages were exchanged.
 
23
  def add_messages(self, messages: List[BaseMessage]):
24
  """
25
  Adds new messages to the memory and timestamps them.
 
26
  Parameters:
27
  messages (List[BaseMessage]): A list of messages to add to the memory.
28
  """
 
33
  def get_recent_messages(self, limit: int = 5):
34
  """
35
  Retrieves the most recent messages.
 
36
  Parameters:
37
  limit (int): Number of recent messages to retrieve (default is 5).
 
38
  Returns:
39
  List[BaseMessage]: A list of the most recent messages.
40
  """
 
48
  def load_memory_variables(self, inputs: dict):
49
  """
50
  Loads memory variables for the conversation chain.
 
51
  Parameters:
52
  inputs (dict): Input data for the conversation chain.
 
53
  Returns:
54
  dict: A dictionary with the conversation history.
55
  """
 
58
  def save_context(self, inputs: dict, outputs: str):
59
  """
60
  Saves the context of the conversation by storing the user input and bot output.
 
61
  Parameters:
62
  inputs (dict): The user input.
63
  outputs (str): The bot's response.
 
66
 
67
  def clear_memory(self):
68
  """Clears the memory (alias for the clear function)."""
69
+ self.clear()