@ -3,7 +3,13 @@
{
"cell_type": "markdown",
"id": "d15d8294-3328-4e07-ad16-8a03e9bbfdb9",
"metadata": {},
"metadata": {
"editable": true,
"slideshow": {
"slide_type": ""
},
"tags": []
},
"source": [
"# Instant Gratification\n",
"\n",
@ -213,7 +219,7 @@
"source": [
"# Let's try one out. Change the website and add print statements to follow along.\n",
"\n",
"ed = Website(\"https://edwarddonner.com \")\n",
"ed = Website(\"https://technicallysimple.me/ \")\n",
"print(ed.title)\n",
"print(ed.text)"
]
@ -392,7 +398,7 @@
"metadata": {},
"outputs": [],
"source": [
"summarize(\"https://edwarddonner.com \")"
"summarize(\"https://technicallysimple.me \")"
]
},
{
@ -416,7 +422,7 @@
"metadata": {},
"outputs": [],
"source": [
"display_summary(\"https://edwarddonner.com \")"
"display_summary(\"https://technicallysimple.me \")"
]
},
{
@ -442,7 +448,7 @@
"metadata": {},
"outputs": [],
"source": [
"display_summary(\"https://cnn.com \")"
"display_summary(\"https://woodleighwatersdentalsurgery.com.au \")"
]
},
{
@ -452,7 +458,7 @@
"metadata": {},
"outputs": [],
"source": [
"display_summary(\"https://anthropic .com\")"
"display_summary(\"https://amazo n.com\")"
]
},
{
@ -496,23 +502,31 @@
"source": [
"# Step 1: Create your prompts\n",
"\n",
"system_prompt = \"something here\"\n",
"user_prompt = \"\"\"\n",
" Lots of text\n",
" Can be pasted here\n",
"\"\"\"\n",
"#Import get pass to revire the contents as a hidden input field\n",
"from getpass import getpass as secret\n",
"\n",
"# Step 2: Make the messages list\n",
"system_prompt = \"You are a professional technical writer that is tasked with reviewing the contents of emails \\\n",
"and provide appropriate and impactful subject line for the email, ignoring and personal identifable infromation and text that might be a signature or navigation related. \\\n",
"Respond in markdown.\"\n",
"\n",
"# Read email body as input from user:\n",
"email_body = secret(\"Please enter contents of the email to be analysed: \\n\")\n",
"\n",
"messages = [] # fill this in\n",
"user_prompt = str({email_body}) \n",
"\n",
"# Step 2: Make the messages list\n",
"messages = [\n",
" {\"role\": \"system\", \"content\": system_prompt},\n",
" {\"role\": \"user\", \"content\": user_prompt}\n",
"]\n",
"# Step 3: Call OpenAI\n",
"\n",
"response =\n",
"response = openai.chat.completions.create(model=\"gpt-4o-mini\", messages=messages) \n",
"\n",
"# Step 4: print the result\n",
"\n",
"print("
"print(response.choices[0].message.content)\n",
"#display(Markdown(response.choices[0].message.content))"
]
},
{