Implement Planning (#267)

* add outline of agent

* add plan class

* add initial prompt

* plumb plan through a bit

* refactor state management

* move task into state

* fix errors

* add prompt parsing

* add task actions

* better serialization

* more serialization hacks

* fix fn

* fix recursion error

* refine prompt

* better description of run

* update prompt

* tighter planning mechanism

* prompt tweaks

* fix merge

* fix lint issues

* add error handling for tasks

* add graphic for plans

* remove base_path from file actions

* rename subtask to task

* better planning

* prompt updates for verification

* remove verify field

* ruff

* mypy

* fix actions
This commit is contained in:
Robert Brennan
2024-03-29 11:47:29 -04:00
committed by GitHub
parent 32a3a0259a
commit a6f0c066b5
12 changed files with 454 additions and 13 deletions

View File

@@ -70,12 +70,12 @@ class CodeActAgent(Agent):
def step(self, state: State) -> Action:
if len(self.messages) == 0:
assert state.task, "Expecting instruction to be set"
assert state.plan.main_goal, "Expecting instruction to be set"
self.messages = [
{"role": "system", "content": SYSTEM_MESSAGE},
{"role": "user", "content": state.task},
{"role": "user", "content": state.plan.main_goal},
]
print(colored("===USER:===\n" + state.task, "green"))
print(colored("===USER:===\n" + state.plan.main_goal, "green"))
updated_info = state.updated_info
if updated_info:
for prev_action, obs in updated_info: