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

Added .env.local to git ignore. Updated the model to be an environment variable + updated readme/example. #10

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion .env.example
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
OPENAI_API_KEY=
OPENAI_API_KEY=
MODEL="gpt-4"
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
# .env
.env
.env.local

# __pycache__
__pycache__
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.

Expand Down
2 changes: 1 addition & 1 deletion TermGPT.py
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down