Update CtrlExMem_JarvisFlow.py
Browse files- CtrlExMem_JarvisFlow.py +18 -0
CtrlExMem_JarvisFlow.py
CHANGED
|
@@ -7,6 +7,24 @@ from aiflows.base_flows import CircularFlow
|
|
| 7 |
class CtrlExMem_JarvisFlow(CtrlExMemFlow):
|
| 8 |
"""This class inherits from the CtrlExMemFlow class from AbstractBossFlowModule.
|
| 9 |
See: https://huggingface.co/Tachi67/AbstractBossFlowModule/blob/main/CtrlExMemFlow.py
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 10 |
"""
|
| 11 |
def _on_reach_max_round(self):
|
| 12 |
self._state_update_dict({
|
|
|
|
| 7 |
class CtrlExMem_JarvisFlow(CtrlExMemFlow):
|
| 8 |
"""This class inherits from the CtrlExMemFlow class from AbstractBossFlowModule.
|
| 9 |
See: https://huggingface.co/Tachi67/AbstractBossFlowModule/blob/main/CtrlExMemFlow.py
|
| 10 |
+
|
| 11 |
+
Take notice that:
|
| 12 |
+
1. In the controller, we only keep the previous 3 messages for memory management, that will be:
|
| 13 |
+
a. The assistant message (controller's last command)
|
| 14 |
+
b. Manually updated new system prompt (new logs, new plans, etc.)
|
| 15 |
+
c. The user message (result, feedback)
|
| 16 |
+
2. Each time one executor from the branch is executed, the logs is updated, this means:
|
| 17 |
+
a. The logs file of Jarvis is updated.
|
| 18 |
+
b. After MemoryReading at the end of each run of the loop, the logs in the flow_state is updated.
|
| 19 |
+
c. The next time the controller is called, the updated logs is injected into the system prompts.
|
| 20 |
+
3. In the prompts of the controller, when the controller realizes one step of the plan is done,
|
| 21 |
+
we ask the controller to revise what was done and mark the current step as done. This means:
|
| 22 |
+
a. The plan file is updated.
|
| 23 |
+
b. The plan in the flow_state is updated.
|
| 24 |
+
c. The next time the controller is called, the updated plan is injected into the system prompts.
|
| 25 |
+
|
| 26 |
+
This is basically how the memory management works, to allow for more space for llm execution, and make sure the llm
|
| 27 |
+
does not forget important information.
|
| 28 |
"""
|
| 29 |
def _on_reach_max_round(self):
|
| 30 |
self._state_update_dict({
|