You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 

1046 lines
63 KiB

{
"cells": [
{
"cell_type": "markdown",
"id": "d15d8294-3328-4e07-ad16-8a03e9bbfdb9",
"metadata": {},
"source": [
"# YOUR FIRST LAB\n",
"### Please read this section. This is valuable to get you prepared, even if it's a long read -- it's important stuff.\n",
"\n",
"## Your first Frontier LLM Project\n",
"\n",
"Let's build a useful LLM solution - in a matter of minutes.\n",
"\n",
"By the end of this course, you will have built an autonomous Agentic AI solution with 7 agents that collaborate to solve a business problem. All in good time! We will start with something smaller...\n",
"\n",
"Our goal is to code a new kind of Web Browser. Give it a URL, and it will respond with a summary. The Reader's Digest of the internet!!\n",
"\n",
"Before starting, you should have completed the setup for [PC](../SETUP-PC.md) or [Mac](../SETUP-mac.md) and you hopefully launched this jupyter lab from within the project root directory, with your environment activated.\n",
"\n",
"## If you're new to Jupyter Lab\n",
"\n",
"Welcome to the wonderful world of Data Science experimentation! Once you've used Jupyter Lab, you'll wonder how you ever lived without it. Simply click in each \"cell\" with code in it, such as the cell immediately below this text, and hit Shift+Return to execute that cell. As you wish, you can add a cell with the + button in the toolbar, and print values of variables, or try out variations. \n",
"\n",
"I've written a notebook called [Guide to Jupyter](Guide%20to%20Jupyter.ipynb) to help you get more familiar with Jupyter Labs, including adding Markdown comments, using `!` to run shell commands, and `tqdm` to show progress.\n",
"\n",
"## If you're new to the Command Line\n",
"\n",
"Please see these excellent guides: [Command line on PC](https://chatgpt.com/share/67b0acea-ba38-8012-9c34-7a2541052665) and [Command line on Mac](https://chatgpt.com/canvas/shared/67b0b10c93a081918210723867525d2b). \n",
"\n",
"## If you'd prefer to work in IDEs\n",
"\n",
"If you're more comfortable in IDEs like VSCode or Pycharm, they both work great with these lab notebooks too. \n",
"If you'd prefer to work in VSCode, [here](https://chatgpt.com/share/676f2e19-c228-8012-9911-6ca42f8ed766) are instructions from an AI friend on how to configure it for the course.\n",
"\n",
"## If you'd like to brush up your Python\n",
"\n",
"I've added a notebook called [Intermediate Python](Intermediate%20Python.ipynb) to get you up to speed. But you should give it a miss if you already have a good idea what this code does: \n",
"`yield from {book.get(\"author\") for book in books if book.get(\"author\")}`\n",
"\n",
"## I am here to help\n",
"\n",
"If you have any problems at all, please do reach out. \n",
"I'm available through the platform, or at ed@edwarddonner.com, or at https://www.linkedin.com/in/eddonner/ if you'd like to connect (and I love connecting!) \n",
"And this is new to me, but I'm also trying out X/Twitter at [@edwarddonner](https://x.com/edwarddonner) - if you're on X, please show me how it's done 😂 \n",
"\n",
"## More troubleshooting\n",
"\n",
"Please see the [troubleshooting](troubleshooting.ipynb) notebook in this folder to diagnose and fix common problems. At the very end of it is a diagnostics script with some useful debug info.\n",
"\n",
"## If this is old hat!\n",
"\n",
"If you're already comfortable with today's material, please hang in there; you can move swiftly through the first few labs - we will get much more in depth as the weeks progress.\n",
"\n",
"<table style=\"margin: 0; text-align: left;\">\n",
" <tr>\n",
" <td style=\"width: 150px; height: 150px; vertical-align: middle;\">\n",
" <img src=\"../important.jpg\" width=\"150\" height=\"150\" style=\"display: block;\" />\n",
" </td>\n",
" <td>\n",
" <h2 style=\"color:#900;\">Please read - important note</h2>\n",
" <span style=\"color:#900;\">The way I collaborate with you may be different to other courses you've taken. I prefer not to type code while you watch. Rather, I execute Jupyter Labs, like this, and give you an intuition for what's going on. My suggestion is that you carefully execute this yourself, <b>after</b> watching the lecture. Add print statements to understand what's going on, and then come up with your own variations. If you have a Github account, use this to showcase your variations. Not only is this essential practice, but it demonstrates your skills to others, including perhaps future clients or employers...</span>\n",
" </td>\n",
" </tr>\n",
"</table>\n",
"<table style=\"margin: 0; text-align: left;\">\n",
" <tr>\n",
" <td style=\"width: 150px; height: 150px; vertical-align: middle;\">\n",
" <img src=\"../resources.jpg\" width=\"150\" height=\"150\" style=\"display: block;\" />\n",
" </td>\n",
" <td>\n",
" <h2 style=\"color:#f71;\">Treat these labs as a resource</h2>\n",
" <span style=\"color:#f71;\">I push updates to the code regularly. When people ask questions or have problems, I incorporate it in the code, adding more examples or improved commentary. As a result, you'll notice that the code below isn't identical to the videos. Everything from the videos is here; but in addition, I've added more steps and better explanations, and occasionally added new models like DeepSeek. Consider this like an interactive book that accompanies the lectures.\n",
" </span>\n",
" </td>\n",
" </tr>\n",
"</table>\n",
"<table style=\"margin: 0; text-align: left;\">\n",
" <tr>\n",
" <td style=\"width: 150px; height: 150px; vertical-align: middle;\">\n",
" <img src=\"../business.jpg\" width=\"150\" height=\"150\" style=\"display: block;\" />\n",
" </td>\n",
" <td>\n",
" <h2 style=\"color:#181;\">Business value of these exercises</h2>\n",
" <span style=\"color:#181;\">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.</span>\n",
" </td>\n",
" </tr>\n",
"</table>"
]
},
{
"cell_type": "markdown",
"id": "0498de68-abeb-418b-865a-7c1877251ac6",
"metadata": {},
"source": [
"## Browser Summary"
]
},
{
"cell_type": "code",
"execution_count": 2,
"id": "4e2a9393-7767-488e-a8bf-27c12dca35bd",
"metadata": {},
"outputs": [],
"source": [
"# imports\n",
"\n",
"import os\n",
"import requests\n",
"from dotenv import load_dotenv\n",
"from bs4 import BeautifulSoup\n",
"from IPython.display import Markdown, display\n",
"from openai import OpenAI"
]
},
{
"cell_type": "markdown",
"id": "6900b2a8-6384-4316-8aaa-5e519fca4254",
"metadata": {},
"source": [
"# Connecting to OpenAI\n",
"\n",
"The next cell is where we load in the environment variables in your `.env` file and connect to OpenAI.\n",
"\n",
"## Troubleshooting if you have problems:\n",
"\n",
"Head over to the [troubleshooting](troubleshooting.ipynb) notebook in this folder for step by step code to identify the root cause and fix it!\n",
"\n",
"If you make a change, try restarting the \"Kernel\" (the python process sitting behind this notebook) by Kernel menu >> Restart Kernel and Clear Outputs of All Cells. Then try this notebook again, starting at the top.\n",
"\n",
"Or, contact me! Message me or email ed@edwarddonner.com and we will get this to work.\n",
"\n",
"Any concerns about API costs? See my notes in the README - costs should be minimal, and you can control it at every point. You can also use Ollama as a free alternative, which we discuss during Day 2."
]
},
{
"cell_type": "code",
"execution_count": 3,
"id": "7b87cadb-d513-4303-baee-a37b6f938e4d",
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"API key found and looks good so far!\n"
]
}
],
"source": [
"# Load environment variables in a file called .env\n",
"\n",
"load_dotenv(override=True)\n",
"api_key = os.getenv('OPENAI_API_KEY')\n",
"\n",
"# Check the key\n",
"\n",
"if not api_key:\n",
" print(\"No API key was found - please head over to the troubleshooting notebook in this folder to identify & fix!\")\n",
"elif not api_key.startswith(\"sk-proj-\"):\n",
" print(\"An API key was found, but it doesn't start sk-proj-; please check you're using the right key - see troubleshooting notebook\")\n",
"elif api_key.strip() != api_key:\n",
" print(\"An API key was found, but it looks like it might have space or tab characters at the start or end - please remove them - see troubleshooting notebook\")\n",
"else:\n",
" print(\"API key found and looks good so far!\")\n"
]
},
{
"cell_type": "code",
"execution_count": 4,
"id": "019974d9-f3ad-4a8a-b5f9-0a3719aea2d3",
"metadata": {},
"outputs": [],
"source": [
"openai = OpenAI()\n",
"\n",
"# If this doesn't work, try Kernel menu >> Restart Kernel and Clear Outputs Of All Cells, then run the cells from the top of this notebook down.\n",
"# If it STILL doesn't work (horrors!) then please see the Troubleshooting notebook in this folder for full instructions"
]
},
{
"cell_type": "markdown",
"id": "442fc84b-0815-4f40-99ab-d9a5da6bda91",
"metadata": {},
"source": [
"# Let's make a quick call to a Frontier model to get started, as a preview!"
]
},
{
"cell_type": "code",
"execution_count": 5,
"id": "a58394bf-1e45-46af-9bfd-01e24da6f49a",
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"Hello! It’s great to hear from you! How can I assist you today?\n"
]
}
],
"source": [
"# To give you a preview -- calling OpenAI with these messages is this easy. Any problems, head over to the Troubleshooting notebook.\n",
"\n",
"message = \"Hello, GPT! This is my first ever message to you! Hi!\"\n",
"response = openai.chat.completions.create(model=\"gpt-4o-mini\", messages=[{\"role\":\"user\", \"content\":message}])\n",
"print(response.choices[0].message.content)"
]
},
{
"cell_type": "markdown",
"id": "2aa190e5-cb31-456a-96cc-db109919cd78",
"metadata": {},
"source": [
"## OK onwards with our first project"
]
},
{
"cell_type": "code",
"execution_count": 8,
"id": "c5e793b2-6775-426a-a139-4848291d0463",
"metadata": {},
"outputs": [],
"source": [
"# A class to represent a Webpage\n",
"# If you're not familiar with Classes, check out the \"Intermediate Python\" notebook\n",
"\n",
"# Some websites need you to use proper headers when fetching them:\n",
"headers = {\n",
" \"User-Agent\": \"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/117.0.0.0 Safari/537.36\"\n",
"}\n",
"\n",
"class Website:\n",
"\n",
" def __init__(self, url):\n",
" \"\"\"\n",
" Create this Website object from the given url using the BeautifulSoup library\n",
" \"\"\"\n",
" self.url = url\n",
" response = requests.get(url, headers=headers)\n",
" soup = BeautifulSoup(response.content, 'html.parser')\n",
" self.title = soup.title.string if soup.title else \"No title found\"\n",
" for irrelevant in soup.body([\"script\", \"style\", \"img\", \"input\"]):\n",
" irrelevant.decompose()\n",
" self.text = soup.body.get_text(separator=\"\\n\", strip=True)"
]
},
{
"cell_type": "code",
"execution_count": 15,
"id": "2ef960cf-6dc2-4cda-afb3-b38be12f4c97",
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"Opening up the Design System for Everyone — The Federated Model | by Anirudh Ramamohan | Bootcamp | Medium\n",
"Open in app\n",
"Sign up\n",
"Sign in\n",
"Write\n",
"Sign up\n",
"Sign in\n",
"Bootcamp\n",
"·\n",
"From idea to product, one lesson at a time. To submit your story:\n",
"https://tinyurl.com/bootspub1\n",
"Opening up the Design System for Everyone — The Federated Model\n",
"Anirudh Ramamohan\n",
"·\n",
"Follow\n",
"Published in\n",
"Bootcamp\n",
"·\n",
"6 min read\n",
"·\n",
"Mar 21, 2023\n",
"--\n",
"Listen\n",
"Share\n",
"A dossier of how a federated design system worked at a super large tech company\n",
"Image credits: Evan Shoemaker\n",
"H\n",
"ere’s the deal - you can have a kick-ass design system that’s got all the bells and whistles, like a bunch of well-structured components, solid documentation, killer guidelines, and a well-thought-out design language. But, if a user can’t actually do what they need to do with it, the whole thing is gonna be useless. So, let’s make sure that our design system is not just pretty to look at but it’s also functional and user-friendly.\n",
"Wait! Before that, I said “federated” in the description of this article! Yes, I am going to talk about the process of opening up the design system for every designer in your organization!\n",
"PS: To know more about Federated teams,\n",
"read Nathan Curtis’s article on team modals\n",
".\n",
"So, you might be wondering, how can we get everyone involved in the design system?\n",
"Here’s the thing: the people who are actually using the system are creators too! If we introduce a model of governance and co-creation, we can make sure that everyone’s needs, concerns, and desires are taken into account from the get-go. That way, we can make a design system that works for everyone, and we can all be proud of what we create together!\n",
"Embracing an open design system culture\n",
"Some folks worry that a design system might limit their creative freedom, but it doesn’t have to be that way.\n",
"We can have both consistency and flexibility if we open up the design system for feedback, input, and exploration.\n",
"When everyone gets a say, it leads to better components and a real sense of ownership.\n",
"The only thing is, making changes to the design system can cause issues like discrepancies between files, outdated documentation, and extra work for developers. Plus, we need to make sure that any changes we make are actually beneficial for the teams we’re serving.\n",
"So, how do we avoid creating discrepancies while still giving designers and developers the power to make decisions on their own? It’s a tricky question, but one that we can figure out together!\n",
"Everyone can be an initiator of change.\n",
"Alright, let’s start by talking about the role of the design system team! One of our main jobs is to allow and orchestrate change, which is where governance comes in. We need to create a process that we can use over and over again, and we need the right tools to make decisions and move the design system forward.\n",
"The key is to make sure that everyone is playing by the same rules.\n",
"So, the first step is to agree on the defined components and patterns that are part of the design system and make sure that the Figma library matches the Git Repository to avoid any discrepancies. We used Figma as the Definition of Ready document for development to keep things on track.\n",
"Now, if someone encounters an issue where the components aren’t solving a new use case, they can challenge the status quo.\n",
"It doesn’t matter if they’re a designer, developer, or content designer — we encourage everyone to question whether something is working or not. Then, we work with the initiator to figure out if the new proposal applies to other use cases involving the same component. That way, we can make sure that everyone’s needs are met and we can keep moving forward!\n",
"If you're looking for governance guidelines on Design Systems, then I have detailed them in a different article here.\n",
"The consolidation process\n",
"A weekly session for designers to collaborate better\n",
"If you were a designer in my company working on focused product segments, then I would advise you to present in one of the ‘UX Friday’ sessions, or you could just use the following steps to collaborate with the design system team to co-create.\n",
"3 Simple steps to make this happen:\n",
"One of the main goals of the design system team is for every designer to feel empowered to take the initiative and suggest enhancements\n",
"to existing components or propose new ones that will solve issues that the design system doesn’t currently address. Don’t be afraid to speak up!\n",
"1. Prepare a component case:\n",
"Prepare your case in the Figma playground file. It’s a template that contains all sorts of helpful tools to share your proposal with the team. The playground file will ideally include :\n",
"A checklist to help you document your solution:\n",
"This will help you explain how your proposed improvement solves the issue. If you’re improving an existing component, can you explain how it’s still usable for its initial use cases?\n",
"A checklist to help you ensure you’re applying the design system’s foundation and guidelines correctly:\n",
"You want to make sure that your proposed change won’t negatively affect anything else in the system.\n",
"A space to provide the full context of the issue:\n",
"This will help the team understand the problem better and see if other participants have experienced similar issues.\n",
"A space to show research results:\n",
"If you have user research or examples of other design systems that handle similar issues well, this is the place to share them.\n",
"I\n",
"have written a detailed article around “Vetting components for design system” which can provide more insights on this topic.\n",
"2. Present on a\n",
"consolidation call\n",
":\n",
"Next, present your\n",
"component case\n",
"with the Figma playground file in an open forum setting that occurs weekly or biweekly.\n",
"Anyone can join and participate, regardless of their discipline.\n",
"During the consolidation call, we’ll critique the proposal from multiple angles to strengthen the applicability of the component.\n",
"We’ll gather examples of how we currently use the component and play around with the new proposal within our use cases.\n",
"The consolidation call includes multiple participants, including at least one developer, and we may even invite participants from other disciplines, like a copywriter.\n",
"By identifying every application of the component in these use cases, we can redefine the components’ usage in the Figma playground file.\n",
"Once the consolidation has proven successful, you can implement the change by renewing the components page in Figma.\n",
"3. The Final Step:\n",
"The final step is to get assistance from a designer on the design system team or hand the component entirely over to the DS team to add a few more details to the Figma playground file, including the naming of the component, a user story, types, states, and options defined, tokens or variables defined, breakpoint behavior, and more.\n",
"In short, the consolidation process is all about empowering everyone to suggest changes, gather feedback, and arrive at a solution that works for everyone.\n",
"Don’t forget to push your PMs\n",
"When a changed component is encountered, the PM in charge of that area and will include it in your sprint planning. Usually, the feature team of the person who initiated the change will be the one to work on it. Finally, we make sure to communicate these changes to the business and update any relevant documents.\n",
"Conclusion\n",
"By establishing a clear and easy-to-follow process for proposing and implementing changes to the design system, everyone has an opportunity to share their ideas and contribute to its evolution. The “Figma playground file” is a valuable tool that enables team members to articulate their proposals in a clear and structured way, making it easier for the design system team to assess the impact of proposed changes and ensure they align with the design system’s core values and principles.\n",
"One of the most enjoyable aspects of this process is the collaboration between designers from different disciplines during the consolidation process. This creates a greater understanding and appreciation of each other’s roles and expertise, which helps to build trust and foster a culture of collaboration.\n",
"Ultimately, this process aligns with the core values of the design system, which are collaboration, clarity, and trust. By embracing these values and working together, we can create a design system that is both functional and sustainable and that meets the needs of all stakeholders.\n",
"Let me know your thoughts…\n",
"— — —\n",
"Thanks for reading! If you found it helpful, please share it with your friends and colleagues. If you enjoyed this post, consider\n",
"following me\n",
", and this will inspire me to write more!\n",
"You can also\n",
"subscribe here\n",
"to get new articles delivered right to your inbox! Or, if you would like to pick my brain on any design topic,\n",
"block a slot with me!\n",
"Design Systems\n",
"Leadership\n",
"UX\n",
"--\n",
"--\n",
"Published in\n",
"Bootcamp\n",
"79K Followers\n",
"·\n",
"Last published\n",
"6 hours ago\n",
"From idea to product, one lesson at a time. To submit your story:\n",
"https://tinyurl.com/bootspub1\n",
"Follow\n",
"Written by\n",
"Anirudh Ramamohan\n",
"106 Followers\n",
"·\n",
"38 Following\n",
"Based in Barcelona, I either turn messy ideas into beautiful products or post blogs on them!\n",
"Follow\n",
"No responses yet\n",
"Help\n",
"Status\n",
"About\n",
"Careers\n",
"Press\n",
"Blog\n",
"Privacy\n",
"Rules\n",
"Terms\n",
"Text to speech\n"
]
}
],
"source": [
"# Let's try one out. Change the website and add print statements to follow along.\n",
"\n",
"omar = Website(\"https://medium.com/design-bootcamp/opening-up-the-design-system-for-everyone-11b9b92f3f75\")\n",
"print(omar.title)\n",
"print(omar.text)"
]
},
{
"cell_type": "markdown",
"id": "6a478a0c-2c53-48ff-869c-4d08199931e1",
"metadata": {},
"source": [
"## Types of prompts\n",
"\n",
"You may know this already - but if not, you will get very familiar with it!\n",
"\n",
"Models like GPT4o have been trained to receive instructions in a particular way.\n",
"\n",
"They expect to receive:\n",
"\n",
"**A system prompt** that tells them what task they are performing and what tone they should use\n",
"\n",
"**A user prompt** -- the conversation starter that they should reply to"
]
},
{
"cell_type": "code",
"execution_count": 17,
"id": "abdb8417-c5dc-44bc-9bee-2e059d162699",
"metadata": {},
"outputs": [],
"source": [
"# Define our system prompt - you can experiment with this later, changing the last sentence to 'Respond in markdown in Spanish.\"\n",
"\n",
"system_prompt = \"You are an assistant that analyzes the contents of a website \\\n",
"and provides a short summary, ignoring text that might be navigation related. \\\n",
"Respond in markdown.\""
]
},
{
"cell_type": "code",
"execution_count": 18,
"id": "f0275b1b-7cfe-4f9d-abfa-7650d378da0c",
"metadata": {},
"outputs": [],
"source": [
"# A function that writes a User Prompt that asks for summaries of websites:\n",
"\n",
"def user_prompt_for(website):\n",
" user_prompt = f\"You are looking at a website titled {website.title}\"\n",
" user_prompt += \"\\nThe contents of this website is as follows; \\\n",
"please provide a short summary of this website in markdown. \\\n",
"If it includes news or announcements, then summarize these too.\\n\\n\"\n",
" user_prompt += website.text\n",
" return user_prompt"
]
},
{
"cell_type": "code",
"execution_count": 19,
"id": "26448ec4-5c00-4204-baec-7df91d11ff2e",
"metadata": {},
"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",
"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",
"April 21, 2025\n",
"The Complete Agentic AI Engineering Course\n",
"January 23, 2025\n",
"LLM Workshop – Hands-on with Agents – resources\n",
"December 21, 2024\n",
"Welcome, SuperDataScientists!\n",
"November 13, 2024\n",
"Mastering AI and LLM Engineering – Resources\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"
]
}
],
"source": [
"print(user_prompt_for(ed))"
]
},
{
"cell_type": "markdown",
"id": "ea211b5f-28e1-4a86-8e52-c0b7677cadcc",
"metadata": {},
"source": [
"## Messages\n",
"\n",
"The API from OpenAI expects to receive messages in a particular structure.\n",
"Many of the other APIs share this structure:\n",
"\n",
"```\n",
"[\n",
" {\"role\": \"system\", \"content\": \"system message goes here\"},\n",
" {\"role\": \"user\", \"content\": \"user message goes here\"}\n",
"]\n",
"\n",
"To give you a preview, the next 2 cells make a rather simple call - we won't stretch the mighty GPT (yet!)"
]
},
{
"cell_type": "code",
"execution_count": 20,
"id": "f25dcd35-0cd0-4235-9f64-ac37ed9eaaa5",
"metadata": {},
"outputs": [],
"source": [
"messages = [\n",
" {\"role\": \"system\", \"content\": \"You are a snarky assistant\"},\n",
" {\"role\": \"user\", \"content\": \"What is 2 + 2?\"}\n",
"]"
]
},
{
"cell_type": "code",
"execution_count": 21,
"id": "21ed95c5-7001-47de-a36d-1d6673b403ce",
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"Oh, let me grab my calculator for this one—just kidding! It’s 4. Did you need something more challenging?\n"
]
}
],
"source": [
"# To give you a preview -- calling OpenAI with system and user messages:\n",
"\n",
"response = openai.chat.completions.create(model=\"gpt-4o-mini\", messages=messages)\n",
"print(response.choices[0].message.content)"
]
},
{
"cell_type": "markdown",
"id": "d06e8d78-ce4c-4b05-aa8e-17050c82bb47",
"metadata": {},
"source": [
"## And now let's build useful messages for GPT-4o-mini, using a function"
]
},
{
"cell_type": "code",
"execution_count": 22,
"id": "0134dfa4-8299-48b5-b444-f2a8c3403c88",
"metadata": {},
"outputs": [],
"source": [
"# See how this function creates exactly the format above\n",
"\n",
"def messages_for(website):\n",
" return [\n",
" {\"role\": \"system\", \"content\": system_prompt},\n",
" {\"role\": \"user\", \"content\": user_prompt_for(website)}\n",
" ]"
]
},
{
"cell_type": "code",
"execution_count": 24,
"id": "36478464-39ee-485c-9f3f-6a4e458dbc9c",
"metadata": {},
"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 Opening up the Design System for Everyone — The Federated Model | by Anirudh Ramamohan | Bootcamp | Medium\\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\\nOpen in app\\nSign up\\nSign in\\nWrite\\nSign up\\nSign in\\nBootcamp\\n·\\nFrom idea to product, one lesson at a time. To submit your story:\\nhttps://tinyurl.com/bootspub1\\nOpening up the Design System for Everyone — The Federated Model\\nAnirudh Ramamohan\\n·\\nFollow\\nPublished in\\nBootcamp\\n·\\n6 min read\\n·\\nMar 21, 2023\\n--\\nListen\\nShare\\nA dossier of how a federated design system worked at a super large tech company\\nImage credits: Evan Shoemaker\\nH\\nere’s the deal - you can have a kick-ass design system that’s got all the bells and whistles, like a bunch of well-structured components, solid documentation, killer guidelines, and a well-thought-out design language. But, if a user can’t actually do what they need to do with it, the whole thing is gonna be useless. So, let’s make sure that our design system is not just pretty to look at but it’s also functional and user-friendly.\\nWait! Before that, I said “federated” in the description of this article! Yes, I am going to talk about the process of opening up the design system for every designer in your organization!\\nPS: To know more about Federated teams,\\nread Nathan Curtis’s article on team modals\\n.\\nSo, you might be wondering, how can we get everyone involved in the design system?\\nHere’s the thing: the people who are actually using the system are creators too! If we introduce a model of governance and co-creation, we can make sure that everyone’s needs, concerns, and desires are taken into account from the get-go. That way, we can make a design system that works for everyone, and we can all be proud of what we create together!\\nEmbracing an open design system culture\\nSome folks worry that a design system might limit their creative freedom, but it doesn’t have to be that way.\\nWe can have both consistency and flexibility if we open up the design system for feedback, input, and exploration.\\nWhen everyone gets a say, it leads to better components and a real sense of ownership.\\nThe only thing is, making changes to the design system can cause issues like discrepancies between files, outdated documentation, and extra work for developers. Plus, we need to make sure that any changes we make are actually beneficial for the teams we’re serving.\\nSo, how do we avoid creating discrepancies while still giving designers and developers the power to make decisions on their own? It’s a tricky question, but one that we can figure out together!\\nEveryone can be an initiator of change.\\nAlright, let’s start by talking about the role of the design system team! One of our main jobs is to allow and orchestrate change, which is where governance comes in. We need to create a process that we can use over and over again, and we need the right tools to make decisions and move the design system forward.\\nThe key is to make sure that everyone is playing by the same rules.\\nSo, the first step is to agree on the defined components and patterns that are part of the design system and make sure that the Figma library matches the Git Repository to avoid any discrepancies. We used Figma as the Definition of Ready document for development to keep things on track.\\nNow, if someone encounters an issue where the components aren’t solving a new use case, they can challenge the status quo.\\nIt doesn’t matter if they’re a designer, developer, or content designer — we encourage everyone to question whether something is working or not. Then, we work with the initiator to figure out if the new proposal applies to other use cases involving the same component. That way, we can make sure that everyone’s needs are met and we can keep moving forward!\\nIf you're looking for governance guidelines on Design Systems, then I have detailed them in a different article here.\\nThe consolidation process\\nA weekly session for designers to collaborate better\\nIf you were a designer in my company working on focused product segments, then I would advise you to present in one of the ‘UX Friday’ sessions, or you could just use the following steps to collaborate with the design system team to co-create.\\n3 Simple steps to make this happen:\\nOne of the main goals of the design system team is for every designer to feel empowered to take the initiative and suggest enhancements\\nto existing components or propose new ones that will solve issues that the design system doesn’t currently address. Don’t be afraid to speak up!\\n1. Prepare a component case:\\nPrepare your case in the Figma playground file. It’s a template that contains all sorts of helpful tools to share your proposal with the team. The playground file will ideally include :\\nA checklist to help you document your solution:\\nThis will help you explain how your proposed improvement solves the issue. If you’re improving an existing component, can you explain how it’s still usable for its initial use cases?\\nA checklist to help you ensure you’re applying the design system’s foundation and guidelines correctly:\\nYou want to make sure that your proposed change won’t negatively affect anything else in the system.\\nA space to provide the full context of the issue:\\nThis will help the team understand the problem better and see if other participants have experienced similar issues.\\nA space to show research results:\\nIf you have user research or examples of other design systems that handle similar issues well, this is the place to share them.\\nI\\nhave written a detailed article around “Vetting components for design system” which can provide more insights on this topic.\\n2. Present on a\\nconsolidation call\\n:\\nNext, present your\\ncomponent case\\nwith the Figma playground file in an open forum setting that occurs weekly or biweekly.\\nAnyone can join and participate, regardless of their discipline.\\nDuring the consolidation call, we’ll critique the proposal from multiple angles to strengthen the applicability of the component.\\nWe’ll gather examples of how we currently use the component and play around with the new proposal within our use cases.\\nThe consolidation call includes multiple participants, including at least one developer, and we may even invite participants from other disciplines, like a copywriter.\\nBy identifying every application of the component in these use cases, we can redefine the components’ usage in the Figma playground file.\\nOnce the consolidation has proven successful, you can implement the change by renewing the components page in Figma.\\n3. The Final Step:\\nThe final step is to get assistance from a designer on the design system team or hand the component entirely over to the DS team to add a few more details to the Figma playground file, including the naming of the component, a user story, types, states, and options defined, tokens or variables defined, breakpoint behavior, and more.\\nIn short, the consolidation process is all about empowering everyone to suggest changes, gather feedback, and arrive at a solution that works for everyone.\\nDon’t forget to push your PMs\\nWhen a changed component is encountered, the PM in charge of that area and will include it in your sprint planning. Usually, the feature team of the person who initiated the change will be the one to work on it. Finally, we make sure to communicate these changes to the business and update any relevant documents.\\nConclusion\\nBy establishing a clear and easy-to-follow process for proposing and implementing changes to the design system, everyone has an opportunity to share their ideas and contribute to its evolution. The “Figma playground file” is a valuable tool that enables team members to articulate their proposals in a clear and structured way, making it easier for the design system team to assess the impact of proposed changes and ensure they align with the design system’s core values and principles.\\nOne of the most enjoyable aspects of this process is the collaboration between designers from different disciplines during the consolidation process. This creates a greater understanding and appreciation of each other’s roles and expertise, which helps to build trust and foster a culture of collaboration.\\nUltimately, this process aligns with the core values of the design system, which are collaboration, clarity, and trust. By embracing these values and working together, we can create a design system that is both functional and sustainable and that meets the needs of all stakeholders.\\nLet me know your thoughts…\\n— — —\\nThanks for reading! If you found it helpful, please share it with your friends and colleagues. If you enjoyed this post, consider\\nfollowing me\\n, and this will inspire me to write more!\\nYou can also\\nsubscribe here\\nto get new articles delivered right to your inbox! Or, if you would like to pick my brain on any design topic,\\nblock a slot with me!\\nDesign Systems\\nLeadership\\nUX\\n--\\n--\\nPublished in\\nBootcamp\\n79K Followers\\n·\\nLast published\\n6 hours ago\\nFrom idea to product, one lesson at a time. To submit your story:\\nhttps://tinyurl.com/bootspub1\\nFollow\\nWritten by\\nAnirudh Ramamohan\\n106 Followers\\n·\\n38 Following\\nBased in Barcelona, I either turn messy ideas into beautiful products or post blogs on them!\\nFollow\\nNo responses yet\\nHelp\\nStatus\\nAbout\\nCareers\\nPress\\nBlog\\nPrivacy\\nRules\\nTerms\\nText to speech\"}]"
]
},
"execution_count": 24,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"# Try this out, and then try for a few more websites\n",
"\n",
"messages_for(omar)"
]
},
{
"cell_type": "markdown",
"id": "16f49d46-bf55-4c3e-928f-68fc0bf715b0",
"metadata": {},
"source": [
"## Time to bring it together - the API for OpenAI is very simple!"
]
},
{
"cell_type": "code",
"execution_count": 25,
"id": "905b9919-aba7-45b5-ae65-81b3d1d78e34",
"metadata": {},
"outputs": [],
"source": [
"# And now: call the OpenAI API. You will get very familiar with this!\n",
"\n",
"def summarize(url):\n",
" website = Website(url)\n",
" response = openai.chat.completions.create(\n",
" model = \"gpt-4o-mini\",\n",
" messages = messages_for(website)\n",
" )\n",
" return response.choices[0].message.content"
]
},
{
"cell_type": "code",
"execution_count": 26,
"id": "05e38d41-dfa4-4b20-9c96-c46ea75d9fb5",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"'# Summary of \"Opening up the Design System for Everyone — The Federated Model\"\\n\\nIn this article published by Anirudh Ramamohan on Medium, the author explores the concept of a federated design system within a large tech company. The key focus is on the importance of involving all users—designers, developers, and content creators—in the design system to enhance its functionality and user-friendliness.\\n\\n## Main Points:\\n- **Federated Model**: Emphasizes collaborative governance and co-creation, allowing stakeholders to voice their needs to build a design system that serves everyone.\\n- **Empowerment**: Encouragement for designers to actively suggest enhancements or new components, fostering a culture of ownership and responsibility.\\n- **Collaboration Process**:\\n 1. **Component Case Preparation**: Designers should document their proposals using a designated Figma playground file which includes checklists for compliance with existing guidelines and context for the proposed changes.\\n 2. **Consolidation Calls**: Weekly discussions where proposals are critiqued and refined by multi-disciplinary teams, including developers and content designers.\\n 3. **Implementation**: Finalizing changes with help from the design system team and ensuring proper communication and documentation.\\n\\n## Conclusion:\\nThe article wraps up by highlighting the significance of a clear process for suggesting and implementing changes, which fosters collaboration, clarity, and trust among team members. This approach aims to create a dynamic and effective design system that meets the diverse needs of its users. \\n\\nOverall, the article serves as a practical guide for companies looking to implement a federated model for their design systems, promoting a collaborative and inclusive culture.'"
]
},
"execution_count": 26,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"summarize(\"https://medium.com/design-bootcamp/opening-up-the-design-system-for-everyone-11b9b92f3f75\")"
]
},
{
"cell_type": "code",
"execution_count": 27,
"id": "3d926d59-450e-4609-92ba-2d6f244f1342",
"metadata": {},
"outputs": [],
"source": [
"# A function to display this nicely in the Jupyter output, using markdown\n",
"\n",
"def display_summary(url):\n",
" summary = summarize(url)\n",
" display(Markdown(summary))"
]
},
{
"cell_type": "code",
"execution_count": 29,
"id": "3018853a-445f-41ff-9560-d925d1774b2f",
"metadata": {},
"outputs": [
{
"data": {
"text/markdown": [
"# Summary of \"Opening up the Design System for Everyone — The Federated Model\"\n",
"\n",
"In this article, Anirudh Ramamohan explores the concept of a federated design system within a large tech company. The key focus is on the necessity for design systems to be user-friendly and functional, rather than merely aesthetically pleasing. \n",
"\n",
"### Key Points:\n",
"- **User Involvement**: The article emphasizes the importance of including all users—designers, developers, and content creators—in the design system’s development through governance and co-creation models.\n",
"- **Open Feedback Culture**: To facilitate flexibility and creativity, the design system should welcome feedback and allow users to suggest enhancements. This leads to better components and a sense of ownership.\n",
"- **Collaboration Process**: The author outlines a structured process for designers to propose changes:\n",
" 1. **Prepare a Component Case**: Use a template in the Figma playground to document solutions, ensuring adherence to design principles.\n",
" 2. **Present on a Consolidation Call**: Regularly scheduled open forums allow for collaborative critiques and refinements of proposals.\n",
" 3. **Final Implementation**: Collaborate with design system team members to finalize and implement changes in the design system.\n",
"\n",
"### Conclusion\n",
"The integration of collaboration, clarity, and trust into the design system’s evolution is crucial for developing a system that meets the diverse needs of its users. By establishing clear processes, users can freely propose ideas that contribute to the system's growth.\n",
"\n",
"This article serves as a comprehensive guide for organizations aiming to democratize their design systems while maintaining quality and fostering a collaborative culture."
],
"text/plain": [
"<IPython.core.display.Markdown object>"
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"display_summary(\"https://medium.com/design-bootcamp/opening-up-the-design-system-for-everyone-11b9b92f3f75\")"
]
},
{
"cell_type": "markdown",
"id": "b3bcf6f4-adce-45e9-97ad-d9a5d7a3a624",
"metadata": {},
"source": [
"# Let's try more websites\n",
"\n",
"Note that this will only work on websites that can be scraped using this simplistic approach.\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. You'll need to read up on installing Selenium (ask ChatGPT!)\n",
"\n",
"Also Websites protected with CloudFront (and similar) may give 403 errors - many thanks Andy J for pointing this out.\n",
"\n",
"But many websites will work just fine!"
]
},
{
"cell_type": "code",
"execution_count": 30,
"id": "45d83403-a24c-44b5-84ac-961449b4008f",
"metadata": {},
"outputs": [
{
"data": {
"text/markdown": [
"# CNN Website Summary\n",
"\n",
"CNN is a prominent news website that provides the latest news, features, and videos across various categories, including US news, world events, politics, business, health, entertainment, and science.\n",
"\n",
"## Current Key Events\n",
"- **Pope Francis' Death**: The site features extensive coverage of the death of Pope Francis at the age of 88. Highlights include:\n",
" - Reactions from world leaders such as Barack Obama, Joe Biden, and Hillary Clinton.\n",
" - Details surrounding his final days and the significance of his papacy.\n",
" - Anticipated proceedings regarding his funeral and the selection of a new pope.\n",
"\n",
"## Additional News\n",
"- Coverage of global conflicts, including the ongoing Ukraine-Russia war and the Israel-Hamas situation.\n",
"- Updates on significant global incidents, such as DHL suspending shipments and new developments in trade relations involving the US and China.\n",
"\n",
"The website emphasizes real-time updates and in-depth analysis of pressing global matters while allowing users to access live broadcasts, articles, and video content."
],
"text/plain": [
"<IPython.core.display.Markdown object>"
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"display_summary(\"https://cnn.com\")"
]
},
{
"cell_type": "code",
"execution_count": 31,
"id": "75e9fd40-b354-4341-991e-863ef2e59db7",
"metadata": {},
"outputs": [
{
"data": {
"text/markdown": [
"# Summary of \"Just a moment...\"\n",
"\n",
"The website displays a message indicating that users need to enable JavaScript and cookies in their web browsers to continue accessing content. There are no specific news or announcements provided. \n",
"\n",
"The site appears to be experiencing a temporary loading issue or is in the process of verifying user settings before granting access to additional content."
],
"text/plain": [
"<IPython.core.display.Markdown object>"
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"display_summary(\"https://anthropic.com\")"
]
},
{
"cell_type": "markdown",
"id": "c951be1a-7f1b-448f-af1f-845978e47e2c",
"metadata": {},
"source": [
"<table style=\"margin: 0; text-align: left;\">\n",
" <tr>\n",
" <td style=\"width: 150px; height: 150px; vertical-align: middle;\">\n",
" <img src=\"../business.jpg\" width=\"150\" height=\"150\" style=\"display: block;\" />\n",
" </td>\n",
" <td>\n",
" <h2 style=\"color:#181;\">Business applications</h2>\n",
" <span style=\"color:#181;\">In this exercise, you experienced calling the Cloud API of a Frontier Model (a leading model at the frontier of AI) for the first time. We will be using APIs like OpenAI at many stages in the course, in addition to building our own LLMs.\n",
"\n",
"More specifically, we've applied this to Summarization - a classic Gen AI use case to make a summary. This can be applied to any business vertical - summarizing the news, summarizing financial performance, summarizing a resume in a cover letter - the applications are limitless. Consider how you could apply Summarization in your business, and try prototyping a solution.</span>\n",
" </td>\n",
" </tr>\n",
"</table>\n",
"\n",
"<table style=\"margin: 0; text-align: left;\">\n",
" <tr>\n",
" <td style=\"width: 150px; height: 150px; vertical-align: middle;\">\n",
" <img src=\"../important.jpg\" width=\"150\" height=\"150\" style=\"display: block;\" />\n",
" </td>\n",
" <td>\n",
" <h2 style=\"color:#900;\">Before you continue - now try yourself</h2>\n",
" <span style=\"color:#900;\">Use the cell below to make your own simple commercial example. Stick with the summarization use case for now. Here's an idea: write something that will take the contents of an email, and will suggest an appropriate short subject line for the email. That's the kind of feature that might be built into a commercial email tool.</span>\n",
" </td>\n",
" </tr>\n",
"</table>"
]
},
{
"cell_type": "code",
"execution_count": 32,
"id": "00743dac-0e70-45b7-879a-d7293a6f68a6",
"metadata": {
"editable": true,
"slideshow": {
"slide_type": ""
},
"tags": []
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"# Research Paper Summary\n",
"\n",
"**Title:** [A Comprehensive Study of Few-Shot Learning Based Mini-Max Optimization for Reinforcement Learning](https://arxiv.org/pdf/2407.10671)\n",
"\n",
"## Key Points\n",
"\n",
"1. **Introduction to Few-Shot Learning in RL**:\n",
" - The paper addresses the challenge of effective learning in environments where data is scarce. \n",
" - It integrates few-shot learning (FSL) techniques into reinforcement learning (RL) frameworks to enhance adaptability and performance in new tasks with limited examples.\n",
"\n",
"2. **Mini-Max Optimization Approach**:\n",
" - Utilizes a mini-max optimization strategy that leverages the benefits of game-theoretical principles to improve learning efficiency.\n",
" - Proposes a unique optimizer that minimizes the learning error while considering the worst-case scenarios presented in few-shot environments.\n",
"\n",
"3. **Methodology**:\n",
" - Introduces a model architecture designed to facilitate few-shot learning within RL.\n",
" - Explains the implementation details and the training process adapted to incorporate few-shot scenarios.\n",
"\n",
"4. **Experimental Setup**:\n",
" - The paper conducts experiments on benchmark RL environments along with simulation tasks to evaluate the proposed algorithm's effectiveness.\n",
" - Compares performance against traditional RL methods and standard few-shot learning frameworks.\n",
"\n",
"5. **Results and Analysis**:\n",
" - Empirical results indicate significant improvements in learning speed and adaptability in novel tasks with limited data.\n",
" - Provides statistical analysis validating the superiority of the proposed method over existing methodologies in similar contexts.\n",
"\n",
"6. **Conclusion and Future Work**:\n",
" - The authors suggest that integrating few-shot learning into RL effectively addresses data limitations and enhances performance.\n",
" - They propose future research directions including the exploration of deeper integration techniques and broader applicability across various RL problems.\n",
"\n",
"## Impact on the Research Community\n",
"\n",
"- The paper contributes to ongoing discussions about improving the efficiency of learning models in environments with limited data.\n",
"- It opens avenues for further exploration of combining game theory with machine learning principles, providing a rich field for cross-disciplinary research.\n",
"\n",
"## Evaluation\n",
"\n",
"This paper is worth attention due to its innovative approach to a pressing issue in the field of reinforcement learning. The integration of few-shot learning with mini-max optimization is a valuable intersection that can serve both as a basis for future research and practical applications in scenarios where data acquisition is expensive or impractical.\n",
"\n",
"## Ideas for Further Research\n",
"\n",
"Following the themes of the original paper, you could explore:\n",
"\n",
"1. **Transfer Learning Techniques in Few-Shot RL**:\n",
" - Investigate how transfer learning can be optimized alongside the mini-max approach to further improve learning efficiency in fewer trials.\n",
"\n",
"2. **Multi-Agent RL with Few-Shot Learning**:\n",
" - Analyze how few-shot learning can be applied in a multi-agent setting, focusing on cooperation and competition dynamics among agents with limited interaction experiences.\n",
"\n",
"3. **Real-World Application Scenarios**:\n",
" - Propose a study that examines specific real-world applications where few-shot learning in RL could be utilized, such as robotics in dynamic environments or personalized learning systems.\n",
"\n",
"4. **Hybrid Models Incorporating Uncertainty**:\n",
" - Explore the integration of uncertainty quantification methods in few-shot learning for RL to enhance robustness and adaptability to unforeseen variations.\n",
"\n",
"By pursuing these ideas, you can establish a unique contribution to the methodologies surrounding few-shot learning in reinforcement learning, providing fresh perspectives to the research community.\n",
"# Research Paper Summary\n",
"\n",
"**Title:** [A Comprehensive Study of Few-Shot Learning Based Mini-Max Optimization for Reinforcement Learning](https://arxiv.org/pdf/2407.10671)\n",
"\n",
"## Key Points\n",
"\n",
"1. **Introduction to Few-Shot Learning in RL**:\n",
" - The paper addresses the challenge of effective learning in environments where data is scarce. \n",
" - It integrates few-shot learning (FSL) techniques into reinforcement learning (RL) frameworks to enhance adaptability and performance in new tasks with limited examples.\n",
"\n",
"2. **Mini-Max Optimization Approach**:\n",
" - Utilizes a mini-max optimization strategy that leverages the benefits of game-theoretical principles to improve learning efficiency.\n",
" - Proposes a unique optimizer that minimizes the learning error while considering the worst-case scenarios presented in few-shot environments.\n",
"\n",
"3. **Methodology**:\n",
" - Introduces a model architecture designed to facilitate few-shot learning within RL.\n",
" - Explains the implementation details and the training process adapted to incorporate few-shot scenarios.\n",
"\n",
"4. **Experimental Setup**:\n",
" - The paper conducts experiments on benchmark RL environments along with simulation tasks to evaluate the proposed algorithm's effectiveness.\n",
" - Compares performance against traditional RL methods and standard few-shot learning frameworks.\n",
"\n",
"5. **Results and Analysis**:\n",
" - Empirical results indicate significant improvements in learning speed and adaptability in novel tasks with limited data.\n",
" - Provides statistical analysis validating the superiority of the proposed method over existing methodologies in similar contexts.\n",
"\n",
"6. **Conclusion and Future Work**:\n",
" - The authors suggest that integrating few-shot learning into RL effectively addresses data limitations and enhances performance.\n",
" - They propose future research directions including the exploration of deeper integration techniques and broader applicability across various RL problems.\n",
"\n",
"## Impact on the Research Community\n",
"\n",
"- The paper contributes to ongoing discussions about improving the efficiency of learning models in environments with limited data.\n",
"- It opens avenues for further exploration of combining game theory with machine learning principles, providing a rich field for cross-disciplinary research.\n",
"\n",
"## Evaluation\n",
"\n",
"This paper is worth attention due to its innovative approach to a pressing issue in the field of reinforcement learning. The integration of few-shot learning with mini-max optimization is a valuable intersection that can serve both as a basis for future research and practical applications in scenarios where data acquisition is expensive or impractical.\n",
"\n",
"## Ideas for Further Research\n",
"\n",
"Following the themes of the original paper, you could explore:\n",
"\n",
"1. **Transfer Learning Techniques in Few-Shot RL**:\n",
" - Investigate how transfer learning can be optimized alongside the mini-max approach to further improve learning efficiency in fewer trials.\n",
"\n",
"2. **Multi-Agent RL with Few-Shot Learning**:\n",
" - Analyze how few-shot learning can be applied in a multi-agent setting, focusing on cooperation and competition dynamics among agents with limited interaction experiences.\n",
"\n",
"3. **Real-World Application Scenarios**:\n",
" - Propose a study that examines specific real-world applications where few-shot learning in RL could be utilized, such as robotics in dynamic environments or personalized learning systems.\n",
"\n",
"4. **Hybrid Models Incorporating Uncertainty**:\n",
" - Explore the integration of uncertainty quantification methods in few-shot learning for RL to enhance robustness and adaptability to unforeseen variations.\n",
"\n",
"By pursuing these ideas, you can establish a unique contribution to the methodologies surrounding few-shot learning in reinforcement learning, providing fresh perspectives to the research community.\n"
]
}
],
"source": [
"# Step 1: Create your prompts\n",
"\n",
"system_prompt = \"You are a reasearcher expert assistant, I will provide you a research paper url in domains like machine learning, AI or data science \\\n",
"and you summarize the key points in that paper and its impact on the research community and after summarization come up with an evaluation if it is worth it \\\n",
"and come up with ideas of another research paper that I can come up with start writing relative to this paper but the paper does not cover even if it is minor.\\\n",
"response in markdowns.\"\n",
"user_prompt = \"\"\"\n",
" Summarize for me this research paper website https://arxiv.org/pdf/2407.10671\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",
"\n",
"# Step 3: Call OpenAI\n",
"response = openai.chat.completions.create(model=\"gpt-4o-mini\", messages=messages)\n",
"print(response.choices[0].message.content)\n",
"\n",
"# Step 4: print the result\n",
"print(response.choices[0].message.content)"
]
},
{
"cell_type": "markdown",
"id": "36ed9f14-b349-40e9-a42c-b367e77f8bda",
"metadata": {},
"source": [
"## An extra exercise for those who enjoy web scraping\n",
"\n",
"You may notice that if you try `display_summary(\"https://openai.com\")` - it doesn't work! That's because OpenAI has a fancy website that uses Javascript. There are many ways around this that some of you might be familiar with. For example, Selenium is a hugely popular framework that runs a browser behind the scenes, renders the page, and allows you to query it. If you have experience with Selenium, Playwright or similar, then feel free to improve the Website class to use them. In the community-contributions folder, you'll find an example Selenium solution from a student (thank you!)"
]
},
{
"cell_type": "markdown",
"id": "eeab24dc-5f90-4570-b542-b0585aca3eb6",
"metadata": {
"editable": true,
"slideshow": {
"slide_type": ""
},
"tags": []
},
"source": [
"# Sharing your code\n",
"\n",
"I'd love it if you share your code afterwards so I can share it with others! You'll notice that some students have already made changes (including a Selenium implementation) which you will find in the community-contributions folder. If you'd like add your changes to that folder, submit a Pull Request with your new versions in that folder and I'll merge your changes.\n",
"\n",
"If you're not an expert with git (and I am not!) then GPT has given some nice instructions on how to submit a Pull Request. It's a bit of an involved process, but once you've done it once it's pretty clear. As a pro-tip: it's best if you clear the outputs of your Jupyter notebooks (Edit >> Clean outputs of all cells, and then Save) for clean notebooks.\n",
"\n",
"Here are good instructions courtesy of an AI friend: \n",
"https://chatgpt.com/share/677a9cb5-c64c-8012-99e0-e06e88afd293"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "f4484fcf-8b39-4c3f-9674-37970ed71988",
"metadata": {},
"outputs": [],
"source": []
}
],
"metadata": {
"kernelspec": {
"display_name": "Python 3 (ipykernel)",
"language": "python",
"name": "python3"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.11.12"
}
},
"nbformat": 4,
"nbformat_minor": 5
}