"Please see the [troubleshooting](troubleshooting.ipynb) notebook in this folder for more ideas!\n",
"Please see the [troubleshooting](troubleshooting.ipynb) notebook in this folder for more ideas!\n",
"\n",
"\n",
"## If this is old hat!\n",
"\n",
"If you're already comfortable with this material, never fear - you can move swiftly through the first few labs - we will get much more in depth as the weeks progress.\n",
"\n",
"## Business value of these exercises\n",
"## Business value of these exercises\n",
"\n",
"\n",
"A final thought. While I've designed these notebooks to be educational, I've also tried to make them enjoyable. We'll do fun things like have LLMs tell jokes and argue with each other. But fundamentally, my goal is to teach skills you can apply in business. I'll explain business implications as we go, and it's worth keeping this in mind: as you build experience with models and techniques, think of ways you could put this into action at work today. Please do contact me if you'd like to discuss more or if you have ideas to bounce off me."
"A final thought. While I've designed these notebooks to be educational, I've also tried to make them enjoyable. We'll do fun things like have LLMs tell jokes and argue with each other. But fundamentally, my goal is to teach skills you can apply in business. I'll explain business implications as we go, and it's worth keeping this in mind: as you build experience with models and techniques, think of ways you could put this into action at work today. Please do contact me if you'd like to discuss more or if you have ideas to bounce off me."
@ -64,7 +68,8 @@
"## Troubleshooting if you have problems:\n",
"## Troubleshooting if you have problems:\n",
"\n",
"\n",
"1. OpenAI takes a few minutes to register after you set up an account. If you receive an error about being over quota, try waiting a few minutes and try again.\n",
"1. OpenAI takes a few minutes to register after you set up an account. If you receive an error about being over quota, try waiting a few minutes and try again.\n",
"2. Also, double check you have the right kind of API token with the right permissions. You should find it on [this webpage](https://platform.openai.com/api-keys) and it should show with Permissions of \"All\". If not, try creating another key by:\n",
"2. You'll need to set up billing and add the minimum amount of credit at this page [here](https://platform.openai.com/settings/organization/billing/overview). OpenAI requires a minimum of $5 to get started in the U.S. right now - this might be different for your region. You'll only need to use a fraction for this course. In my view, this is well worth the investment for your education and future projects - but if you have any concerns, you can skip this and watch me using OpenAI instead. In week 3 we will start to use free open-source models!\n",
"3. Also, double check you have the right kind of API token with the right permissions. You should find it on [this webpage](https://platform.openai.com/api-keys) and it should show with Permissions of \"All\". If not, try creating another key by:\n",
"- Pressing \"Create new secret key\" on the top right\n",
"- Pressing \"Create new secret key\" on the top right\n",
"# And now: call the OpenAI API. You will get very familiar with this!\n",
"\n",
"def summarize(url):\n",
"def summarize(url):\n",
" website = Website(url)\n",
" website = Website(url)\n",
" response = openai.chat.completions.create(\n",
" response = openai.chat.completions.create(\n",
@ -249,6 +268,8 @@
"metadata": {},
"metadata": {},
"outputs": [],
"outputs": [],
"source": [
"source": [
"# A function to display this nicely in the Jupyter output, using markdown\n",
"\n",
"def display_summary(url):\n",
"def display_summary(url):\n",
" summary = summarize(url)\n",
" summary = summarize(url)\n",
" display(Markdown(summary))"
" display(Markdown(summary))"
@ -273,7 +294,7 @@
"\n",
"\n",
"Note that this will only work on websites that can be scraped using this simplistic approach.\n",
"Note that this will only work on websites that can be scraped using this simplistic approach.\n",
"\n",
"\n",
"Websites that are rendered with Javascript, like React apps, won't show up. See the community-contributions folder for a Selenium implementation that gets around this.\n",
"Websites that are rendered with Javascript, like React apps, won't show up. See the community-contributions folder for a Selenium implementation that gets around this. You'll need to read up on installing Selenium (ask ChatGPT!)\n",
"\n",
"\n",
"Also Websites protected with CloudFront (and similar) may give 403 errors - many thanks Andy J for pointing this out.\n",
"Also Websites protected with CloudFront (and similar) may give 403 errors - many thanks Andy J for pointing this out.\n",
"Now run the below code and you will hopefully see that GPT can handle basic arithmetic!!"
"Now run the below code and you will hopefully see that GPT can handle basic arithmetic!!\n",
"\n",
"If not, see the cell below."
]
]
},
},
{
{
@ -118,7 +120,7 @@
"Then there's something up with your API key!\n",
"Then there's something up with your API key!\n",
"\n",
"\n",
"First check this webpage to make sure you have a positive credit balance.\n",
"First check this webpage to make sure you have a positive credit balance.\n",
"OpenAI requires that you have a positive credit balance and it has minimums. Contact me if this is a problem - I can likely share a key with a small limit.\n",
"OpenAI requires that you have a positive credit balance and it has minimums. Contact me if this is a problem - I can likely share a key with a small limit. But my salespitch for OpenAI is that this is well worth it for your education: for less than the price of a music album, you will build so much valuable commercial experience.\n",