feat: add what i did

feature/stdout-breaker
adldotori 1 year ago
parent 810a30fcfa
commit 80282a47a2

@ -14,16 +14,18 @@ class EvalOutputParser(BaseOutputParser):
return EVAL_FORMAT_INSTRUCTIONS return EVAL_FORMAT_INSTRUCTIONS
def parse(self, text: str) -> Dict[str, str]: 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) match = re.search(regex, text, re.DOTALL)
if not match: if not match:
raise Exception("parse error") raise Exception("parse error")
action = match.group(1).strip() action = match.group(1).strip()
plan = match.group(2) 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("Plan").to(Color.blue()) + ": " + plan)
logger.info(ANSI("What I Did").to(Color.blue().bright()) + ": " + what_i_did)
time.sleep(1) time.sleep(1)
logger.info( logger.info(
ANSI("Action").to(Color.cyan()) + ": " + ANSI(action).to(Style.bold()) ANSI("Action").to(Color.cyan()) + ": " + ANSI(action).to(Style.bold())

@ -19,6 +19,7 @@ Your response should be in the following schema:
Action: the action to take, should be one of [{tool_names}] 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 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 Action Input: the input to the action
**Option #2:** **Option #2:**
@ -28,6 +29,7 @@ Your response should be in the following schema:
Action: Final Answer Action: Final Answer
Plan: None Plan: None
What I Did: None
Action Input: string \\ You should put what you want to return to use here. Action Input: string \\ You should put what you want to return to use here.
""" """

Loading…
Cancel
Save