TaskWeaver
TaskWeaver copied to clipboard
Reason for Memory object shared between planner and code interpreter
Hi,
I was trying to understand the code base in a bit more detail.
Most of it makes sense however I am not a bit confused about the Memory object being shared between the planner and code interpreter.
In the reply methods of planner and code interpreter, the first thing that is done is to get the rounds specific to the respective role.
For example in planner: https://github.com/microsoft/TaskWeaver/blob/f65610c4705064f96c9a5024cbe1a11b93dc4b18/taskweaver/planner/planner.py#L217
and in code interpreter: https://github.com/microsoft/TaskWeaver/blob/f65610c4705064f96c9a5024cbe1a11b93dc4b18/taskweaver/code_interpreter/code_generator/code_generator.py#L300
I was just confused about why the components (planner, code generator etc) do not have their respective memory as systematically they extract their respective portions from shared memory. Most likely there is a use case I am not able to see.
Would appreciate any insight and guidance
Regards & thanks Kapil
@ksachdeva Hi, I think this is not due to any special use cases. It is more from how we store the interactions between the roles.
We first have the sessions. In each session, there are multiple rounds. Each round starts from the user's post and ends at the response from the planner to the user. In between, there could be several posts between the planner and the code interpreter. For those posts between planner and the code interpreter, both sides need to use them in their own prompts. For example, when the planner composes its prompt, it needs all posts that are from itself, or sent to itself. If we keep separate memories, one post has to be stored twice at both sides. That is the key reason why we have this share memory.
Thanks @liqul