274
week1/day1.ipynb
274
week1/day1.ipynb
@@ -104,7 +104,7 @@
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 3,
|
||||
"execution_count": null,
|
||||
"id": "4e2a9393-7767-488e-a8bf-27c12dca35bd",
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
@@ -144,18 +144,10 @@
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 4,
|
||||
"execution_count": null,
|
||||
"id": "7b87cadb-d513-4303-baee-a37b6f938e4d",
|
||||
"metadata": {},
|
||||
"outputs": [
|
||||
{
|
||||
"name": "stdout",
|
||||
"output_type": "stream",
|
||||
"text": [
|
||||
"API key found and looks good so far!\n"
|
||||
]
|
||||
}
|
||||
],
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"# Load environment variables in a file called .env\n",
|
||||
"\n",
|
||||
@@ -184,22 +176,10 @@
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 5,
|
||||
"execution_count": null,
|
||||
"id": "a58394bf-1e45-46af-9bfd-01e24da6f49a",
|
||||
"metadata": {},
|
||||
"outputs": [
|
||||
{
|
||||
"data": {
|
||||
"text/plain": [
|
||||
"[{'role': 'user',\n",
|
||||
" 'content': 'Hello, GPT! This is my first ever message to you! Hi!'}]"
|
||||
]
|
||||
},
|
||||
"execution_count": 5,
|
||||
"metadata": {},
|
||||
"output_type": "execute_result"
|
||||
}
|
||||
],
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"# To give you a preview -- calling OpenAI with these messages is this easy. Any problems, head over to the Troubleshooting notebook.\n",
|
||||
"\n",
|
||||
@@ -212,21 +192,10 @@
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 8,
|
||||
"execution_count": null,
|
||||
"id": "08330159",
|
||||
"metadata": {},
|
||||
"outputs": [
|
||||
{
|
||||
"data": {
|
||||
"text/plain": [
|
||||
"'Hi there! Welcome—and nice to meet you. I’m glad you stopped by.\\n\\nWhat would you like to do today? Here are a few ideas:\\n- Ask me a question on any topic\\n- Get help with homework or a project\\n- Learn something new (science, history, tech, etc.)\\n- Write or edit text (emails, essays, stories)\\n- Brainstorm ideas or plan something (a trip, a gift, a plan)\\n- Get coding help or debugging tips\\n- Translate or summarize something\\n\\nIf you tell me a bit about yourself or what you’re curious about, I can tailor things to you. What would you like to start with?'"
|
||||
]
|
||||
},
|
||||
"execution_count": 8,
|
||||
"metadata": {},
|
||||
"output_type": "execute_result"
|
||||
}
|
||||
],
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"openai = OpenAI()\n",
|
||||
"\n",
|
||||
@@ -244,66 +213,10 @@
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 9,
|
||||
"execution_count": null,
|
||||
"id": "2ef960cf-6dc2-4cda-afb3-b38be12f4c97",
|
||||
"metadata": {},
|
||||
"outputs": [
|
||||
{
|
||||
"name": "stdout",
|
||||
"output_type": "stream",
|
||||
"text": [
|
||||
"Home - Edward Donner\n",
|
||||
"\n",
|
||||
"Home\n",
|
||||
"Connect Four\n",
|
||||
"Outsmart\n",
|
||||
"An arena that pits LLMs against each other in a battle of diplomacy and deviousness\n",
|
||||
"About\n",
|
||||
"Posts\n",
|
||||
"Well, hi there.\n",
|
||||
"I’m Ed. I like writing code and experimenting with LLMs, and hopefully you’re here because you do too. I also enjoy DJing (but I’m badly out of practice), amateur electronic music production (\n",
|
||||
"very\n",
|
||||
"amateur) and losing myself in\n",
|
||||
"Hacker News\n",
|
||||
", nodding my head sagely to things I only half understand.\n",
|
||||
"I’m the co-founder and CTO of\n",
|
||||
"Nebula.io\n",
|
||||
". We’re applying AI to a field where it can make a massive, positive impact: helping people discover their potential and pursue their reason for being. Recruiters use our product today to source, understand, engage and manage talent. I’m previously the founder and CEO of AI startup untapt,\n",
|
||||
"acquired in 2021\n",
|
||||
".\n",
|
||||
"We work with groundbreaking, proprietary LLMs verticalized for talent, we’ve\n",
|
||||
"patented\n",
|
||||
"our matching model, and our award-winning platform has happy customers and tons of press coverage.\n",
|
||||
"Connect\n",
|
||||
"with me for more!\n",
|
||||
"September 15, 2025\n",
|
||||
"AI in Production: Gen AI and Agentic AI on AWS at scale\n",
|
||||
"May 28, 2025\n",
|
||||
"Connecting my courses – become an LLM expert and leader\n",
|
||||
"May 18, 2025\n",
|
||||
"2025 AI Executive Briefing\n",
|
||||
"April 21, 2025\n",
|
||||
"The Complete Agentic AI Engineering Course\n",
|
||||
"Navigation\n",
|
||||
"Home\n",
|
||||
"Connect Four\n",
|
||||
"Outsmart\n",
|
||||
"An arena that pits LLMs against each other in a battle of diplomacy and deviousness\n",
|
||||
"About\n",
|
||||
"Posts\n",
|
||||
"Get in touch\n",
|
||||
"ed [at] edwarddonner [dot] com\n",
|
||||
"www.edwarddonner.com\n",
|
||||
"Follow me\n",
|
||||
"LinkedIn\n",
|
||||
"Twitter\n",
|
||||
"Facebook\n",
|
||||
"Subscribe to newsletter\n",
|
||||
"Type your email…\n",
|
||||
"Subscribe\n"
|
||||
]
|
||||
}
|
||||
],
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"# Let's try out this utility\n",
|
||||
"\n",
|
||||
@@ -331,7 +244,7 @@
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 10,
|
||||
"execution_count": null,
|
||||
"id": "abdb8417-c5dc-44bc-9bee-2e059d162699",
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
@@ -347,7 +260,7 @@
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 11,
|
||||
"execution_count": null,
|
||||
"id": "f0275b1b-7cfe-4f9d-abfa-7650d378da0c",
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
@@ -383,21 +296,10 @@
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 12,
|
||||
"execution_count": null,
|
||||
"id": "f25dcd35-0cd0-4235-9f64-ac37ed9eaaa5",
|
||||
"metadata": {},
|
||||
"outputs": [
|
||||
{
|
||||
"data": {
|
||||
"text/plain": [
|
||||
"'2 + 2 equals 4.'"
|
||||
]
|
||||
},
|
||||
"execution_count": 12,
|
||||
"metadata": {},
|
||||
"output_type": "execute_result"
|
||||
}
|
||||
],
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"messages = [\n",
|
||||
" {\"role\": \"system\", \"content\": \"You are a helpful assistant\"},\n",
|
||||
@@ -418,7 +320,7 @@
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 13,
|
||||
"execution_count": null,
|
||||
"id": "0134dfa4-8299-48b5-b444-f2a8c3403c88",
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
@@ -434,24 +336,10 @@
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 14,
|
||||
"execution_count": null,
|
||||
"id": "36478464-39ee-485c-9f3f-6a4e458dbc9c",
|
||||
"metadata": {},
|
||||
"outputs": [
|
||||
{
|
||||
"data": {
|
||||
"text/plain": [
|
||||
"[{'role': 'system',\n",
|
||||
" 'content': '\\nYou are a snarkyassistant that analyzes the contents of a website,\\nand provides a short, snarky, humorous summary, ignoring text that might be navigation related.\\nRespond in markdown. Do not wrap the markdown in a code block - respond just with the markdown.\\n'},\n",
|
||||
" {'role': 'user',\n",
|
||||
" 'content': '\\nHere are the contents of a website.\\nProvide a short summary of this website.\\nIf it includes news or announcements, then summarize these too.\\n\\nHome - Edward Donner\\n\\nHome\\nConnect Four\\nOutsmart\\nAn arena that pits LLMs against each other in a battle of diplomacy and deviousness\\nAbout\\nPosts\\nWell, hi there.\\nI’m Ed. I like writing code and experimenting with LLMs, and hopefully you’re here because you do too. I also enjoy DJing (but I’m badly out of practice), amateur electronic music production (\\nvery\\namateur) and losing myself in\\nHacker News\\n, nodding my head sagely to things I only half understand.\\nI’m the co-founder and CTO of\\nNebula.io\\n. We’re applying AI to a field where it can make a massive, positive impact: helping people discover their potential and pursue their reason for being. Recruiters use our product today to source, understand, engage and manage talent. I’m previously the founder and CEO of AI startup untapt,\\nacquired in 2021\\n.\\nWe work with groundbreaking, proprietary LLMs verticalized for talent, we’ve\\npatented\\nour matching model, and our award-winning platform has happy customers and tons of press coverage.\\nConnect\\nwith me for more!\\nSeptember 15, 2025\\nAI in Production: Gen AI and Agentic AI on AWS at scale\\nMay 28, 2025\\nConnecting my courses – become an LLM expert and leader\\nMay 18, 2025\\n2025 AI Executive Briefing\\nApril 21, 2025\\nThe Complete Agentic AI Engineering Course\\nNavigation\\nHome\\nConnect Four\\nOutsmart\\nAn arena that pits LLMs against each other in a battle of diplomacy and deviousness\\nAbout\\nPosts\\nGet in touch\\ned [at] edwarddonner [dot] com\\nwww.edwarddonner.com\\nFollow me\\nLinkedIn\\nTwitter\\nFacebook\\nSubscribe to newsletter\\nType your email…\\nSubscribe'}]"
|
||||
]
|
||||
},
|
||||
"execution_count": 14,
|
||||
"metadata": {},
|
||||
"output_type": "execute_result"
|
||||
}
|
||||
],
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"# Try this out, and then try for a few more websites\n",
|
||||
"\n",
|
||||
@@ -468,7 +356,7 @@
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 15,
|
||||
"execution_count": null,
|
||||
"id": "905b9919-aba7-45b5-ae65-81b3d1d78e34",
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
@@ -486,28 +374,17 @@
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 16,
|
||||
"execution_count": null,
|
||||
"id": "05e38d41-dfa4-4b20-9c96-c46ea75d9fb5",
|
||||
"metadata": {},
|
||||
"outputs": [
|
||||
{
|
||||
"data": {
|
||||
"text/plain": [
|
||||
"\"# Edward Donner's Corner of the Internet\\n\\nWelcome to Ed's nerd den, where coding meets LLM wizardry and the occasional (badly dusted off) DJ beat. Ed is the CTO of Nebula.io, making AI actually useful by helping recruiters find talent without losing their minds. He’s also an ex-startup CEO whose company got snapped up in 2021, so naturally, he's full of patented AI magic and press clippings. \\n\\nHighlights include: \\n- Two AI battles arenas called *Connect Four* and *Outsmart* where language models duke it out in diplomatic skullduggery (because who doesn't want AI to be shady?). \\n- Educational AI content dropping like hotcakes in 2025, covering everything from getting AI running on AWS to full-on Agentic AI engineering courses.\\n- Ed’s modest brag: a patented matching model and an award-winning platform that somehow makes recruiters happy. \\n\\nWant to get in touch? Shoot an email or awkwardly follow him on LinkedIn, Twitter, or Facebook. Or maybe just subscribe to the newsletter for your daily dose of AI and snark.\""
|
||||
]
|
||||
},
|
||||
"execution_count": 16,
|
||||
"metadata": {},
|
||||
"output_type": "execute_result"
|
||||
}
|
||||
],
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"summarize(\"https://edwarddonner.com\")"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 17,
|
||||
"execution_count": null,
|
||||
"id": "3d926d59-450e-4609-92ba-2d6f244f1342",
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
@@ -521,36 +398,10 @@
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 18,
|
||||
"execution_count": null,
|
||||
"id": "3018853a-445f-41ff-9560-d925d1774b2f",
|
||||
"metadata": {},
|
||||
"outputs": [
|
||||
{
|
||||
"data": {
|
||||
"text/markdown": [
|
||||
"# Edward Donner’s Corner of the Internet\n",
|
||||
"\n",
|
||||
"Welcome to Ed's playground where code meets world domination—of the AI kind. Ed's into writing code, geeking out on Large Language Models (LLMs), and spinning (badly) some tunes as an amateur DJ/music producer. When not getting lost in Hacker News, he's busy revolutionizing recruiting as the CTO of Nebula.io, leveraging AI to help folks find their life’s purpose. Oh, and he’s got a patented AI model, an acquired startup (because why not), and an award-winning platform with press buzz.\n",
|
||||
"\n",
|
||||
"If you like AI battles (LLMs duking it out in diplomacy and deception), check out *Connect Four* and *Outsmart* arenas. Stay tuned for his latest musings or courses to become an LLM overlord yourself.\n",
|
||||
"\n",
|
||||
"## Latest Announcements (Because Ed Actually Updates Stuff)\n",
|
||||
"\n",
|
||||
"- **Sep 15, 2025:** AI in Production with Gen AI and Agentic AI at AWS scale\n",
|
||||
"- **May 28, 2025:** Connecting courses to become an LLM expert (sign me up!)\n",
|
||||
"- **May 18, 2025:** 2025 AI Executive Briefing (serious business)\n",
|
||||
"- **Apr 21, 2025:** The Complete Agentic AI Engineering Course (bring your A-game)\n",
|
||||
"\n",
|
||||
"Want to connect? Drop him a line or follow the trails of LinkedIn, Twitter, or Facebook breadcrumbs. Subscribe if you want AI wisdom delivered to your inbox."
|
||||
],
|
||||
"text/plain": [
|
||||
"<IPython.core.display.Markdown object>"
|
||||
]
|
||||
},
|
||||
"metadata": {},
|
||||
"output_type": "display_data"
|
||||
}
|
||||
],
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"display_summary(\"https://edwarddonner.com\")"
|
||||
]
|
||||
@@ -573,54 +424,20 @@
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 19,
|
||||
"execution_count": null,
|
||||
"id": "45d83403-a24c-44b5-84ac-961449b4008f",
|
||||
"metadata": {},
|
||||
"outputs": [
|
||||
{
|
||||
"data": {
|
||||
"text/markdown": [
|
||||
"Alright, here’s the scoop: This website is CNN, the internet’s go-to for pretty much everything newsworthy from politics, world drama, and business intrigue, to viral entertainment and weather tantrums. It revels in ads (which it desperately wants your feedback on because apparently, they can be annoying), offers live TV and videos, and even throws in polls and calculators for those who like crunching numbers while digesting headlines. If you’re looking for breaking news on conflicts like Ukraine-Russia or Israel-Hamas wars, or fancy a dip into lifestyle, style, or tech innovations, CNN’s got your back. Basically, it’s a never-ending buffet of topical info served with a side of “Please tell us if our ads are driving you up the wall.”"
|
||||
],
|
||||
"text/plain": [
|
||||
"<IPython.core.display.Markdown object>"
|
||||
]
|
||||
},
|
||||
"metadata": {},
|
||||
"output_type": "display_data"
|
||||
}
|
||||
],
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"display_summary(\"https://cnn.com\")"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 20,
|
||||
"execution_count": null,
|
||||
"id": "75e9fd40-b354-4341-991e-863ef2e59db7",
|
||||
"metadata": {},
|
||||
"outputs": [
|
||||
{
|
||||
"data": {
|
||||
"text/markdown": [
|
||||
"# Anthropic: AI with a Conscience\n",
|
||||
"\n",
|
||||
"Anthropic is the AI nerd who actually cares about the future of humanity — a “public benefit corporation” dedicated to making AI helpful *and* safe (because apparently, that's a thing now).\n",
|
||||
"\n",
|
||||
"They’re flaunting their latest shiny toys: **Claude Sonnet 4.5** (best model for agents, coding, computer stuff) and **Claude Haiku 4.5** (because why not poetic AI?). The site is full of jargon about \"responsible scaling\" and \"trust centers,\" which basically means they’re trying not to unleash Skynet anytime soon.\n",
|
||||
"\n",
|
||||
"Newsflash: They’ve got announcements about these models, pushing forward with AI tech but with the brakes on to avoid the apocalypse. And yes, there's lots of encouragement to login, try their Claude models, download apps, and get lost in developer docs if you’re that kind of person.\n",
|
||||
"\n",
|
||||
"In summary: It’s AI innovation meets cautious parenting, with a sprinkle of poetic flair. Who says robots can’t be responsible *and* artsy?"
|
||||
],
|
||||
"text/plain": [
|
||||
"<IPython.core.display.Markdown object>"
|
||||
]
|
||||
},
|
||||
"metadata": {},
|
||||
"output_type": "display_data"
|
||||
}
|
||||
],
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"display_summary(\"https://anthropic.com\")"
|
||||
]
|
||||
@@ -659,51 +476,28 @@
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 21,
|
||||
"execution_count": null,
|
||||
"id": "00743dac-0e70-45b7-879a-d7293a6f68a6",
|
||||
"metadata": {},
|
||||
"outputs": [
|
||||
{
|
||||
"name": "stdout",
|
||||
"output_type": "stream",
|
||||
"text": [
|
||||
"Meeting Time Change to 3 PM Tomorrow\n"
|
||||
]
|
||||
}
|
||||
],
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"# Step 1: Create your prompts\n",
|
||||
"\n",
|
||||
"system_prompt = \"\"\"\n",
|
||||
"You are embedded in an email tool that analyzes an email’s body text and suggests a concise, relevant, and professional subject line.\n",
|
||||
"The subject line should capture the core intent of the email in 5–10 words\n",
|
||||
"Maintain clarity and tone alignment:\n",
|
||||
"Formal/business emails → neutral and polished\n",
|
||||
"Casual/internal updates → conversational and brief\n",
|
||||
"Urgent matters → include urgency subtly (e.g., “Action Needed”, “Follow-Up Required”)\n",
|
||||
"Avoid unnecessary punctuation, emojis, or filler words.\n",
|
||||
"Do not include explanations unless explicitly requested.\n",
|
||||
"\"\"\"\n",
|
||||
"system_prompt = \"something here\"\n",
|
||||
"user_prompt = \"\"\"\n",
|
||||
" Suggest a short subject line for the following email:\n",
|
||||
" Hi team, please note that tomorrow’s meeting will be moved to 3 PM instead of 2 PM to accommodate the new client call.\n",
|
||||
" Lots of text\n",
|
||||
" Can be pasted here\n",
|
||||
"\"\"\"\n",
|
||||
"\n",
|
||||
"# Step 2: Make the messages list\n",
|
||||
"\n",
|
||||
"messages = [\n",
|
||||
" {\"role\": \"system\", \"content\": system_prompt},\n",
|
||||
" {\"role\": \"user\", \"content\": user_prompt}\n",
|
||||
"]\n",
|
||||
"messages = [] # fill this in\n",
|
||||
"\n",
|
||||
"# Step 3: Call OpenAI\n",
|
||||
"response = openai.chat.completions.create(\n",
|
||||
" model=\"gpt-4o-mini\",\n",
|
||||
" messages=messages\n",
|
||||
")\n",
|
||||
"# response =\n",
|
||||
"\n",
|
||||
"# Step 4: print the result\n",
|
||||
"print(response.choices[0].message.content)"
|
||||
"# print("
|
||||
]
|
||||
},
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user