diff --git a/scripts/prompt.py b/scripts/prompt.py index e499a5f69..bbdfa5ec6 100644 --- a/scripts/prompt.py +++ b/scripts/prompt.py @@ -1,10 +1,9 @@ from promptgenerator import PromptGenerator - def get_prompt(): """ This function generates a prompt string that includes various constraints, commands, resources, and performance evaluations. - + Returns: str: The generated prompt string. """ @@ -13,37 +12,27 @@ def get_prompt(): prompt_generator = PromptGenerator() # Add constraints to the PromptGenerator object - prompt_generator.add_constraint( - "~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("~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( - 'Exclusively use the commands listed in double quotes e.g. "command name"') + prompt_generator.add_constraint('Exclusively use the commands listed in double quotes e.g. "command name"') # Define the command list commands = [ ("Google Search", "google", {"input": ""}), - ("Browse Website", "browse_website", { - "url": "", "question": ""}), - ("Start GPT Agent", "start_agent", { - "name": "", "task": "", "prompt": ""}), - ("Message GPT Agent", "message_agent", { - "key": "", "message": ""}), + ("Browse Website", "browse_website", {"url": "", "question": ""}), + ("Start GPT Agent", "start_agent", {"name": "", "task": "", "prompt": ""}), + ("Message GPT Agent", "message_agent", {"key": "", "message": ""}), ("List GPT Agents", "list_agents", {}), ("Delete GPT Agent", "delete_agent", {"key": ""}), - ("Write to file", "write_to_file", { - "file": "", "text": ""}), + ("Write to file", "write_to_file", {"file": "", "text": ""}), ("Read file", "read_file", {"file": ""}), - ("Append to file", "append_to_file", { - "file": "", "text": ""}), + ("Append to file", "append_to_file", {"file": "", "text": ""}), ("Delete file", "delete_file", {"file": ""}), ("Search Files", "search_files", {"directory": ""}), ("Evaluate Code", "evaluate_code", {"code": ""}), - ("Get Improved Code", "improve_code", { - "suggestions": "", "code": ""}), - ("Write Tests", "write_tests", { - "code": "", "focus": ""}), + ("Get Improved Code", "improve_code", {"suggestions": "", "code": ""}), + ("Write Tests", "write_tests", {"code": "", "focus": ""}), ("Execute Python File", "execute_python_file", {"file": ""}), ("Task Complete (Shutdown)", "task_complete", {"reason": ""}), ("Generate Image", "generate_image", {"prompt": ""}), @@ -55,24 +44,18 @@ def get_prompt(): prompt_generator.add_command(command_label, command_name, args) # Add resources to the PromptGenerator object - prompt_generator.add_resource( - "Internet access for searches and information gathering.") + prompt_generator.add_resource("Internet access for searches and information gathering.") prompt_generator.add_resource("Long Term memory management.") - prompt_generator.add_resource( - "GPT-3.5 powered Agents for delegation of simple tasks.") + prompt_generator.add_resource("GPT-3.5 powered Agents for delegation of simple tasks.") prompt_generator.add_resource("File output.") # Add performance evaluations to the PromptGenerator object - prompt_generator.add_performance_evaluation( - "Continuously review and analyze your actions to ensure you are performing to the best of your abilities.") - prompt_generator.add_performance_evaluation( - "Constructively self-criticize your big-picture behavior constantly.") - prompt_generator.add_performance_evaluation( - "Reflect on past decisions and strategies to refine your approach.") - prompt_generator.add_performance_evaluation( - "Every command has a cost, so be smart and efficient. Aim to complete tasks in the least number of steps.") + prompt_generator.add_performance_evaluation("Continuously review and analyze your actions to ensure you are performing to the best of your abilities.") + prompt_generator.add_performance_evaluation("Constructively self-criticize your big-picture behavior constantly.") + prompt_generator.add_performance_evaluation("Reflect on past decisions and strategies to refine your approach.") + prompt_generator.add_performance_evaluation("Every command has a cost, so be smart and efficient. Aim to complete tasks in the least number of steps.") # Generate the prompt string prompt_string = prompt_generator.generate_prompt_string() - + return prompt_string