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

Update notebook to use dot env instead of old key txt file #9

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
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
7 changes: 5 additions & 2 deletions TermGPT-explained.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,8 @@
"import subprocess # to issue commands and grab output (more work needed here w/ errors)\n",
"import re # for regular expressions\n",
"import requests # for web parsing\n",
"from bs4 import BeautifulSoup # for web parsing"
"from bs4 import BeautifulSoup # for web parsing\n",
"from dotenv import load_dotenv"
]
},
{
Expand All @@ -43,7 +44,9 @@
"outputs": [],
"source": [
"# load and set our key\n",
"openai.api_key = open(\"key.txt\", \"r\").read().strip(\"\\n\")\n",
"load_dotenv()\n",
"\n",
"openai.api_key = os.environ.get(\"OPENAI_API_KEY\")\n",
"\n",
"\n",
"# adds a few more prints, mainly prints out the full context in purple.\n",
Expand Down