From 80282a47a24107250bb9033be3c1b0fadd0a7b0e Mon Sep 17 00:00:00 2001 From: adldotori Date: Mon, 3 Apr 2023 12:51:22 +0000 Subject: [PATCH] feat: add what i did --- core/agents/parser.py | 6 ++++-- core/prompts/input.py | 2 ++ 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/core/agents/parser.py b/core/agents/parser.py index a54c5dd..e338060 100644 --- a/core/agents/parser.py +++ b/core/agents/parser.py @@ -14,16 +14,18 @@ class EvalOutputParser(BaseOutputParser): return EVAL_FORMAT_INSTRUCTIONS def parse(self, text: str) -> Dict[str, str]: - regex = r"Action: (.*?)[\n]Plan:(.*)Action Input: (.*)" + regex = r"Action: (.*?)[\n]Plan:(.*)[\n]What I Did:(.*)[\n]Action Input: (.*)" match = re.search(regex, text, re.DOTALL) if not match: raise Exception("parse error") action = match.group(1).strip() plan = match.group(2) - action_input = match.group(3) + what_i_did = match.group(3) + action_input = match.group(4) logger.info(ANSI("Plan").to(Color.blue()) + ": " + plan) + logger.info(ANSI("What I Did").to(Color.blue().bright()) + ": " + what_i_did) time.sleep(1) logger.info( ANSI("Action").to(Color.cyan()) + ": " + ANSI(action).to(Style.bold()) diff --git a/core/prompts/input.py b/core/prompts/input.py index f566940..ccd54b6 100644 --- a/core/prompts/input.py +++ b/core/prompts/input.py @@ -19,6 +19,7 @@ Your response should be in the following schema: Action: the action to take, should be one of [{tool_names}] Plan: All remaining detailed plans after this action in check box. Each plan should be concise and clear to achieve the goal. Write it in the following schema: - [ ] plan +What I Did: What you just did to achieve the goal. If you have not done anything, write None. Action Input: the input to the action **Option #2:** @@ -28,6 +29,7 @@ Your response should be in the following schema: Action: Final Answer Plan: None +What I Did: None Action Input: string \\ You should put what you want to return to use here. """