Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactor seed prompt loading: replace text file with Python class for easier maintenance #837

Merged
merged 14 commits into from
Apr 13, 2023

Conversation

AlrikOlson
Copy link
Contributor

This is a follow-up and improvement to my previous PR #760

Background

The initial implementation involved loading a seed prompt from a text file (prompt.txt). While this worked, it made the process of editing the seed prompt cumbersome and less efficient. To improve this process, this pull request refactors the method by which the seed prompt is loaded and generated, transitioning from a text file to a Python class. This will simplify editing the seed prompt and streamline the overall workflow.

Changes

  1. Removed prompt.txt from the project.
  2. Created a new Python class PromptGenerator in a separate file (promptgenerator.py), which contains the necessary methods to build the seed prompt.
  3. Refactored the main application code to import and utilize the PromptGenerator class instead of loading the prompt from the text file.

Documentation

Code is fully commented.

Test Plan

Unit tests have been written for the PromptGenerator class. I've also tested this functionality with several basic prompts, including the base ai_settings.yml

PR Quality Checklist

  • My pull request is atomic and focuses on a single change.
  • I have thouroughly tested my changes with multiple different prompts.
  • I have considered potential risks and mitigations for my changes.
  • I have documented my changes clearly and comprehensively.
  • I have not snuck in any "extra" small tweaks changes

dragonboy144
dragonboy144 previously approved these changes Apr 11, 2023
@AlrikOlson AlrikOlson reopened this Apr 11, 2023
@AlrikOlson
Copy link
Contributor Author

Thought the AttributeError: 'Config' object has no attribute 'debug' issue was caused by my changes, but it appears to be a current defect in master

@nponeccop
Copy link
Contributor

I guess the first thing @Torantulino will do when he is back is to fix the master. And we desperately need CI, so some minimalistic introduction of CI is wecome in PRs.

@claytondukes
Copy link

Thought the AttributeError: 'Config' object has no attribute 'debug' issue was caused by my changes, but it appears to be a current defect in master

There's a PR fix for it: #839 (comment)

@AlrikOlson
Copy link
Contributor Author

Thought the AttributeError: 'Config' object has no attribute 'debug' issue was caused by my changes, but it appears to be a current defect in master

There's a PR fix for it: #839 (comment)

There appears to be several PRs trying to fix the same issue, yeah

@nponeccop
Copy link
Contributor

Is there an issue for this problem?

nponeccop
nponeccop previously approved these changes Apr 12, 2023
@nponeccop nponeccop mentioned this pull request Apr 12, 2023
1 task
@nponeccop
Copy link
Contributor

@AlrikOlson There are conflicts again

nponeccop
nponeccop previously approved these changes Apr 13, 2023
@AlrikOlson
Copy link
Contributor Author

@AlrikOlson There are conflicts again

Fixed merge conflict, made sure to add the new execute_shell command to prompt.py

nponeccop
nponeccop previously approved these changes Apr 13, 2023
@nponeccop nponeccop mentioned this pull request Apr 13, 2023
1 task
@nponeccop
Copy link
Contributor

@AlrikOlson There are conflicts again

@AlrikOlson
Copy link
Contributor Author

@nponeccop resolved

@richbeales
Copy link
Contributor

Conflicting files
scripts/data/prompt.txt

scripts/prompt.py:3:1: E302 expected 2 blank lines, found 1
scripts/prompt.py:6:1: W293 blank line contains whitespace
scripts/prompt.py:61:1: W293 blank line contains whitespace
tests/promptgenerator_tests.py:11:1: E302 expected 2 blank lines, found 1
tests/promptgenerator_tests.py:84:1: W293 blank line contains whitespace
tests/promptgenerator_tests.py:98:1: E305 expected 2 blank lines after class or function definition, found 1

@AlrikOlson
Copy link
Contributor Author

Conflicting files scripts/data/prompt.txt

scripts/prompt.py:3:1: E302 expected 2 blank lines, found 1 scripts/prompt.py:6:1: W293 blank line contains whitespace scripts/prompt.py:61:1: W293 blank line contains whitespace tests/promptgenerator_tests.py:11:1: E302 expected 2 blank lines, found 1 tests/promptgenerator_tests.py:84:1: W293 blank line contains whitespace tests/promptgenerator_tests.py:98:1: E305 expected 2 blank lines after class or function definition, found 1

resolved

@richbeales richbeales merged commit 58a7fad into Significant-Gravitas:master Apr 13, 2023
@sameerpanjwani
Copy link

Have these commands been intentionally removed, they no longer required?

  1. Memory Add: "memory_add", args: "string": ""
  2. Memory Delete: "memory_del", args: "key": ""
  3. Memory Overwrite: "memory_ovr", args: "key": "", "string": ""

@AlrikOlson
Copy link
Contributor Author

Have these commands been intentionally removed, they no longer required?

  1. Memory Add: "memory_add", args: "string": ""
  2. Memory Delete: "memory_del", args: "key": ""
  3. Memory Overwrite: "memory_ovr", args: "key": "", "string": ""

This PR did not change add/remove/modify any commands.

Memory commands were removed in a separate change unrelated to this one.

SquareandCompass pushed a commit to SquareandCompass/Auto-GPT that referenced this pull request Oct 21, 2023
* make performance test reproducible

* fix test error

* Doc update and disable logging

* document random_state and version

* remove hardcoded budget

* fix test error and dependency; close Significant-Gravitas#777

* iloc
sindlinger pushed a commit to Orgsindlinger/Auto-GPT-WebUI that referenced this pull request Sep 25, 2024
…nerator

Refactor seed prompt loading: replace text file with Python class for easier maintenance
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants