gpt-engineer icon indicating copy to clipboard operation
gpt-engineer copied to clipboard

Model fallback

Open jebarpg opened this issue 1 year ago • 5 comments

@patillacode I deleted my last repo and create a fresh new fork on the main repo. Then made both the PRs for the two fixes again.

Create a parent script model_select.py in the main repo directory to handle falling back to the gpt-3.5-turbo model for both the main.py and the rerun_edited_message_logs.py scripts. This centralizes where the model is handled and takes it out of the ai.py file so that both main.py and rerun_edited_message_logs.py can access and be updated by model_select.py. solving the issue people have who do not have access to gpt-4 with their current API key. In the future this makes it simple to edit in one place instead of having to manually edit two files with the same information.

jebarpg avatar Jun 18 '23 12:06 jebarpg

@patillacode @AntonOsika The error: gpt_engineer/main.py:21:91: E501 Line too long (107 > 90 characters) is not from something my commit changed. the errors: scripts/rerun_edited_message_logs.py:12:1: E402 Module level import not at top of file gpt_engineer/main.py:15:1: E402 Module level import not at top of file

has to happen that way otherwise the parent script model_select.py won't load properly. I would like to make a request to add this rule as an exception and not to take it into account for this file.

jebarpg avatar Jun 18 '23 13:06 jebarpg

Hi @jebarpg

I marked this PR as a "draft" since you are still making changes. We don't want to trigger CI on every commit nor get spammed!

Mark it as "ready for review" when you are done.

Please try this in the future

PS: sorry, I closed it for a second by mistake.

patillacode avatar Jun 18 '23 13:06 patillacode

Hi @jebarpg

I marked this PR as a "draft" since you are still making changes. We don't want to trigger CI on every commit nor get spammed!

Mark it as "ready for review" when you are done.

Please try this in the future

PS: sorry, I closed it for a second by mistake.

@patillacode it should be done now, the only thing is the errors for the imports not being at the top. which to get the code to work the sys. line has to be right before the import so that the import knows it can look in the parent directory. It will pass if we make an exception for the two files main.py and rerun_edited_message_logs.py

I'll be conscience of this now. Sorry about the spam didn't realize. But the pre-commit checks helped me fix the issues that were being generated. I'm looking into getting black formatter installed on my end so that all the formatting issues don't happen anymore (hopefully).

jebarpg avatar Jun 18 '23 13:06 jebarpg

@patillacode can I get some feedback on https://github.com/AntonOsika/gpt-engineer/pull/148/#issuecomment-1596149295

also I don't understand what it's erroring on here:

reformatted gpt_engineer/ai.py

All done! ✨ 🍰 ✨
1 file reformatted, 12 files left unchanged.

pre-commit hook(s) made changes.
If you are seeing this message in CI, reproduce locally with: `pre-commit run --all-files`.
To run `pre-commit` as part of git workflow, use `pre-commit install`.
All changes made by hooks:
diff --git a/gpt_engineer/ai.py b/gpt_engineer/ai.py
index 790c4d3..b[84](https://github.com/AntonOsika/gpt-engineer/actions/runs/5308643434/jobs/9608341288?pr=148#step:4:89)3769 100644
--- a/gpt_engineer/ai.py
+++ b/gpt_engineer/ai.py
@@ -8,7 +8,7 @@ logger = logging.getLogger(__name__)
 class AI:
     def __init__(self, model="gpt-4", temperature=0.1):
         self.temperature = temperature
-        
+
     def start(self, system, user):
         messages = [
             {"role": "system", "content": system},
Error: Process completed with exit code 1.

jebarpg avatar Jun 19 '23 06:06 jebarpg

Hi @jebarpg

I am purposely waiting on the outcome of discussion #135 before I look into any PR that is related to that, this one for example.

The error happening is because you didn't run the pre-commit hooks before your commit, please read the CONTRIBUTING.md file where it is explained that we are using pre-commit hooks.

Please make sure to follow the established code style guidelines for this project. Consistent code style helps maintain readability and makes it easier for others to contribute to the project.

To enforce this we use [pre-commit](https://pre-commit.com/) to run [black](https://black.readthedocs.io/en/stable/index.html) and [ruff](https://beta.ruff.rs/docs/) on every commit.

pre-commit is part of our requirements.txt file so you should already have it installed. If you don't, you can install the library via pip with:

Then when we check in the CI if the code is "properly styled" it returns with an error because it is not "properly styled".

patillacode avatar Jun 19 '23 11:06 patillacode

There should be an easier way to do this where the code is clean and easy to understand

If you find it feel free to open a new one.

AntonOsika avatar Jun 22 '23 22:06 AntonOsika