Short memory
labridge.func_modules.memory.chat.short_memory
¶
labridge.func_modules.memory.chat.short_memory.ShortMemoryManager
¶
Bases: object
This class manage the short-term chat memories between the agent and users.
ATTRIBUTE | DESCRIPTION |
---|---|
_root |
The project root.
TYPE:
|
_valid_delta_days |
Only valid chat histories will be loaded.
TYPE:
|
_valid_delta_hours |
Same as above.
TYPE:
|
_valid_delta_minutes |
Same as above.
TYPE:
|
Source code in labridge\func_modules\memory\chat\short_memory.py
16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 |
|
labridge.func_modules.memory.chat.short_memory.ShortMemoryManager.root: str
property
¶
Return the project root
labridge.func_modules.memory.chat.short_memory.ShortMemoryManager.valid_delta_time: datetime.timedelta
property
¶
Return the valid time delta.
labridge.func_modules.memory.chat.short_memory.ShortMemoryManager.load_memory(user_id)
¶
Only chat messages within the valid time delta will be loaded.
PARAMETER | DESCRIPTION |
---|---|
user_id |
The user_id of a lab member.
TYPE:
|
RETURNS | DESCRIPTION |
---|---|
Optional[List[ChatMessage]]
|
The loaded short memory: If the short memory storage does not exist or the datetime of the short memory is invalid, return None. |
Source code in labridge\func_modules\memory\chat\short_memory.py
66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 |
|
labridge.func_modules.memory.chat.short_memory.ShortMemoryManager.save_memory(user_id, chat_history)
¶
Persist the short-term memory for the user's next chat request.
PARAMETER | DESCRIPTION |
---|---|
user_id |
The user id of a Lab member.
TYPE:
|
chat_history |
Current chat history between the user and agent.
TYPE:
|
Source code in labridge\func_modules\memory\chat\short_memory.py
94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 |
|