Additional resources and tips

This commit is contained in:
Edward Donner
2025-02-15 08:31:06 -05:00
parent 289a1b9bd1
commit ec4ada6456
14 changed files with 133 additions and 81 deletions

View File

@@ -113,6 +113,36 @@
" print(\"If in doubt, close down all jupyter lab, and follow Part 5 in the SETUP-PC or SETUP-mac guide.\")"
]
},
{
"cell_type": "markdown",
"id": "45e2cc99-b7d3-48bd-b27c-910206c4171a",
"metadata": {},
"source": [
"# Step 1.1\n",
"\n",
"## It's time to check that the environment is good and dependencies are installed\n",
"\n",
"And now, this next cell should run with no output - no import errors. \n",
"\n",
"Import errors might indicate that you started jupyter lab without your environment activated? See SETUP Part 5. \n",
"\n",
"Or you might need to restart your Kernel and Jupyter Lab. \n",
"\n",
"Or it's possible that something is wrong with Anaconda. \n",
"If so, here are some recovery instructions: \n",
"First, close everything down and restart your computer. \n",
"Then in an Anaconda Prompt (PC) or Terminal (Mac), from an activated environment, with **(llms)** showing in the prompt, from the llm_engineering directory, run this: \n",
"`python -m pip install --upgrade pip` \n",
"`pip install --retries 5 --timeout 15 --no-cache-dir --force-reinstall -r requirements.txt` \n",
"Watch carefully for any errors, and let me know. \n",
"If you see instructions to install Microsoft Build Tools, or Apple XCode tools, then follow the instructions. \n",
"Then try again!\n",
"\n",
"Finally, if that doesn't work, please try SETUP Part 2B, the alternative to Part 2 (with Python 3.11 or Python 3.12). \n",
"\n",
"If you're unsure, please run the diagnostics (last cell in this notebook) and then email me at ed@edwarddonner.com"
]
},
{
"cell_type": "code",
"execution_count": null,
@@ -120,11 +150,7 @@
"metadata": {},
"outputs": [],
"source": [
"# And now, this should run with no output - no import errors.\n",
"# Import errors might indicate that you started jupyter lab without your environment activated? See SETUP part 5.\n",
"# Or you might need to restart your Kernel and Jupyter Lab.\n",
"# Or it's possible that something is wrong with Anaconda. Please try SETUP Part 2B, the alternative to Part 2.\n",
"# If you're unsure, please run the diagnostics (last cell in this notebook) and then email me at ed@edwarddonner.com\n",
"# This import should work if your environment is active and dependencies are installed!\n",
"\n",
"from openai import OpenAI"
]
@@ -175,11 +201,14 @@
"\n",
" key_exists = any(line.startswith(\"OPENAI_API_KEY=\") for line in contents)\n",
" good_key = any(line.startswith(\"OPENAI_API_KEY=sk-proj-\") for line in contents)\n",
" classic_problem = any(\"OPEN_\" in line for line in contents)\n",
" \n",
" if key_exists and good_key:\n",
" print(\"SUCCESS! OPENAI_API_KEY found and it has the right prefix\")\n",
" elif key_exists:\n",
" print(\"Found an OPENAI_API_KEY although it didn't have the expected prefix sk-proj- \\nPlease double check your key in the file..\")\n",
" elif classic_problem:\n",
" print(\"Didn't find an OPENAI_API_KEY, but I notice that 'OPEN_' appears - do you have a typo like OPEN_API_KEY instead of OPENAI_API_KEY?\")\n",
" else:\n",
" print(\"Didn't find an OPENAI_API_KEY in the .env file\")\n",
"else:\n",
@@ -365,6 +394,11 @@
"It's unlikely, but if there's something wrong with your key, you could also try creating a new key (button on the top right) here: \n",
"https://platform.openai.com/api-keys\n",
"\n",
"### Check that you can use gpt-4o-mini from the OpenAI playground\n",
"\n",
"To confirm that billing is set up and your key is good, you could try using gtp-4o-mini directly: \n",
"https://platform.openai.com/playground/chat?models=gpt-4o-mini\n",
"\n",
"### If there's a cert related error\n",
"\n",
"If you encountered a certificates error like: \n",
@@ -380,7 +414,9 @@
"\n",
"(1) Try pasting your error into ChatGPT or Claude! It's amazing how often they can figure things out\n",
"\n",
"(2) Contact me! Please run the diagnostics in the cell below, then email me your problems to ed@edwarddonner.com\n",
"(2) Try creating another key and replacing it in the .env file and rerunning!\n",
"\n",
"(3) Contact me! Please run the diagnostics in the cell below, then email me your problems to ed@edwarddonner.com\n",
"\n",
"Thanks so much, and I'm sorry this is giving you bother!"
]