feat: add what i should do

pull/12/head
hanchchch 1 year ago
parent f2228aacd7
commit 09b2659f44

@ -13,7 +13,7 @@ class EvalOutputParser(BaseOutputParser):
return EVAL_FORMAT_INSTRUCTIONS
def parse(self, text: str) -> Dict[str, str]:
regex = r"Action: (.*?)[\n]Plan:(.*)[\n]What I Did:(.*)[\n]Action Input: (.*)"
regex = r"Action: (.*?)[\n]Plan:(.*)[\n]What I Did:(.*)[\n]What Should I Do:(.*)[\n]Action Input: (.*)"
match = re.search(regex, text, re.DOTALL)
if not match:
raise Exception("parse error")
@ -21,10 +21,12 @@ class EvalOutputParser(BaseOutputParser):
action = match.group(1).strip()
plan = match.group(2)
what_i_did = match.group(3)
action_input = match.group(4)
what_should_i_do = match.group(4)
action_input = match.group(5)
logger.info(ANSI("Plan").to(Color.blue()) + ": " + plan)
logger.info(ANSI("What I Did").to(Color.blue().bright()) + ": " + what_i_did)
logger.info(ANSI("Plan").to(Color.blue().bright()) + ": " + plan)
logger.info(ANSI("What I Did").to(Color.blue()) + ": " + what_i_did)
logger.info(ANSI("What Should I Do").to(Color.blue()) + ": " + what_should_i_do)
time.sleep(1)
logger.info(
ANSI("Action").to(Color.cyan()) + ": " + ANSI(action).to(Style.bold())
@ -32,7 +34,10 @@ class EvalOutputParser(BaseOutputParser):
time.sleep(1)
logger.info(ANSI("Input").to(Color.cyan()) + ": " + dim_multiline(action_input))
time.sleep(1)
return {"action": action, "action_input": action_input.strip(" ").strip('"')}
return {
"action": action,
"action_input": action_input.strip(" ").strip('"'),
}
def __str__(self):
return "EvalOutputParser"

@ -20,6 +20,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.
What Should I Do: What you should do next to achieve the goal. If you have done everything, write None.
Action Input: the input to the action
**Option #2:**
@ -30,6 +31,7 @@ Your response should be in the following schema:
Action: Final Answer
Plan: None
What I Did: None
What Should I Do: None
Action Input: string \\ You should put what you want to return to use here.
"""

Loading…
Cancel
Save