-
-
Notifications
You must be signed in to change notification settings - Fork 6.9k
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
Load env variable handling & Project preprompt enhancement #740
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I believe this PR increases useability and reproducibility.
see my (very minor) comment on line 25
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the PR @saschalalala !
To make it a nice legacy of yours, would you consider refactoring it to make the main() file?
Could set line 109 to preprompts=DB(preprompt_path(use_custom_preprompts))
(use_custom_preprompts: bool
flag, preprompt_path(use_custom_preprompts: bool)
is a function)
for file in preprompts_path.glob("*"): | ||
if not (project_preprompts_path / file.name).exists(): | ||
(project_preprompts_path / file.name).write_text(file.read_text()) | ||
preprompts_path = project_preprompts_path |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you create a separate function for this? 🙏
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Will do
@@ -50,6 +53,12 @@ def main( | |||
help="""Endpoint for your Azure OpenAI Service (https://xx.openai.azure.com). | |||
In that case, the given model is the deployment name chosen in the Azure AI Studio.""", | |||
), | |||
use_project_preprompts: bool = typer.Option( | |||
False, | |||
"--use-project-preprompts", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
--use-custom-preprompts
Of course :) I also already started writing some docs for that feature. Will create a new PR after the weekend. |
Hey everyone 👋,
thanks for the great project. I found some things that I believe can benefit the project.
env file loading
I use pyenv and pyenv-virtualenv and I noticed that my pip installed gpt-engineer always tries to load the .env from its site-packages directory and searches up to the root. My project is located somewhere else, so it did not find my .env. I introduced a small change that as a fallback, if the .env file isn't found before, will attempt to find it in the current working directory. (c834e69 and ac4cac6)
preprompt management
I noticed that the preprompts are part of the project itself and a change inside my venv directory would a) be overwritten by an update and b) be global. I wanted to have project specific preprompts so I implemented them. I noticed that the
DB
class cannot handle kind of a "merged" path so that only the files that I want to overwrite would come from the project specific directory so I decided to copy all existing files to the project so that when the preprompts would be updated in the future (inside gpt-engineer itself) they would be copied over to the project directory.In order to test this feature and because I don't know every implication of the preprompts yet, I changed all of them inside my example project to say
You do not code, you only shout back at people
and it looks like this:Future steps if this PR is accepted