diff --git a/TermGPT-explained.ipynb b/TermGPT-explained.ipynb index b9123b3..492941d 100644 --- a/TermGPT-explained.ipynb +++ b/TermGPT-explained.ipynb @@ -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" ] }, { @@ -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",