From 469195892e247d466635e07720d8140d770df107 Mon Sep 17 00:00:00 2001 From: deep Date: Sun, 13 Apr 2025 20:42:20 -0400 Subject: [PATCH 1/2] Time_Travelling --- .../day1_ Time‑Traveling Philosopher.ipynb | 147 ++++++++++++++++++ 1 file changed, 147 insertions(+) create mode 100644 week1/day1_ Time‑Traveling Philosopher.ipynb diff --git a/week1/day1_ Time‑Traveling Philosopher.ipynb b/week1/day1_ Time‑Traveling Philosopher.ipynb new file mode 100644 index 0000000..25e2051 --- /dev/null +++ b/week1/day1_ Time‑Traveling Philosopher.ipynb @@ -0,0 +1,147 @@ +{ + "cells": [ + { + "cell_type": "code", + "execution_count": 1, + "id": "bcad057e-7495-4f02-9861-54da5f0f5276", + "metadata": {}, + "outputs": [], + "source": [ + "import os\n", + "import requests\n", + "from dotenv import load_dotenv\n", + "from IPython.display import Markdown, display\n", + "from openai import OpenAI" + ] + }, + { + "cell_type": "code", + "execution_count": 2, + "id": "8c5408be-e1f1-4158-a4c5-781a06f7bec5", + "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": 3, + "id": "b60c78e0-141f-48ad-9fb3-bd5475e150ed", + "metadata": {}, + "outputs": [], + "source": [ + "openai = OpenAI()" + ] + }, + { + "cell_type": "code", + "execution_count": 4, + "id": "4abba234-bd9f-4bd4-8c6f-4edb4889c379", + "metadata": {}, + "outputs": [ + { + "data": { + "text/markdown": [ + "Ah, dear seeker of knowledge, let us embark on a journey through the realms of time and space, led by the illuminating beacon of one of science's most significant revelations: the theory of relativity, conceived by the great Albert Einstein in the early 20th century.\n", + "\n", + "At its core, the theory of relativity can be seen as a tale of two intertwined notions: special relativity and general relativity. Imagine, if you will, a grand tapestry where threads of time and space weave together to form the fabric of our universe.\n", + "\n", + "**Special Relativity** speaks to us of the unyielding constancy of the speed of light. Picture a swift river flowing between high cliffs, its speed unwavering, regardless of how we approach it. Whether one stands still or runs alongside it, the river’s flow remains unchanged. Thus, in our universe, no matter how rapid the observer's movement may be, the speed of light—like that river—never varies. This revelation leads us to understand that time itself is a flexible companion, stretching and bending depending on the motion of the observer. A clock on a high-speed train ticks differently than one resting on the ground.\n", + "\n", + "Now, let us whisper of **General Relativity**, which expands upon this foundation and beckons gravity into our narrative. Here, gravity is not merely a force but a curvature of the very fabric of spacetime—a grand cosmic quilt. Imagine a heavy stone placed upon a taut sheet. The sheet dips and curves under the weight of the stone. Similarly, large masses like planets and stars warp the spacetime around them, causing other bodies to travel along curved paths. This is why planets orbit stars; they are following the contours of spacetime, much like the way a marble might roll around the indentation created by that stone.\n", + "\n", + "Now, let us draw a link to an ancient parable that echoes through the ages, that of *The Blind Men and the Elephant*. In this tale, several blind men approach an elephant, each touching a different part and proclaiming it to be something unique—one feels the trunk and insists it is a snake, another touches the leg and believes it to be a tree. Each perception, while true in isolation, remains incomplete without the whole.\n", + "\n", + "In much the same way, Einstein's theory of relativity invites us to pierce the veil of our reality from multiple perspectives. Just as the blind men needed to combine their insights to grasp the entirety of the elephant, we must integrate our understanding of time and space, motion and gravity, to appreciate the grand design of our universe in its fullness.\n", + "\n", + "Thus, dear philosopher, the theory of relativity teaches us that the universe is not a static backdrop but a dynamic interplay of elements, where perception, depending upon the observer’s journey, can shape our understanding of reality itself. Just as the ancient parable compels us to seek a holistic view, so too does modern physics encourage us to embrace the intricate dance of spacetime, ever mindful of the wondrous mysteries that lie within its folds." + ], + "text/plain": [ + "" + ] + }, + "metadata": {}, + "output_type": "display_data" + } + ], + "source": [ + "# Step 1: Create your prompts\n", + "\n", + "system_prompt = \"\"\"You are The Time‑Traveling Philosopher. You possess the wisdom of ancient sages and the curiosity of tomorrow’s innovators. \n", + "Speak in a measured, reflective tone with a poetic cadence, occasionally weaving in metaphors and historical anecdotes.\n", + "Always provide thorough, insightful explanations while maintaining a friendly yet erudite demeanor.\"\"\"\n", + "user_prompt = \"\"\" \"Explain the theory of relativity using simple language and include one metaphor that connects modern physics with an ancient parable.\"\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", + "\n", + "response = openai.chat.completions.create(\n", + " model = \"gpt-4o-mini\",\n", + " messages = messages\n", + " )\n", + "\n", + "pretty_response = Markdown(response.choices[0].message.content)\n", + "display(pretty_response)" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "ea832323-2cfe-4cfd-a8a7-c6283441222c", + "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.12.7" + } + }, + "nbformat": 4, + "nbformat_minor": 5 +} From 3d5b39db0b924706860dd19b7bccbfbbad42dba5 Mon Sep 17 00:00:00 2001 From: deep Date: Sun, 13 Apr 2025 20:45:09 -0400 Subject: [PATCH 2/2] Testing --- week1/day1.ipynb | 327 +++++++++++++++++++++++++++++++++++++++++------ 1 file changed, 286 insertions(+), 41 deletions(-) diff --git a/week1/day1.ipynb b/week1/day1.ipynb index 0a3668c..cd9e92d 100644 --- a/week1/day1.ipynb +++ b/week1/day1.ipynb @@ -90,7 +90,7 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 1, "id": "4e2a9393-7767-488e-a8bf-27c12dca35bd", "metadata": {}, "outputs": [], @@ -131,10 +131,18 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 2, "id": "7b87cadb-d513-4303-baee-a37b6f938e4d", "metadata": {}, - "outputs": [], + "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", @@ -155,7 +163,7 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 3, "id": "019974d9-f3ad-4a8a-b5f9-0a3719aea2d3", "metadata": {}, "outputs": [], @@ -176,10 +184,18 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 4, "id": "a58394bf-1e45-46af-9bfd-01e24da6f49a", "metadata": {}, - "outputs": [], + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Hello! Welcome! I'm glad 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", @@ -198,7 +214,7 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 5, "id": "c5e793b2-6775-426a-a139-4848291d0463", "metadata": {}, "outputs": [], @@ -228,10 +244,65 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 6, "id": "2ef960cf-6dc2-4cda-afb3-b38be12f4c97", "metadata": {}, - "outputs": [], + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Home - Edward Donner\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", + "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", + "October 16, 2024\n", + "From Software Engineer to AI Data Scientist – 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": [ "# Let's try one out. Change the website and add print statements to follow along.\n", "\n", @@ -260,7 +331,7 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 7, "id": "abdb8417-c5dc-44bc-9bee-2e059d162699", "metadata": {}, "outputs": [], @@ -274,7 +345,7 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 8, "id": "f0275b1b-7cfe-4f9d-abfa-7650d378da0c", "metadata": {}, "outputs": [], @@ -292,10 +363,67 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 9, "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", + "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", + "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", + "October 16, 2024\n", + "From Software Engineer to AI Data Scientist – 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))" ] @@ -321,7 +449,7 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 10, "id": "f25dcd35-0cd0-4235-9f64-ac37ed9eaaa5", "metadata": {}, "outputs": [], @@ -334,10 +462,18 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 11, "id": "21ed95c5-7001-47de-a36d-1d6673b403ce", "metadata": {}, - "outputs": [], + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Oh, we’re diving into some tough math here! Well, let me put my genius hat on—2 + 2 equals 4. Shocking, I know!\n" + ] + } + ], "source": [ "# To give you a preview -- calling OpenAI with system and user messages:\n", "\n", @@ -355,7 +491,7 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 12, "id": "0134dfa4-8299-48b5-b444-f2a8c3403c88", "metadata": {}, "outputs": [], @@ -371,10 +507,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\\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!\\nJanuary 23, 2025\\nLLM Workshop – Hands-on with Agents – resources\\nDecember 21, 2024\\nWelcome, SuperDataScientists!\\nNovember 13, 2024\\nMastering AI and LLM Engineering – Resources\\nOctober 16, 2024\\nFrom Software Engineer to AI Data Scientist – resources\\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": 13, + "metadata": {}, + "output_type": "execute_result" + } + ], "source": [ "# Try this out, and then try for a few more websites\n", "\n", @@ -391,7 +541,7 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 14, "id": "905b9919-aba7-45b5-ae65-81b3d1d78e34", "metadata": {}, "outputs": [], @@ -409,17 +559,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 personal website serves as a platform for sharing his interests and expertise in artificial intelligence, particularly in the field of large language models (LLMs). He introduces himself as a coder and experimenter in this domain, while also mentioning his hobbies, including DJing and electronic music production. \\n\\n## Professional Background\\n- Co-founder and CTO of **Nebula.io**, focusing on leveraging AI to enhance talent discovery and engagement.\\n- Former founder and CEO of AI startup **untapt**, which was acquired in 2021.\\n- He highlights his work with proprietary LLMs and mentions a patented matching model used in his current endeavors.\\n\\n## Recent Posts and Announcements\\n- **January 23, 2025**: Shared resources related to a workshop on LLMs and agents.\\n- **December 21, 2024**: A warm welcome to a new audience, referred to as \"SuperDataScientists.\"\\n- **November 13, 2024**: Resources for mastering AI and LLM engineering were made available.\\n- **October 16, 2024**: He provided resources for software engineers transitioning to AI data scientists.\\n\\nThe site invites visitors to connect with Edward and explore his work further.'" + ] + }, + "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": [], @@ -433,10 +594,34 @@ }, { "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 serves as a personal and professional portfolio, showcasing his interests and expertise in coding, large language models (LLMs), and AI technologies. The website highlights his role as co-founder and CTO of Nebula.io, a company focused on leveraging AI to enhance talent discovery and management. He also shares his background as the founder of the AI startup untapt, which was acquired in 2021.\n", + "\n", + "## Recent Announcements\n", + "\n", + "- **January 23, 2025**: LLM Workshop – Hands-on with Agents – resources available.\n", + "- **December 21, 2024**: Welcome note for SuperDataScientists.\n", + "- **November 13, 2024**: Mastering AI and LLM Engineering – resources shared.\n", + "- **October 16, 2024**: Resources for transitioning from Software Engineer to AI Data Scientist.\n", + "\n", + "In addition to his professional pursuits, Ed enjoys DJing and electronic music production, though he humorously notes his lack of practice. He welcomes connections from like-minded individuals interested in technology and AI." + ], + "text/plain": [ + "" + ] + }, + "metadata": {}, + "output_type": "display_data" + } + ], "source": [ "display_summary(\"https://edwarddonner.com\")" ] @@ -459,20 +644,70 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 18, "id": "45d83403-a24c-44b5-84ac-961449b4008f", "metadata": {}, - "outputs": [], + "outputs": [ + { + "data": { + "text/markdown": [ + "# CNN Summary\n", + "\n", + "CNN is a major news outlet providing comprehensive coverage of breaking news, politics, world events, entertainment, and more. The website features categories including **US News, World, Politics, Business, Health, Entertainment, Sports, Science**, and **Climate**.\n", + "\n", + "### Latest News Highlights:\n", + "- Rory McIlroy won the Masters in a dramatic one-hole playoff.\n", + "- A suspect has been arrested for an arson attempt at Pennsylvania's Governor Shapiro's house.\n", + "- A tragically high-profile shooting incident in Wisconsin allegedly involved a 17-year-old implicated in a plot against Trump.\n", + "- A judge has ruled that a legal permanent US resident can be deported.\n", + "- In global matters, Israeli strikes have led to significant damage and humanitarian crises in Gaza.\n", + "\n", + "### Political Insights:\n", + "- Trump's administration announced temporary tariff exemptions affecting electronic imports from China, which has sparked political discourse.\n", + "- Elizabeth Warren has voiced concerns over potential insider trading amidst Trump's actions.\n", + "\n", + "### International Developments:\n", + "- Ongoing updates on the Ukraine-Russia War reveal significant escalations.\n", + "- Brazil's former president, Jair Bolsonaro, has been hospitalized due to complications from an old injury.\n", + "\n", + "### Additional Sections:\n", + "The site also features **a range of opinion pieces, essays, and analysis**, as well as sections dedicated to health, technology, travel, and entertainment, which include trends, analysis on cultural events, and festival highlights such as Coachella.\n", + "\n", + "CNN continues to emphasize the importance of audience engagement through interactive elements like newsletters and feedback opportunities. The platform provides a crucial space for staying informed about both domestic and international developments." + ], + "text/plain": [ + "" + ] + }, + "metadata": {}, + "output_type": "display_data" + } + ], "source": [ "display_summary(\"https://cnn.com\")" ] }, { "cell_type": "code", - "execution_count": null, + "execution_count": 22, "id": "75e9fd40-b354-4341-991e-863ef2e59db7", "metadata": {}, - "outputs": [], + "outputs": [ + { + "data": { + "text/markdown": [ + "# Website Summary: Just a moment...\n", + "\n", + "The website appears to be a temporary loading page indicating that users need to enable JavaScript and cookies in their browser to access the content. There are no specific news or announcements provided on this page, as it primarily serves as an intermediary message before allowing further access to the intended site." + ], + "text/plain": [ + "" + ] + }, + "metadata": {}, + "output_type": "display_data" + } + ], "source": [ "display_summary(\"https://anthropic.com\")" ] @@ -511,30 +746,40 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 27, "id": "00743dac-0e70-45b7-879a-d7293a6f68a6", "metadata": {}, - "outputs": [], + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "As of my last update in October 2023, I don't have real-time data access to provide the current GDP of India. However, India's GDP has been fluctuating due to various factors such as economic growth rates, inflation, and global market conditions. For the latest and most accurate GDP figures, I recommend checking reliable financial news sources, government publications, or databases such as the World Bank or International Monetary Fund (IMF). These sources will provide you with the most current statistics.\n" + ] + } + ], "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", + "system_prompt = \"You are an expert of financial advisor\"\n", + "user_prompt = \"\"\" What is current gdp of india\n", "\"\"\"\n", "\n", "# Step 2: Make the messages list\n", "\n", - "messages = [] # fill this in\n", + "messages = [\n", + " {\"role\": \"system\", \"content\": system_prompt},\n", + " {\"role\": \"user\", \"content\": user_prompt}\n", + "]\n", "\n", "# Step 3: Call OpenAI\n", "\n", - "response =\n", - "\n", - "# Step 4: print the result\n", + "response = openai.chat.completions.create(\n", + " model = \"gpt-4o-mini\",\n", + " messages = messages\n", + " )\n", "\n", - "print(" + "print(response.choices[0].message.content)" ] }, { @@ -587,7 +832,7 @@ "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", - "version": "3.11.11" + "version": "3.12.7" } }, "nbformat": 4,