diff --git a/.env.example b/.env.example index 9847a1d..42e6d0f 100644 --- a/.env.example +++ b/.env.example @@ -1 +1,2 @@ -OPENAI_API_KEY= \ No newline at end of file +OPENAI_API_KEY= +MODEL="gpt-4" \ No newline at end of file diff --git a/.gitignore b/.gitignore index 87e6105..04f6d81 100644 --- a/.gitignore +++ b/.gitignore @@ -1,5 +1,6 @@ # .env .env +.env.local # __pycache__ __pycache__ diff --git a/README.md b/README.md index ecaf7a2..1fbfe86 100644 --- a/README.md +++ b/README.md @@ -8,7 +8,7 @@ The notebook also breaks down how the script works. # Usage Run with `$ python3 TermGPT.py` -You will need to create a `.env` file similar to https://github.com/Sentdex/TermGPT/blob/main/.env.example, or set `OPENAI_API_KEY` manually. +You will need to create a `.env` file similar to https://github.com/Sentdex/TermGPT/blob/main/.env.example, or set `OPENAI_API_KEY` and `MODEL` manually. From here, you make your programming/development request. The script will run and query GPT-4 for a series of terminal commands to run to achieve this objective. This is including, but not limited to: reading files, writing code, reading websites, running code, running terminal commands...etc. diff --git a/TermGPT.py b/TermGPT.py index 4a432cd..e98c40b 100644 --- a/TermGPT.py +++ b/TermGPT.py @@ -20,7 +20,7 @@ READ_RE_PATTERN = r"--r \[(.*?)\]" WEB_RE_PATTERN = r"--w \[(.*?)\]" -def gpt_query(model="gpt-4", max_retries=15, sleep_time=2): +def gpt_query(model=os.environ.get("MODEL"), max_retries=15, sleep_time=2): global message_history retries = 0 logger = logging.getLogger()