From fee5e769e74ad1a1284000caf55f1091ef588f9f Mon Sep 17 00:00:00 2001 From: "tuyang.yhj" Date: Sun, 14 May 2023 21:10:08 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A4=9A=E8=BD=AE=E5=AF=B9=E8=AF=9D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pilot/prompts/auto_mode_prompt.py | 7 +++---- pilot/prompts/prompt.py | 12 ++++++++---- 2 files changed, 11 insertions(+), 8 deletions(-) diff --git a/pilot/prompts/auto_mode_prompt.py b/pilot/prompts/auto_mode_prompt.py index bb8838408..bc133075d 100644 --- a/pilot/prompts/auto_mode_prompt.py +++ b/pilot/prompts/auto_mode_prompt.py @@ -51,7 +51,6 @@ class AutoModePrompt: """ prompt_start = ( - "Based on the above definition, answer the current goal and ensure that the response meets both the current constraints and the above definition and constraints" ) if prompt_generator is None: prompt_generator = build_default_prompt_generator() @@ -65,7 +64,7 @@ class AutoModePrompt: prompt_generator = plugin.post_prompt(prompt_generator) - full_prompt = f"{prompt_start}\n\nNEW GOALS:\n\n" + full_prompt = f"{prompt_start}\n\nGOALS:\n\n" if not self.ai_goals : self.ai_goals = user_input for i, goal in enumerate(self.ai_goals): @@ -75,9 +74,9 @@ class AutoModePrompt: # else: # full_prompt += f"{last_auto_return}\n\n" - full_prompt += f"New Constraints:\n{DEFAULT_TRIGGERING_PROMPT}\n\n" + full_prompt += f"Constraints:\n\n{DEFAULT_TRIGGERING_PROMPT}\n" - full_prompt += "GENERATE NEXT COMMAND JSON, And ensure that JSON is correctly loadable by Python" + full_prompt += """Based on the above definition, answer the current goal and ensure that the response meets both the current constraints and the above definition and constraints""" self.prompt_generator = prompt_generator return full_prompt diff --git a/pilot/prompts/prompt.py b/pilot/prompts/prompt.py index 223ca2d60..8795906c1 100644 --- a/pilot/prompts/prompt.py +++ b/pilot/prompts/prompt.py @@ -6,7 +6,7 @@ from pilot.prompts.generator import PromptGenerator CFG = Config() DEFAULT_TRIGGERING_PROMPT = ( - "Determine which next command to use, and respond using the format specified above:" + "Determine which next command to use, and respond using the format specified above" ) @@ -27,11 +27,15 @@ def build_default_prompt_generator() -> PromptGenerator: # "~4000 word limit for short term memory. Your short term memory is short, so" # " immediately save important information to files." # ) + # prompt_generator.add_constraint( + # "If you are unsure how you previously did something or want to recall past" + # " events, thinking about similar events will help you remember." + # ) + # prompt_generator.add_constraint("No user assistance") + prompt_generator.add_constraint( - "If you are unsure how you previously did something or want to recall past" - " events, thinking about similar events will help you remember." + 'Only output one correct JSON response at a time' ) - prompt_generator.add_constraint("No user assistance") prompt_generator.add_constraint( 'Exclusively use the commands listed in double quotes e.g. "command name"' )