"# Load environment variables in a file called .env\n",
"\n",
@ -132,7 +142,7 @@
},
{
"cell_type": "code",
"execution_count": null,
"execution_count": 6,
"id": "019974d9-f3ad-4a8a-b5f9-0a3719aea2d3",
"metadata": {},
"outputs": [],
@ -146,7 +156,7 @@
},
{
"cell_type": "code",
"execution_count": null,
"execution_count": 7,
"id": "c5e793b2-6775-426a-a139-4848291d0463",
"metadata": {},
"outputs": [],
@ -171,10 +181,63 @@
},
{
"cell_type": "code",
"execution_count": null,
"execution_count": 8,
"id": "2ef960cf-6dc2-4cda-afb3-b38be12f4c97",
"metadata": {},
"outputs": [],
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"Home - Edward Donner\n",
"Home\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",
"November 13, 2024\n",
"Mastering AI and LLM Engineering – Resources\n",
"October 16, 2024\n",
"From Software Engineer to AI Data Scientist – resources\n",
"August 6, 2024\n",
"Outsmart LLM Arena – a battle of diplomacy and deviousness\n",
"June 26, 2024\n",
"Choosing the Right LLM: Toolkit and Resources\n",
"Navigation\n",
"Home\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"
]
}
],
"source": [
"# Let's try one out. Change the website and add print statements to follow along.\n",
"\n",
@ -203,7 +266,7 @@
},
{
"cell_type": "code",
"execution_count": null,
"execution_count": 9,
"id": "abdb8417-c5dc-44bc-9bee-2e059d162699",
"metadata": {},
"outputs": [],
@ -217,7 +280,7 @@
},
{
"cell_type": "code",
"execution_count": null,
"execution_count": 10,
"id": "f0275b1b-7cfe-4f9d-abfa-7650d378da0c",
"metadata": {},
"outputs": [],
@ -235,10 +298,65 @@
},
{
"cell_type": "code",
"execution_count": null,
"execution_count": 11,
"id": "26448ec4-5c00-4204-baec-7df91d11ff2e",
"metadata": {},
"outputs": [],
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"You are looking at a website titled Home - Edward Donner\n",
"The contents of this website is as follows; please provide a short summary of this website in markdown. If it includes news or announcements, then summarize these too.\n",
"\n",
"Home\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",
"November 13, 2024\n",
"Mastering AI and LLM Engineering – Resources\n",
"October 16, 2024\n",
"From Software Engineer to AI Data Scientist – resources\n",
"August 6, 2024\n",
"Outsmart LLM Arena – a battle of diplomacy and deviousness\n",
"June 26, 2024\n",
"Choosing the Right LLM: Toolkit and Resources\n",
"Navigation\n",
"Home\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"
]
}
],
"source": [
"print(user_prompt_for(ed))"
]
@ -262,7 +380,7 @@
},
{
"cell_type": "code",
"execution_count": null,
"execution_count": 12,
"id": "0134dfa4-8299-48b5-b444-f2a8c3403c88",
"metadata": {},
"outputs": [],
@ -278,10 +396,24 @@
},
{
"cell_type": "code",
"execution_count": null,
"execution_count": 13,
"id": "36478464-39ee-485c-9f3f-6a4e458dbc9c",
"metadata": {},
"outputs": [],
"outputs": [
{
"data": {
"text/plain": [
"[{'role': 'system',\n",
" 'content': 'You are an assistant that analyzes the contents of a website and provides a short summary, ignoring text that might be navigation related. Respond in markdown.'},\n",
" {'role': 'user',\n",
" 'content': 'You are looking at a website titled Home - Edward Donner\\nThe contents of this website is as follows; please provide a short summary of this website in markdown. If it includes news or announcements, then summarize these too.\\n\\nHome\\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!\\nNovember 13, 2024\\nMastering AI and LLM Engineering – Resources\\nOctober 16, 2024\\nFrom Software Engineer to AI Data Scientist – resources\\nAugust 6, 2024\\nOutsmart LLM Arena – a battle of diplomacy and deviousness\\nJune 26, 2024\\nChoosing the Right LLM: Toolkit and Resources\\nNavigation\\nHome\\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": 13,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"# Try this out, and then try for a few more websites\n",
"\n",
@ -298,7 +430,7 @@
},
{
"cell_type": "code",
"execution_count": null,
"execution_count": 14,
"id": "905b9919-aba7-45b5-ae65-81b3d1d78e34",
"metadata": {},
"outputs": [],
@ -316,17 +448,28 @@
},
{
"cell_type": "code",
"execution_count": null,
"execution_count": 15,
"id": "05e38d41-dfa4-4b20-9c96-c46ea75d9fb5",
"metadata": {},
"outputs": [],
"outputs": [
{
"data": {
"text/plain": [
"\"# Summary of Edward Donner's Website\\n\\nEdward Donner's website serves as a personal and professional platform where he shares his interests in programming, experimenting with large language models (LLMs), and electronic music. As the co-founder and CTO of Nebula.io, he focuses on utilizing AI to positively impact talent discovery and management. Previously, he founded the AI startup untapt, which was acquired in 2021.\\n\\n## Recent Posts\\n- **November 13, 2024**: **Mastering AI and LLM Engineering – Resources** \\n Resources aimed at improving skills in AI and LLM engineering.\\n\\n- **October 16, 2024**: **From Software Engineer to AI Data Scientist – resources** \\n Guidance and resources for transitioning careers into AI data science.\\n\\n- **August 6, 2024**: **Outsmart LLM Arena – a battle of diplomacy and deviousness** \\n Details about a platform that challenges LLMs in a competitive arena setting.\\n\\n- **June 26, 2024**: **Choosing the Right LLM: Toolkit and Resources** \\n Resources and tools for selecting the appropriate LLM for specific needs. \\n\\nThe website emphasizes educational resources and advancements in AI, along with a personal touch reflecting Donner's diverse interests.\""
]
},
"execution_count": 15,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"summarize(\"https://edwarddonner.com\")"
]
},
{
"cell_type": "code",
"execution_count": null,
"execution_count": 16,
"id": "3d926d59-450e-4609-92ba-2d6f244f1342",
"metadata": {},
"outputs": [],
@ -340,10 +483,33 @@
},
{
"cell_type": "code",
"execution_count": null,
"execution_count": 17,
"id": "3018853a-445f-41ff-9560-d925d1774b2f",
"metadata": {},
"outputs": [],
"outputs": [
{
"data": {
"text/markdown": [
"# Summary of Edward Donner's Website\n",
"\n",
"Edward Donner's website showcases his interests and projects primarily focused on Large Language Models (LLMs) and AI. Ed, the site's owner, is the co-founder and CTO of Nebula.io, an AI-driven company that aids talent discovery and recruitment. His platform employs innovative LLMs and has gained recognition in the industry.\n",
"\n",
"### Notable Announcements and Posts:\n",
"- **Mastering AI and LLM Engineering – Resources** (November 13, 2024)\n",
"- **From Software Engineer to AI Data Scientist – Resources** (October 16, 2024)\n",
"- **Outsmart LLM Arena – A Battle of Diplomacy and Deviousness** (August 6, 2024)\n",
"- **Choosing the Right LLM: Toolkit and Resources** (June 26, 2024)\n",
"\n",
"Ed expresses a passion for coding, music, and engaging with the tech community. He encourages connections with like-minded individuals."
],
"text/plain": [
"<IPython.core.display.Markdown object>"
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"display_summary(\"https://edwarddonner.com\")"
]
@ -366,20 +532,75 @@
},
{
"cell_type": "code",
"execution_count": null,
"execution_count": 18,
"id": "45d83403-a24c-44b5-84ac-961449b4008f",
"metadata": {},
"outputs": [],
"outputs": [
{
"data": {
"text/markdown": [
"# Summary of CNN Website\n",
"\n",
"CNN's website serves as a comprehensive news platform, providing a variety of content categories including U.S. news, world news, politics, business, health, entertainment, sports, science, and more. The site emphasizes breaking news updates and features a range of videos and articles that address current events and significant topics.\n",
"\n",
"### Key Recent Headlines\n",
"- **Trump Vows Tariffs**: Trump has pledged to impose a 25% tariff on goods from Mexico and Canada from his first day in office, which could disrupt supply chains significantly.\n",
"- **Winter Storm Alerts**: A Thanksgiving weekend winter storm is forecasted to bring severe weather to the East Coast, with suggestions for travelers on dealing with flight cancellations.\n",
"- **Business Updates**: Notable changes in business leadership include Kohl’s CEO stepping down and Macy’s uncovering hidden expenses attributed to an employee.\n",
"- **Crime and Justice**: A judge has rejected a request to sideline a transgender volleyball player at San Jose State, showcasing ongoing legal challenges around transgender rights in sports.\n",
"\n",
"### Featured Topics\n",
"- **International Conflicts**: Ongoing coverage of the Ukraine-Russia and Israel-Hamas wars.\n",
"- **Health**: Articles exploring the implications of a popular financial rule for retirement, alongside lifestyle tips for healthier living during holiday travel.\n",
"- **Pop Culture**: Insights into entertainment topics including celebrity news, upcoming movies, and holiday viewing recommendations.\n",
"\n",
"Overall, CNN remains a leading source for immediate news updates and in-depth analysis across a wide array of subjects."
],
"text/plain": [
"<IPython.core.display.Markdown object>"
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"display_summary(\"https://cnn.com\")"
]
},
{
"cell_type": "code",
"execution_count": null,
"execution_count": 19,
"id": "75e9fd40-b354-4341-991e-863ef2e59db7",
"metadata": {},
"outputs": [],
"outputs": [
{
"data": {
"text/markdown": [
"# Summary of Anthropic Website\n",
"\n",
"Anthropic is an AI research and safety company based in San Francisco, focused on creating beneficial and reliable AI systems. The website features information about their main AI model, Claude, with the latest version being Claude 3.5 Sonnet and the introduction of Claude 3.5 Haiku.\n",
"\n",
"## Key Highlights:\n",
"- **Claude 3.5 Sonnet**: The most advanced AI model available to users.\n",
"- **API Access**: Businesses can leverage Claude to enhance operational efficiency and explore new revenue opportunities.\n",
"- **Recent Announcements**:\n",
" - **New Model Releases**: On October 22, 2024, Anthropic introduced Claude 3.5 Sonnet and Haiku.\n",
" - **Enterprise Solutions**: On September 4, 2024, they highlighted Claude's capabilities for enterprise applications.\n",
"\n",
"## Research Focus:\n",
"Anthropic emphasizes its commitment to AI safety through ongoing research and development, including topics such as Constitutional AI aimed at ensuring harmlessness through AI feedback.\n",
"\n",
"The company invites talent in various fields, reflecting a diverse and interdisciplinary team specialized in machine learning, policy, and other relevant domains."
"Generative AI has numerous business applications across various industries, including:\n",
"\n",
"1. **Content Creation**: Generative AI can be used to generate high-quality content such as articles, social media posts, product descriptions, and even entire books. This can help businesses save time and resources while maintaining consistency in their content.\n",
"2. **Image and Video Generation**: Generative AI can create realistic images and videos for various purposes, such as:\n",
" * Product visualization: Generate 3D models or animations to showcase products in different scenarios.\n",
" * Advertising: Create custom graphics, billboards, or social media ads with unique visuals.\n",
" * Training simulations: Develop realistic training simulations for employees, customers, or patients.\n",
"3. **Marketing and Advertising**: Generative AI can help businesses:\n",
" * Personalize ads: Generate targeted ads based on customer preferences, behavior, and demographics.\n",
" * Automate social media management: Generate social media posts, engage with customers, and monitor online conversations.\n",
"4. **Product Design**: Generative AI can aid in:\n",
" * Product design: Generate 3D models, prototypes, or design concepts for new products.\n",
" * Fashion design: Create custom clothing, accessories, or interior designs using generative algorithms.\n",
"5. **Customer Service**: Generative AI can help businesses:\n",
" * Automate customer support chatbots: Use generative models to respond to customer inquiries and resolve issues.\n",
" * Generate personalized customer experiences: Develop customized content, offers, or recommendations based on customer behavior and preferences.\n",
"6. **Audio and Music Generation**: Generative AI can be used to create:\n",
" * Original music compositions: Compose unique music tracks for ads, videos, or films.\n",
" * Podcasts and audiobooks: Generate custom audio content for businesses or clients.\n",
"7. **Data Augmentation**: Generative AI can help businesses augment their datasets by generating new data points, which can improve the accuracy of machine learning models.\n",
"8. **Supply Chain Optimization**: Generative AI can be used to:\n",
" * Predict demand: Use generative models to forecast demand and optimize inventory levels.\n",
" * Optimize logistics: Generate routes, schedules, or shipping plans using generative algorithms.\n",
"9. **Financial Modeling**: Generative AI can help businesses create more accurate financial models by generating new scenarios, forecasts, or predictions based on historical data.\n",
"10. **Innovation**: Generative AI can facilitate innovation in various industries by:\n",
" * Generating new product ideas: Use generative models to come up with novel products or services.\n",
" * Developing new business strategies: Create customized plans and proposals for clients using generative algorithms.\n",
"\n",
"These are just a few examples of the many business applications of Generative AI. As the technology continues to evolve, we can expect to see even more innovative uses in various industries.\n"
"\u001b[1A\u001b[2K\u001b[32mToken written to \u001b[0m\u001b[35m/Users/xiangyu/\u001b[0m\u001b[35m.modal.toml\u001b[0m\u001b[32m in profile \u001b[0m\u001b[35mxykong36\u001b[0m\u001b[32m.\u001b[0m\n"
]
}
],
"source": [
"# Remove the '# ' from the next line and run the cell\n",
"# !modal setup"
"!modal setup"
]
},
{
"cell_type": "code",
"execution_count": null,
"execution_count": 3,
"id": "3b133701-f550-44a1-a67f-eb7ccc4769a9",
"metadata": {},
"outputs": [],
@ -90,28 +110,160 @@
},
{
"cell_type": "code",
"execution_count": null,
"id": "0f3f73ae-1295-49f3-9099-b8b41fc3429b",
"execution_count": 10,
"id": "7bf9cecb-f837-458d-afdf-1b925c89b4eb",
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"\u001b[2KThe web browser should have opened for you to authenticate and get an API token.\n",
"If it didn't, please copy this URL into your web browser manually:\n",
"\u001b[1A\u001b[2K\u001b[32mToken written to \u001b[0m\u001b[35m/Users/xiangyu/\u001b[0m\u001b[35m.modal.toml\u001b[0m\u001b[32m in profile \u001b[0m\u001b[35mxykong36\u001b[0m\u001b[32m.\u001b[0m\n"
"File \u001b[0;32m/opt/anaconda3/envs/llms/lib/python3.11/site-packages/modal/object.py:237\u001b[0m, in \u001b[0;36m_Object.resolve\u001b[0;34m(self, client)\u001b[0m\n\u001b[1;32m 235\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m\n\u001b[1;32m 236\u001b[0m \u001b[38;5;28;01melif\u001b[39;00m \u001b[38;5;129;01mnot\u001b[39;00m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39m_hydrate_lazily:\n\u001b[0;32m--> 237\u001b[0m \u001b[38;5;28;43mself\u001b[39;49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43m_validate_is_hydrated\u001b[49m\u001b[43m(\u001b[49m\u001b[43m)\u001b[49m\n\u001b[1;32m 238\u001b[0m \u001b[38;5;28;01melse\u001b[39;00m:\n\u001b[1;32m 239\u001b[0m \u001b[38;5;66;03m# TODO: this client and/or resolver can't be changed by a caller to X.from_name()\u001b[39;00m\n\u001b[1;32m 240\u001b[0m c \u001b[38;5;241m=\u001b[39m client \u001b[38;5;28;01mif\u001b[39;00m client \u001b[38;5;129;01mis\u001b[39;00m \u001b[38;5;129;01mnot\u001b[39;00m \u001b[38;5;28;01mNone\u001b[39;00m \u001b[38;5;28;01melse\u001b[39;00m \u001b[38;5;28;01mawait\u001b[39;00m _Client\u001b[38;5;241m.\u001b[39mfrom_env()\n",
"File \u001b[0;32m/opt/anaconda3/envs/llms/lib/python3.11/site-packages/modal/object.py:132\u001b[0m, in \u001b[0;36m_Object._validate_is_hydrated\u001b[0;34m(self)\u001b[0m\n\u001b[1;32m 129\u001b[0m \u001b[38;5;28;01melse\u001b[39;00m:\n\u001b[1;32m 130\u001b[0m \u001b[38;5;66;03m# Technically possible, but with an ambiguous cause.\u001b[39;00m\n\u001b[1;32m 131\u001b[0m reason \u001b[38;5;241m=\u001b[39m \u001b[38;5;124m\"\u001b[39m\u001b[38;5;124m\"\u001b[39m\n\u001b[0;32m--> 132\u001b[0m \u001b[38;5;28;01mraise\u001b[39;00m ExecutionError(\n\u001b[1;32m 133\u001b[0m \u001b[38;5;124mf\u001b[39m\u001b[38;5;124m\"\u001b[39m\u001b[38;5;132;01m{\u001b[39;00mobject_type\u001b[38;5;132;01m}\u001b[39;00m\u001b[38;5;124m has not been hydrated with the metadata it needs to run on Modal\u001b[39m\u001b[38;5;132;01m{\u001b[39;00mreason\u001b[38;5;132;01m}\u001b[39;00m\u001b[38;5;124m.\u001b[39m\u001b[38;5;124m\"\u001b[39m\n\u001b[1;32m 134\u001b[0m )\n",
"\u001b[0;31mExecutionError\u001b[0m: Function has not been hydrated with the metadata it needs to run on Modal, because the App it is defined on is not running."
]
}
],
"source": [
"with app.run(show_progress=False):\n",
" reply=hello.remote()\n",
"reply"
]
},
{
"cell_type": "code",
"execution_count": 17,
"id": "45e59cca-a279-437c-ad29-718d61befde1",
"metadata": {},
"outputs": [],
"source": [
"import sys\n",
"\n",
"import modal\n",
"\n",
"app = modal.App(\"example-hello-world\")\n"
]
},
{
"cell_type": "code",
"execution_count": 18,
"id": "b2089850-5eb2-4be2-8a1f-398d8cea71c9",
"metadata": {},
"outputs": [],
"source": [
"@app.function()\n",
"def f(i):\n",
" if i % 2 == 0:\n",
" print(\"hello\", i)\n",
" else:\n",
" print(\"world\", i, file=sys.stderr)\n",
"\n",
" return i * i"
]
},
{
"cell_type": "code",
"execution_count": 19,
"id": "ec242385-7c8a-4732-ba45-487aeaa1571b",
"metadata": {},
"outputs": [],
"source": [
"@app.local_entrypoint()\n",
"def main():\n",
" # run the function locally\n",
" print(f.local(1000))\n",
"\n",
" # run the function remotely on Modal\n",
" print(f.remote(1000))\n",
"\n",
" # run the function in parallel and remotely on Modal\n",