diff --git a/examples/Question_answering_using_embeddings.ipynb b/examples/Question_answering_using_embeddings.ipynb index b1c4972a5c..f9146c34c2 100644 --- a/examples/Question_answering_using_embeddings.ipynb +++ b/examples/Question_answering_using_embeddings.ipynb @@ -11,7 +11,7 @@ "GPT excels at answering questions, but only on topics it remembers from its training data.\n", "\n", "What should you do if you want GPT to answer questions about unfamiliar topics? E.g.,\n", - "- Recent events after Sep 2021\n", + "- Recent events after October 2023 for GPT 4 models\n", "- Your non-public documents\n", "- Information from past conversations\n", "- etc.\n", @@ -45,11 +45,9 @@ "\n", "| Model | Maximum text length |\n", "|-----------------|---------------------------|\n", - "| `gpt-3.5-turbo` | 4,096 tokens (~5 pages) |\n", - "| `gpt-4` | 8,192 tokens (~10 pages) |\n", - "| `gpt-4-32k` | 32,768 tokens (~40 pages) |\n", + "| `gpt-4o-mini` | 1,28,000 tokens (~384 pages)|\n", + "| `gpt-4o` | 1,28,000 tokens (~384 pages)|\n", "\n", - "(New model is available with longer contexts, gpt-4-1106-preview have 128K context window)\n", "\n", "Continuing the analogy, you can think of the model like a student who can only look at a few pages of notes at a time, despite potentially having shelves of textbooks to draw upon.\n", "\n", @@ -101,8 +99,8 @@ "\n", "Because GPT is more expensive than embeddings search, a system with a decent volume of queries will have its costs dominated by step 3.\n", "\n", - "- For `gpt-3.5-turbo` using ~1,000 tokens per query, it costs ~$0.002 per query, or ~500 queries per dollar (as of Apr 2023)\n", - "- For `gpt-4`, again assuming ~1,000 tokens per query, it costs ~$0.03 per query, or ~30 queries per dollar (as of Apr 2023)\n", + "- For `gpt-4o`, considering ~1000 tokens per query, it costs ~$0.0025 per query, or ~450 queries per dollar (as of Nov 2024)\n", + "- For `gpt-4o-mini`, using ~1000 tokens per query, it costs ~$0.00015 per query, or ~6000 queries per dollar (as of Nov 2024)\n", "\n", "Of course, exact costs will depend on the system specifics and usage patterns." ] @@ -123,7 +121,7 @@ }, { "cell_type": "code", - "execution_count": 3, + "execution_count": 2, "id": "9e3839a6-9146-4f60-b74b-19abbc24278d", "metadata": {}, "outputs": [], @@ -136,9 +134,10 @@ "import os # for getting API token from env variable OPENAI_API_KEY\n", "from scipy import spatial # for calculating vector similarities for search\n", "\n", + "# create a list of models \n", + "GPT_MODELS = [\"gpt-4o\", \"gpt-4o-mini\"]\n", "# models\n", "EMBEDDING_MODEL = \"text-embedding-ada-002\"\n", - "GPT_MODEL = \"gpt-3.5-turbo\"\n", "\n", "client = OpenAI(api_key=os.environ.get(\"OPENAI_API_KEY\", \"\"))\n" ] @@ -175,14 +174,14 @@ "source": [ "### Motivating example: GPT cannot answer questions about current events\n", "\n", - "Because the training data for `gpt-3.5-turbo` and `gpt-4` mostly ends in September 2021, the models cannot answer questions about more recent events, such as the 2022 Winter Olympics.\n", + "Because the training data for `gpt-4o-mini` mostly ended in October 2023, the models cannot answer questions about more recent events, such as the 2024 Elections or recent games.\n", "\n", - "For example, let's try asking 'Which athletes won the gold medal in curling in 2022?':" + "For example, let's try asking 'How many ?':" ] }, { "cell_type": "code", - "execution_count": 4, + "execution_count": 11, "id": "a167516c-7c19-4bda-afa5-031aa0ae13bb", "metadata": {}, "outputs": [ @@ -190,20 +189,20 @@ "name": "stdout", "output_type": "stream", "text": [ - "As an AI language model, I don't have real-time data. However, I can provide you with general information. The gold medalists in curling at the 2022 Winter Olympics will be determined during the event. The winners will be the team that finishes in first place in the respective men's and women's curling competitions. To find out the specific gold medalists, you can check the official Olympic website or reliable news sources for the most up-to-date information.\n" + "I'm sorry, but I don't have information on the outcomes of the 2024 Summer Olympics, including which athletes won the most gold medals. My training only includes data up to October 2023, and the Olympics are scheduled to take place after that. You might want to check the latest updates from reliable sports news sources or the official Olympics website for the most current information.\n" ] } ], "source": [ "# an example question about the 2022 Olympics\n", - "query = 'Which athletes won the gold medal in curling at the 2022 Winter Olympics?'\n", + "query = 'Which athletes won the most number of gold medals in 2024 Summer Olympics?'\n", "\n", "response = client.chat.completions.create(\n", " messages=[\n", - " {'role': 'system', 'content': 'You answer questions about the 2022 Winter Olympics.'},\n", + " {'role': 'system', 'content': 'You answer questions about the 2024 Games or latest events.'},\n", " {'role': 'user', 'content': query},\n", " ],\n", - " model=GPT_MODEL,\n", + " model=GPT_MODELS[0],\n", " temperature=0,\n", ")\n", "\n", @@ -216,8 +215,44 @@ "id": "1af18d66-d47a-496d-ae5f-4c5d53caa434", "metadata": {}, "source": [ - "In this case, the model has no knowledge of 2022 and is unable to answer the question.\n", + "In this case, the model has no knowledge of 2024 and is unable to answer the question. In a similar way, if you ask a question pertaining to a recent political event (that occured in Nov 2024 for example), GPT-4o-mini models will not be able to answer due to its knowledge cut-off date of Oct 2023. " + ] + }, + { + "cell_type": "code", + "execution_count": 12, + "id": "6d83a4de", + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "I'm sorry, but I don't have information on events or elections that occurred after October 2023. For the latest updates on the 2024 US elections, I recommend checking reliable news sources.\n" + ] + } + ], + "source": [ + "# an example question about the 2024 Elections\n", + "query = 'Who won the elections in the US in 2024?'\n", + "\n", + "response = client.chat.completions.create(\n", + " messages=[\n", + " {'role': 'system', 'content': 'You answer questions about the 2024 Games or latest events.'},\n", + " {'role': 'user', 'content': query},\n", + " ],\n", + " model=GPT_MODELS[1],\n", + " temperature=0,\n", + ")\n", "\n", + "print(response.choices[0].message.content)" + ] + }, + { + "cell_type": "markdown", + "id": "85ff29f4", + "metadata": {}, + "source": [ "### You can give GPT knowledge about a topic by inserting it into an input message\n", "\n", "To help give the model knowledge of curling at the 2022 Winter Olympics, we can copy and paste the top half of a relevant Wikipedia article into our message:" @@ -225,318 +260,106 @@ }, { "cell_type": "code", - "execution_count": 5, + "execution_count": 8, "id": "02e7281d", "metadata": {}, "outputs": [], "source": [ - "# text copied and pasted from: https://en.wikipedia.org/wiki/Curling_at_the_2022_Winter_Olympics\n", - "# I didn't bother to format or clean the text, but GPT will still understand it\n", - "# the entire article is too long for gpt-3.5-turbo, so I only included the top few sections\n", - "\n", - "wikipedia_article_on_curling = \"\"\"Curling at the 2022 Winter Olympics\n", - "\n", - "Article\n", - "Talk\n", - "Read\n", - "Edit\n", - "View history\n", - "From Wikipedia, the free encyclopedia\n", - "Curling\n", - "at the XXIV Olympic Winter Games\n", - "Curling pictogram.svg\n", - "Curling pictogram\n", - "Venue\tBeijing National Aquatics Centre\n", - "Dates\t2–20 February 2022\n", - "No. of events\t3 (1 men, 1 women, 1 mixed)\n", - "Competitors\t114 from 14 nations\n", - "← 20182026 →\n", - "Men's curling\n", - "at the XXIV Olympic Winter Games\n", - "Medalists\n", - "1st place, gold medalist(s)\t\t Sweden\n", - "2nd place, silver medalist(s)\t\t Great Britain\n", - "3rd place, bronze medalist(s)\t\t Canada\n", - "Women's curling\n", - "at the XXIV Olympic Winter Games\n", - "Medalists\n", - "1st place, gold medalist(s)\t\t Great Britain\n", - "2nd place, silver medalist(s)\t\t Japan\n", - "3rd place, bronze medalist(s)\t\t Sweden\n", - "Mixed doubles's curling\n", - "at the XXIV Olympic Winter Games\n", - "Medalists\n", - "1st place, gold medalist(s)\t\t Italy\n", - "2nd place, silver medalist(s)\t\t Norway\n", - "3rd place, bronze medalist(s)\t\t Sweden\n", - "Curling at the\n", - "2022 Winter Olympics\n", - "Curling pictogram.svg\n", - "Qualification\n", - "Statistics\n", - "Tournament\n", - "Men\n", - "Women\n", - "Mixed doubles\n", - "vte\n", - "The curling competitions of the 2022 Winter Olympics were held at the Beijing National Aquatics Centre, one of the Olympic Green venues. Curling competitions were scheduled for every day of the games, from February 2 to February 20.[1] This was the eighth time that curling was part of the Olympic program.\n", - "\n", - "In each of the men's, women's, and mixed doubles competitions, 10 nations competed. The mixed doubles competition was expanded for its second appearance in the Olympics.[2] A total of 120 quota spots (60 per sex) were distributed to the sport of curling, an increase of four from the 2018 Winter Olympics.[3] A total of 3 events were contested, one for men, one for women, and one mixed.[4]\n", - "\n", - "Qualification\n", - "Main article: Curling at the 2022 Winter Olympics – Qualification\n", - "Qualification to the Men's and Women's curling tournaments at the Winter Olympics was determined through two methods (in addition to the host nation). Nations qualified teams by placing in the top six at the 2021 World Curling Championships. Teams could also qualify through Olympic qualification events which were held in 2021. Six nations qualified via World Championship qualification placement, while three nations qualified through qualification events. In men's and women's play, a host will be selected for the Olympic Qualification Event (OQE). They would be joined by the teams which competed at the 2021 World Championships but did not qualify for the Olympics, and two qualifiers from the Pre-Olympic Qualification Event (Pre-OQE). The Pre-OQE was open to all member associations.[5]\n", - "\n", - "For the mixed doubles competition in 2022, the tournament field was expanded from eight competitor nations to ten.[2] The top seven ranked teams at the 2021 World Mixed Doubles Curling Championship qualified, along with two teams from the Olympic Qualification Event (OQE) – Mixed Doubles. This OQE was open to a nominated host and the fifteen nations with the highest qualification points not already qualified to the Olympics. As the host nation, China qualified teams automatically, thus making a total of ten teams per event in the curling tournaments.[6]\n", - "\n", - "Summary\n", - "Nations\tMen\tWomen\tMixed doubles\tAthletes\n", - " Australia\t\t\tYes\t2\n", - " Canada\tYes\tYes\tYes\t12\n", - " China\tYes\tYes\tYes\t12\n", - " Czech Republic\t\t\tYes\t2\n", - " Denmark\tYes\tYes\t\t10\n", - " Great Britain\tYes\tYes\tYes\t10\n", - " Italy\tYes\t\tYes\t6\n", - " Japan\t\tYes\t\t5\n", - " Norway\tYes\t\tYes\t6\n", - " ROC\tYes\tYes\t\t10\n", - " South Korea\t\tYes\t\t5\n", - " Sweden\tYes\tYes\tYes\t11\n", - " Switzerland\tYes\tYes\tYes\t12\n", - " United States\tYes\tYes\tYes\t11\n", - "Total: 14 NOCs\t10\t10\t10\t114\n", - "Competition schedule\n", - "\n", - "The Beijing National Aquatics Centre served as the venue of the curling competitions.\n", - "Curling competitions started two days before the Opening Ceremony and finished on the last day of the games, meaning the sport was the only one to have had a competition every day of the games. The following was the competition schedule for the curling competitions:\n", - "\n", - "RR\tRound robin\tSF\tSemifinals\tB\t3rd place play-off\tF\tFinal\n", - "Date\n", - "Event\n", - "Wed 2\tThu 3\tFri 4\tSat 5\tSun 6\tMon 7\tTue 8\tWed 9\tThu 10\tFri 11\tSat 12\tSun 13\tMon 14\tTue 15\tWed 16\tThu 17\tFri 18\tSat 19\tSun 20\n", - "Men's tournament\t\t\t\t\t\t\t\tRR\tRR\tRR\tRR\tRR\tRR\tRR\tRR\tRR\tSF\tB\tF\t\n", - "Women's tournament\t\t\t\t\t\t\t\t\tRR\tRR\tRR\tRR\tRR\tRR\tRR\tRR\tSF\tB\tF\n", - "Mixed doubles\tRR\tRR\tRR\tRR\tRR\tRR\tSF\tB\tF\t\t\t\t\t\t\t\t\t\t\t\t\n", - "Medal summary\n", + "# text copied and pasted from: https://en.wikipedia.org/wiki/2024_Summer_Olympics\n", + "# We didn't bother to clean the text, but GPT will still understand it\n", + "# Top few sections are included in the text below\n", + "\n", + "wikipedia_article = \"\"\"2024 Summer Olympics\n", + "\n", + "The 2024 Summer Olympics (French: Les Jeux Olympiques d'été de 2024), officially the Games of the XXXIII Olympiad (French: Jeux de la XXXIIIe olympiade de l'ère moderne) and branded as Paris 2024, were an international multi-sport event held from 26 July to 11 August 2024 in France, with several events started from 24 July. Paris was the host city, with events (mainly football) held in 16 additional cities spread across metropolitan France, including the sailing centre in the second-largest city of France, Marseille, on the Mediterranean Sea, as well as one subsite for surfing in Tahiti, French Polynesia.[4]\n", + "\n", + "Paris was awarded the Games at the 131st IOC Session in Lima, Peru, on 13 September 2017. After multiple withdrawals that left only Paris and Los Angeles in contention, the International Olympic Committee (IOC) approved a process to concurrently award the 2024 and 2028 Summer Olympics to the two remaining candidate cities; both bids were praised for their high technical plans and innovative ways to use a record-breaking number of existing and temporary facilities. Having previously hosted in 1900 and 1924, Paris became the second city ever to host the Summer Olympics three times (after London, which hosted the games in 1908, 1948, and 2012).[5][6] Paris 2024 marked the centenary of Paris 1924 and Chamonix 1924 (the first Winter Olympics), as well as the sixth Olympic Games hosted by France (three Summer Olympics and three Winter Olympics) and the first with this distinction since the 1992 Winter Games in Albertville. The Summer Games returned to the traditional four-year Olympiad cycle, after the 2020 edition was postponed to 2021 due to the COVID-19 pandemic.\n", + "\n", + "Paris 2024 featured the debut of breaking as an Olympic sport,[7] and was the final Olympic Games held during the IOC presidency of Thomas Bach.[8] The 2024 Games were expected to cost €9 billion.[9][10][11] The opening ceremony was held outside of a stadium for the first time in modern Olympic history, as athletes were paraded by boat along the Seine. Paris 2024 was the first Olympics in history to reach full gender parity on the field of play, with equal numbers of male and female athletes.[12]\n", + "\n", + "The United States topped the medal table for the fourth consecutive Summer Games and 19th time overall, with 40 gold and 126 total medals.[13] \n", + "China tied with the United States on gold (40), but finished second due to having fewer silvers; the nation won 91 medals overall. \n", + "This is the first time a gold medal tie among the two most successful nations has occurred in Summer Olympic history.[14] Japan finished third with 20 gold medals and sixth in the overall medal count. Australia finished fourth with 18 gold medals and fifth in the overall medal count. The host nation, France, finished fifth with 16 gold and 64 total medals, and fourth in the overall medal count. Dominica, Saint Lucia, Cape Verde and Albania won their first-ever Olympic medals, the former two both being gold, with Botswana and Guatemala also winning their first-ever gold medals. \n", + "The Refugee Olympic Team also won their first-ever medal, a bronze in boxing. At the conclusion of the games, despite some controversies throughout relating to politics, logistics and conditions in the Olympic Village, the Games were considered a success by the press, Parisians and observers.[a] The Paris Olympics broke all-time records for ticket sales, with more than 9.5 million tickets sold (12.1 million including the Paralympic Games).[15]\n", + "\n", "Medal table\n", - "Rank\tNation\tGold\tSilver\tBronze\tTotal\n", - "1\t Great Britain\t1\t1\t0\t2\n", - "2\t Sweden\t1\t0\t2\t3\n", - "3\t Italy\t1\t0\t0\t1\n", - "4\t Japan\t0\t1\t0\t1\n", - " Norway\t0\t1\t0\t1\n", - "6\t Canada\t0\t0\t1\t1\n", - "Totals (6 entries)\t3\t3\t3\t9\n", - "Medalists\n", - "Event\tGold\tSilver\tBronze\n", - "Men\n", - "details\t Sweden\n", - "Niklas Edin\n", - "Oskar Eriksson\n", - "Rasmus Wranå\n", - "Christoffer Sundgren\n", - "Daniel Magnusson\t Great Britain\n", - "Bruce Mouat\n", - "Grant Hardie\n", - "Bobby Lammie\n", - "Hammy McMillan Jr.\n", - "Ross Whyte\t Canada\n", - "Brad Gushue\n", - "Mark Nichols\n", - "Brett Gallant\n", - "Geoff Walker\n", - "Marc Kennedy\n", - "Women\n", - "details\t Great Britain\n", - "Eve Muirhead\n", - "Vicky Wright\n", - "Jennifer Dodds\n", - "Hailey Duff\n", - "Mili Smith\t Japan\n", - "Satsuki Fujisawa\n", - "Chinami Yoshida\n", - "Yumi Suzuki\n", - "Yurika Yoshida\n", - "Kotomi Ishizaki\t Sweden\n", - "Anna Hasselborg\n", - "Sara McManus\n", - "Agnes Knochenhauer\n", - "Sofia Mabergs\n", - "Johanna Heldin\n", - "Mixed doubles\n", - "details\t Italy\n", - "Stefania Constantini\n", - "Amos Mosaner\t Norway\n", - "Kristin Skaslien\n", - "Magnus Nedregotten\t Sweden\n", - "Almida de Val\n", - "Oskar Eriksson\n", - "Teams\n", - "Men\n", - " Canada\t China\t Denmark\t Great Britain\t Italy\n", - "Skip: Brad Gushue\n", - "Third: Mark Nichols\n", - "Second: Brett Gallant\n", - "Lead: Geoff Walker\n", - "Alternate: Marc Kennedy\n", - "\n", - "Skip: Ma Xiuyue\n", - "Third: Zou Qiang\n", - "Second: Wang Zhiyu\n", - "Lead: Xu Jingtao\n", - "Alternate: Jiang Dongxu\n", - "\n", - "Skip: Mikkel Krause\n", - "Third: Mads Nørgård\n", - "Second: Henrik Holtermann\n", - "Lead: Kasper Wiksten\n", - "Alternate: Tobias Thune\n", - "\n", - "Skip: Bruce Mouat\n", - "Third: Grant Hardie\n", - "Second: Bobby Lammie\n", - "Lead: Hammy McMillan Jr.\n", - "Alternate: Ross Whyte\n", - "\n", - "Skip: Joël Retornaz\n", - "Third: Amos Mosaner\n", - "Second: Sebastiano Arman\n", - "Lead: Simone Gonin\n", - "Alternate: Mattia Giovanella\n", - "\n", - " Norway\t ROC\t Sweden\t Switzerland\t United States\n", - "Skip: Steffen Walstad\n", - "Third: Torger Nergård\n", - "Second: Markus Høiberg\n", - "Lead: Magnus Vågberg\n", - "Alternate: Magnus Nedregotten\n", - "\n", - "Skip: Sergey Glukhov\n", - "Third: Evgeny Klimov\n", - "Second: Dmitry Mironov\n", - "Lead: Anton Kalalb\n", - "Alternate: Daniil Goriachev\n", - "\n", - "Skip: Niklas Edin\n", - "Third: Oskar Eriksson\n", - "Second: Rasmus Wranå\n", - "Lead: Christoffer Sundgren\n", - "Alternate: Daniel Magnusson\n", - "\n", - "Fourth: Benoît Schwarz\n", - "Third: Sven Michel\n", - "Skip: Peter de Cruz\n", - "Lead: Valentin Tanner\n", - "Alternate: Pablo Lachat\n", - "\n", - "Skip: John Shuster\n", - "Third: Chris Plys\n", - "Second: Matt Hamilton\n", - "Lead: John Landsteiner\n", - "Alternate: Colin Hufman\n", - "\n", - "Women\n", - " Canada\t China\t Denmark\t Great Britain\t Japan\n", - "Skip: Jennifer Jones\n", - "Third: Kaitlyn Lawes\n", - "Second: Jocelyn Peterman\n", - "Lead: Dawn McEwen\n", - "Alternate: Lisa Weagle\n", - "\n", - "Skip: Han Yu\n", - "Third: Wang Rui\n", - "Second: Dong Ziqi\n", - "Lead: Zhang Lijun\n", - "Alternate: Jiang Xindi\n", - "\n", - "Skip: Madeleine Dupont\n", - "Third: Mathilde Halse\n", - "Second: Denise Dupont\n", - "Lead: My Larsen\n", - "Alternate: Jasmin Lander\n", - "\n", - "Skip: Eve Muirhead\n", - "Third: Vicky Wright\n", - "Second: Jennifer Dodds\n", - "Lead: Hailey Duff\n", - "Alternate: Mili Smith\n", - "\n", - "Skip: Satsuki Fujisawa\n", - "Third: Chinami Yoshida\n", - "Second: Yumi Suzuki\n", - "Lead: Yurika Yoshida\n", - "Alternate: Kotomi Ishizaki\n", - "\n", - " ROC\t South Korea\t Sweden\t Switzerland\t United States\n", - "Skip: Alina Kovaleva\n", - "Third: Yulia Portunova\n", - "Second: Galina Arsenkina\n", - "Lead: Ekaterina Kuzmina\n", - "Alternate: Maria Komarova\n", - "\n", - "Skip: Kim Eun-jung\n", - "Third: Kim Kyeong-ae\n", - "Second: Kim Cho-hi\n", - "Lead: Kim Seon-yeong\n", - "Alternate: Kim Yeong-mi\n", - "\n", - "Skip: Anna Hasselborg\n", - "Third: Sara McManus\n", - "Second: Agnes Knochenhauer\n", - "Lead: Sofia Mabergs\n", - "Alternate: Johanna Heldin\n", - "\n", - "Fourth: Alina Pätz\n", - "Skip: Silvana Tirinzoni\n", - "Second: Esther Neuenschwander\n", - "Lead: Melanie Barbezat\n", - "Alternate: Carole Howald\n", - "\n", - "Skip: Tabitha Peterson\n", - "Third: Nina Roth\n", - "Second: Becca Hamilton\n", - "Lead: Tara Peterson\n", - "Alternate: Aileen Geving\n", - "\n", - "Mixed doubles\n", - " Australia\t Canada\t China\t Czech Republic\t Great Britain\n", - "Female: Tahli Gill\n", - "Male: Dean Hewitt\n", - "\n", - "Female: Rachel Homan\n", - "Male: John Morris\n", - "\n", - "Female: Fan Suyuan\n", - "Male: Ling Zhi\n", - "\n", - "Female: Zuzana Paulová\n", - "Male: Tomáš Paul\n", - "\n", - "Female: Jennifer Dodds\n", - "Male: Bruce Mouat\n", - "\n", - " Italy\t Norway\t Sweden\t Switzerland\t United States\n", - "Female: Stefania Constantini\n", - "Male: Amos Mosaner\n", - "\n", - "Female: Kristin Skaslien\n", - "Male: Magnus Nedregotten\n", - "\n", - "Female: Almida de Val\n", - "Male: Oskar Eriksson\n", - "\n", - "Female: Jenny Perret\n", - "Male: Martin Rios\n", - "\n", - "Female: Vicky Persinger\n", - "Male: Chris Plys\n", + "Main article: 2024 Summer Olympics medal table\n", + "See also: List of 2024 Summer Olympics medal winners\n", + "Key\n", + " ‡ Changes in medal standings (see below)\n", + "\n", + " * Host nation (France)\n", + "\n", + "2024 Summer Olympics medal table[171][B][C]\n", + "Rank\tNOC\tGold\tSilver\tBronze\tTotal\n", + "1\t United States‡\t40\t44\t42\t126\n", + "2\t China\t40\t27\t24\t91\n", + "3\t Japan\t20\t12\t13\t45\n", + "4\t Australia\t18\t19\t16\t53\n", + "5\t France*\t16\t26\t22\t64\n", + "6\t Netherlands\t15\t7\t12\t34\n", + "7\t Great Britain\t14\t22\t29\t65\n", + "8\t South Korea\t13\t9\t10\t32\n", + "9\t Italy\t12\t13\t15\t40\n", + "10\t Germany\t12\t13\t8\t33\n", + "11–91\tRemaining NOCs\t129\t138\t194\t461\n", + "Totals (91 entries)\t329\t330\t385\t1,044\n", + "\n", + "Podium sweeps\n", + "There was one podium sweep during the games:\n", + "\n", + "Date\tSport\tEvent\tTeam\tGold\tSilver\tBronze\tRef\n", + "2 August\tCycling\tMen's BMX race\t France\tJoris Daudet\tSylvain André\tRomain Mahieu\t[176]\n", + "\n", + "\n", + "Medals\n", + "Medals from the Games, with a piece of the Eiffel Tower\n", + "The President of the Paris 2024 Olympic Organizing Committee, Tony Estanguet, unveiled the Olympic and Paralympic medals for the Games in February 2024, which on the obverse featured embedded hexagon-shaped tokens of scrap iron that had been taken from the original construction of the Eiffel Tower, with the logo of the Games engraved into it.[41] Approximately 5,084 medals would be produced by the French mint Monnaie de Paris, and were designed by Chaumet, a luxury jewellery firm based in Paris.[42]\n", + "\n", + "The reverse of the medals features Nike, the Greek goddess of victory, inside the Panathenaic Stadium which hosted the first modern Olympics in 1896. Parthenon and the Eiffel Tower can also be seen in the background on both sides of the medal.[43] Each medal weighs 455–529 g (16–19 oz), has a diameter of 85 mm (3.3 in) and is 9.2 mm (0.36 in) thick.[44] The gold medals are made with 98.8 percent silver and 1.13 percent gold, while the bronze medals are made up with copper, zinc, and tin.[45]\n", + "\n", + "\n", + "Opening ceremony\n", + "Main article: 2024 Summer Olympics opening ceremony\n", + "\n", + "Pyrotechnics at the Pont d'Austerlitz marking the start of the Parade of Nations\n", + "\n", + "The cauldron flying above the Tuileries Garden during the games. LEDs and aerosol produced the illusion of fire, while the Olympic flame itself was kept in a small lantern nearby\n", + "The opening ceremony began at 19:30 CEST (17:30 GMT) on 26 July 2024.[124] Directed by Thomas Jolly,[125][126][127] it was the first Summer Olympics opening ceremony to be held outside the traditional stadium setting (and the second ever after the 2018 Youth Olympic Games one, held at Plaza de la República in Buenos Aires); the parade of athletes was conducted as a boat parade along the Seine from Pont d'Austerlitz to Pont d'Iéna, and cultural segments took place at various landmarks along the route.[128] Jolly stated that the ceremony would highlight notable moments in the history of France, with an overall theme of love and \"shared humanity\".[128] The athletes then attended the official protocol at Jardins du Trocadéro, in front of the Eiffel Tower.[129] Approximately 326,000 tickets were sold for viewing locations along the Seine, 222,000 of which were distributed primarily to the Games' volunteers, youth and low-income families, among others.[130]\n", + "\n", + "The ceremony featured music performances by American musician Lady Gaga,[131] French-Malian singer Aya Nakamura, heavy metal band Gojira and soprano Marina Viotti [fr],[132] Axelle Saint-Cirel (who sang the French national anthem \"La Marseillaise\" atop the Grand Palais),[133] rapper Rim'K,[134] Philippe Katerine (who portrayed the Greek god Dionysus), Juliette Armanet and Sofiane Pamart, and was closed by Canadian singer Céline Dion.[132] The Games were formally opened by president Emmanuel Macron.[135]\n", + "\n", + "The Olympics and Paralympics cauldron was lit by Guadeloupean judoka Teddy Riner and sprinter Marie-José Pérec; it had a hot air balloon-inspired design topped by a 30-metre-tall (98 ft) helium sphere, and was allowed to float into the air above the Tuileries Garden at night. For the first time, the cauldron was not illuminated through combustion; the flames were simulated by an LED lighting system and aerosol water jets.[136]\n", + "\n", + "Controversy ensued at the opening ceremony when a segment was interpreted by some as a parody of the Last Supper. The organisers apologised for any offence caused.[137] The Olympic World Library and fact-checkers would later debunk the interpretation that the segment was a parody of the Last Supper. The Olympic flag was also raised upside down.[138][139]\n", + "\n", + "During the day of the opening ceremony, there were reports of a blackout in Paris, although this was later debunked.[140]\n", + "\n", + "Closing ceremony\n", + "\n", + "\n", + "The ceremony and final fireworks\n", + "Main article: 2024 Summer Olympics closing ceremony\n", + "The closing ceremony was held at Stade de France on 11 August 2024, and thus marked the first time in any Olympic edition since Sarajevo 1984 that opening and closing ceremonies were held in different locations.[127] Titled \"Records\", the ceremony was themed around a dystopian future, where the Olympic Games have disappeared, and a group of aliens reinvent it. It featured more than a hundred performers, including acrobats, dancers and circus artists.[158] American actor Tom Cruise also appeared with American performers Red Hot Chili Peppers, Billie Eilish, Snoop Dogg, and H.E.R. during the LA28 Handover Celebration portion of the ceremony.[159][160] The Antwerp Ceremony, in which the Olympic flag was handed to Los Angeles, the host city of the 2028 Summer Olympics, was produced by Ben Winston and his studio Fulwell 73.[161]\n", + "\n", + "\n", + "Security\n", + "France reached an agreement with Europol and the UK Home Office to help strengthen security and \"facilitate operational information exchange and international law enforcement cooperation\" during the Games.[46] The agreement included a plan to deploy more drones and sea barriers to prevent small boats from crossing the Channel illegally.[47] The British Army would also provide support by deploying Starstreak surface-to-air missile units for air security.[48] To prepare for the Games, the Paris police held inspections and rehearsals in their bomb disposal unit, similar to their preparations for the 2023 Rugby World Cup at the Stade de France.[49]\n", + "\n", + "As part of a visit to France by Qatari Emir Sheikh Tamim bin Hamad Al-Thani, several agreements were signed between the two nations to enhance security for the Olympics.[50] In preparation for the significant security demands and counterterrorism measures, Poland pledged to contribute security troops, including sniffer dog handlers, to support international efforts aimed at ensuring the safety of the Games.[51][52] The Qatari Minister of Interior and Commander of Lekhwiya (the Qatari security forces) convened a meeting on 3 April 2024 to discuss security operations ahead of the Olympics, with officials and security leaders in attendance, including Nasser Al-Khelaifi and Sheikh Jassim bin Mansour Al Thani.[53] A week before the opening ceremony, the Lekhwiya were reported to have been deployed in Paris on 16 July 2024.[54]\n", + "\n", + "In the weeks running up to the opening of the Paris Olympics, it was reported that police officers would be deployed from Belgium,[55] Brazil,[56] Canada (through the RCMP/OPP/CPS/SQ),[57][58][59] Cyprus,[60] the Czech Republic,[61] Denmark,[62] Estonia,[63][64] Finland,[65] Germany (through Bundespolizei[66][67]/NRW Police[68]),[69] India,[70][71] Ireland,[72] Italy,[73] Luxembourg,[74] Morocco,[75] Netherlands,[76] Norway,[58] Poland,[77] Portugal,[78] Slovakia,[79] South Korea,[80][81] Spain (through the CNP/GC),[82] Sweden,[83] the UAE,[84] the UK,[49] and the US (through the LAPD,[85] LASD,[86] NYPD,[87] and the Fairfax County Police Department[88]), with more than 40 countries providing police assistance to their French counterparts.[89][90]\n", + "\n", + "Security concerns impacted the plans that had been announced for the opening ceremony, which was to take place as a public event along the Seine; the expected attendance was reduced by half from an estimated 600,000 to 300,000, with plans for free viewing locations now being by invitation only. In April 2024, after Islamic State claimed responsibility for the Crocus City Hall attack in March, and made several threats against the UEFA Champions League quarter-finals, French president Emmanuel Macron indicated that the opening ceremony could be scaled back or re-located if necessary.[91][92][93] French authorities had placed roughly 75,000 police and military officials on the streets of Paris in the lead-up to the Games.[94]\n", + "\n", + "Following the end of the Games, the national counterterrorism prosecutor, Olivier Christen, revealed that French authorities foiled three terror plots meant to attack the Olympic and Paralympic Games, resulting in the arrest of five suspects.[95]\n", + "\n", "\"\"\"" ] }, { "cell_type": "code", - "execution_count": 6, + "execution_count": 10, "id": "fceaf665-2602-4788-bc44-9eb256a6f955", "metadata": {}, "outputs": [ @@ -544,26 +367,30 @@ "name": "stdout", "output_type": "stream", "text": [ - "In the men's curling event, the gold medal was won by Sweden. In the women's curling event, the gold medal was won by Great Britain. In the mixed doubles curling event, the gold medal was won by Italy.\n" + "The countries that won the maximum number of gold, silver, and bronze medals respectively at the 2024 Summer Olympics are:\n", + "\n", + "- Gold: United States and China (tied with 40 gold medals each)\n", + "- Silver: United States (44 silver medals)\n", + "- Bronze: United States (42 bronze medals)\n" ] } ], "source": [ - "query = f\"\"\"Use the below article on the 2022 Winter Olympics to answer the subsequent question. If the answer cannot be found, write \"I don't know.\"\n", + "query = f\"\"\"Use the below article on the 2024 Summer Olympics to answer the subsequent question. If the answer cannot be found, write \"I don't know.\"\n", "\n", "Article:\n", "\\\"\\\"\\\"\n", - "{wikipedia_article_on_curling}\n", + "{wikipedia_article}\n", "\\\"\\\"\\\"\n", "\n", - "Question: Which athletes won the gold medal in curling at the 2022 Winter Olympics?\"\"\"\n", + "Question: Which countries won the maximum number of gold, silver and bronze medals respectively at 2024 Summer Olympics? List the countries in the order of gold, silver and bronze medals.\"\"\"\n", "\n", "response = client.chat.completions.create(\n", " messages=[\n", - " {'role': 'system', 'content': 'You answer questions about the 2022 Winter Olympics.'},\n", + " {'role': 'system', 'content': 'You answer questions about the recent events.'},\n", " {'role': 'user', 'content': query},\n", " ],\n", - " model=GPT_MODEL,\n", + " model=GPT_MODELS[0],\n", " temperature=0,\n", ")\n", "\n", @@ -578,9 +405,7 @@ "source": [ "Thanks to the Wikipedia article included in the input message, GPT answers correctly.\n", "\n", - "In this particular case, GPT was intelligent enough to realize that the original question was underspecified, as there were three curling gold medal events, not just one.\n", - "\n", - "Of course, this example partly relied on human intelligence. We knew the question was about curling, so we inserted a Wikipedia article on curling.\n", + "Of course, this example partly relied on human intelligence. We knew the question was about summer olympics, so we inserted a Wikipedia article about 2024 paris olympics game.\n", "\n", "The rest of this notebook shows how to automate this knowledge insertion with embeddings-based search." ] @@ -600,7 +425,7 @@ }, { "cell_type": "code", - "execution_count": 7, + "execution_count": 13, "id": "46d50792", "metadata": {}, "outputs": [], @@ -614,7 +439,7 @@ }, { "cell_type": "code", - "execution_count": 8, + "execution_count": 14, "id": "70307f8e", "metadata": {}, "outputs": [], @@ -625,7 +450,7 @@ }, { "cell_type": "code", - "execution_count": 9, + "execution_count": 15, "id": "424162c2", "metadata": {}, "outputs": [ @@ -745,7 +570,7 @@ "[6059 rows x 2 columns]" ] }, - "execution_count": 9, + "execution_count": 15, "metadata": {}, "output_type": "execute_result" } @@ -774,7 +599,7 @@ }, { "cell_type": "code", - "execution_count": 10, + "execution_count": 18, "id": "b9a8c713-c8a9-47dc-85a4-871ee1395566", "metadata": {}, "outputs": [], @@ -803,7 +628,7 @@ }, { "cell_type": "code", - "execution_count": 11, + "execution_count": 19, "id": "da034bd2", "metadata": {}, "outputs": [ @@ -916,12 +741,12 @@ }, { "cell_type": "code", - "execution_count": 12, + "execution_count": 20, "id": "1f45cecc", "metadata": {}, "outputs": [], "source": [ - "def num_tokens(text: str, model: str = GPT_MODEL) -> int:\n", + "def num_tokens(text: str, model: str = GPT_MODELS[0]) -> int:\n", " \"\"\"Return the number of tokens in a string.\"\"\"\n", " encoding = tiktoken.encoding_for_model(model)\n", " return len(encoding.encode(text))\n", @@ -953,7 +778,7 @@ "def ask(\n", " query: str,\n", " df: pd.DataFrame = df,\n", - " model: str = GPT_MODEL,\n", + " model: str = GPT_MODELS[0],\n", " token_budget: int = 4096 - 500,\n", " print_message: bool = False,\n", ") -> str:\n", @@ -988,17 +813,25 @@ }, { "cell_type": "code", - "execution_count": 13, + "execution_count": 21, "id": "e11f53ab", "metadata": {}, "outputs": [ + { + "name": "stderr", + "output_type": "stream", + "text": [ + "/Users/shikhar/openai_projects/github_repos/.venv/lib/python3.9/site-packages/urllib3/__init__.py:35: NotOpenSSLWarning: urllib3 v2 only supports OpenSSL 1.1.1+, currently the 'ssl' module is compiled with 'LibreSSL 2.8.3'. See: https://github.com/urllib3/urllib3/issues/3020\n", + " warnings.warn(\n" + ] + }, { "data": { "text/plain": [ - "\"In the men's curling tournament, the gold medal was won by the team from Sweden, consisting of Niklas Edin, Oskar Eriksson, Rasmus Wranå, Christoffer Sundgren, and Daniel Magnusson. In the women's curling tournament, the gold medal was won by the team from Great Britain, consisting of Eve Muirhead, Vicky Wright, Jennifer Dodds, Hailey Duff, and Mili Smith.\"" + "\"The athletes who won the gold medal in curling at the 2022 Winter Olympics are:\\n\\n- Men's tournament: Niklas Edin, Oskar Eriksson, Rasmus Wranå, Christoffer Sundgren, and Daniel Magnusson from Sweden.\\n- Women's tournament: Eve Muirhead, Vicky Wright, Jennifer Dodds, Hailey Duff, and Mili Smith from Great Britain.\\n- Mixed doubles tournament: Stefania Constantini and Amos Mosaner from Italy.\"" ] }, - "execution_count": 13, + "execution_count": 21, "metadata": {}, "output_type": "execute_result" } @@ -1013,9 +846,7 @@ "id": "422248a8", "metadata": {}, "source": [ - "Despite `gpt-3.5-turbo` having no knowledge of the 2022 Winter Olympics, our search system was able to retrieve reference text for the model to read, allowing it to correctly list the gold medal winners in the Men's and Women's tournaments.\n", - "\n", - "However, it still wasn't quite perfect—the model failed to list the gold medal winners from the Mixed doubles event." + "With latest model and using embedding search, our search system was able to retrieve reference text for the model to read, allowing it to correctly list the gold medal winners in the Men's and Women's tournaments." ] }, { @@ -1033,14 +864,14 @@ "id": "a496aa2b", "metadata": {}, "source": [ - "To see whether a mistake is from a lack of relevant source text (i.e., failure of the search step) or a lack of reasoning reliability (i.e., failure of the ask step), you can look at the text GPT was given by setting `print_message=True`.\n", + "In case we get any mistakes in the output, we can see whether a mistake is from a lack of relevant source text (i.e., failure of the search step) or a lack of reasoning reliability (i.e., failure of the ask step), you can look at the text GPT was given by setting `print_message=True`.\n", "\n", "In this particular case, looking at the text below, it looks like the #1 article given to the model did contain medalists for all three events, but the later results emphasized the Men's and Women's tournaments, which may have distracted the model from giving a more complete answer." ] }, { "cell_type": "code", - "execution_count": 14, + "execution_count": 22, "id": "aa965e36", "metadata": {}, "outputs": [ @@ -1278,6 +1109,36 @@ "\n", "==Results summary==\n", "\n", + "===Women's tournament===\n", + "\n", + "====Playoffs====\n", + "\n", + "=====Bronze medal game=====\n", + "\n", + "''Saturday, 19 February, 20:05''\n", + "{{#lst:Curling at the 2022 Winter Olympics – Women's tournament|BM}}\n", + "{{Player percentages\n", + "| team1 = {{flagIOC|SUI|2022 Winter}}\n", + "| [[Melanie Barbezat]] | 79%\n", + "| [[Esther Neuenschwander]] | 75%\n", + "| [[Silvana Tirinzoni]] | 81%\n", + "| [[Alina Pätz]] | 64%\n", + "| teampct1 = 75%\n", + "| team2 = {{flagIOC|SWE|2022 Winter}}\n", + "| [[Sofia Mabergs]] | 89%\n", + "| [[Agnes Knochenhauer]] | 80%\n", + "| [[Sara McManus]] | 81%\n", + "| [[Anna Hasselborg]] | 76%\n", + "| teampct2 = 82%\n", + "}}\n", + "\"\"\"\n", + "\n", + "Wikipedia article section:\n", + "\"\"\"\n", + "Curling at the 2022 Winter Olympics\n", + "\n", + "==Results summary==\n", + "\n", "===Mixed doubles tournament===\n", "\n", "====Playoffs====\n", @@ -1303,46 +1164,16 @@ "|}\n", "\"\"\"\n", "\n", - "Wikipedia article section:\n", - "\"\"\"\n", - "Curling at the 2022 Winter Olympics\n", - "\n", - "==Results summary==\n", - "\n", - "===Women's tournament===\n", - "\n", - "====Playoffs====\n", - "\n", - "=====Bronze medal game=====\n", - "\n", - "''Saturday, 19 February, 20:05''\n", - "{{#lst:Curling at the 2022 Winter Olympics – Women's tournament|BM}}\n", - "{{Player percentages\n", - "| team1 = {{flagIOC|SUI|2022 Winter}}\n", - "| [[Melanie Barbezat]] | 79%\n", - "| [[Esther Neuenschwander]] | 75%\n", - "| [[Silvana Tirinzoni]] | 81%\n", - "| [[Alina Pätz]] | 64%\n", - "| teampct1 = 75%\n", - "| team2 = {{flagIOC|SWE|2022 Winter}}\n", - "| [[Sofia Mabergs]] | 89%\n", - "| [[Agnes Knochenhauer]] | 80%\n", - "| [[Sara McManus]] | 81%\n", - "| [[Anna Hasselborg]] | 76%\n", - "| teampct2 = 82%\n", - "}}\n", - "\"\"\"\n", - "\n", "Question: Which athletes won the gold medal in curling at the 2022 Winter Olympics?\n" ] }, { "data": { "text/plain": [ - "\"In the men's tournament, the Swedish team consisting of Niklas Edin, Oskar Eriksson, Rasmus Wranå, Christoffer Sundgren, and Daniel Magnusson won the gold medal in curling at the 2022 Winter Olympics. In the women's tournament, the British team consisting of Eve Muirhead, Vicky Wright, Jennifer Dodds, Hailey Duff, and Mili Smith won the gold medal.\"" + "\"The athletes who won the gold medal in curling at the 2022 Winter Olympics are:\\n\\n- Men's tournament: Niklas Edin, Oskar Eriksson, Rasmus Wranå, Christoffer Sundgren, and Daniel Magnusson from Sweden.\\n- Women's tournament: Eve Muirhead, Vicky Wright, Jennifer Dodds, Hailey Duff, and Mili Smith from Great Britain.\\n- Mixed doubles tournament: Stefania Constantini and Amos Mosaner from Italy.\"" ] }, - "execution_count": 14, + "execution_count": 22, "metadata": {}, "output_type": "execute_result" } @@ -1358,30 +1189,30 @@ "id": "43d68a2e", "metadata": {}, "source": [ - "Knowing that this mistake was due to imperfect reasoning in the ask step, rather than imperfect retrieval in the search step, let's focus on improving the ask step.\n", + "Knowing that sometimes, this mistake can be due to imperfect reasoning in the ask step, than imperfect retrieval in the search step, one can focus on improving the ask step.\n", "\n", - "The easiest way to improve results is to use a more capable model, such as `GPT-4`. Let's try it." + "The easiest way to improve results is to use a more capable models, such as `GPT-4o-mini` or `GPT-4o` models. Let's try it." ] }, { "cell_type": "code", - "execution_count": 15, + "execution_count": 29, "id": "d6cb292f", "metadata": {}, "outputs": [ { "data": { "text/plain": [ - "\"The athletes who won the gold medal in curling at the 2022 Winter Olympics are:\\n\\nMen's tournament: Niklas Edin, Oskar Eriksson, Rasmus Wranå, Christoffer Sundgren, and Daniel Magnusson from Sweden.\\n\\nWomen's tournament: Eve Muirhead, Vicky Wright, Jennifer Dodds, Hailey Duff, and Mili Smith from Great Britain.\\n\\nMixed doubles tournament: Stefania Constantini and Amos Mosaner from Italy.\"" + "\"The gold medal in curling at the 2022 Winter Olympics was won by the following athletes:\\n\\n- Men's tournament: Niklas Edin, Oskar Eriksson, Rasmus Wranå, Christoffer Sundgren, Daniel Magnusson from Sweden.\\n- Women's tournament: Eve Muirhead, Vicky Wright, Jennifer Dodds, Hailey Duff, Mili Smith from Great Britain.\\n- Mixed doubles: Stefania Constantini and Amos Mosaner from Italy.\"" ] }, - "execution_count": 15, + "execution_count": 29, "metadata": {}, "output_type": "execute_result" } ], "source": [ - "ask('Which athletes won the gold medal in curling at the 2022 Winter Olympics?', model=\"gpt-4\")" + "ask('Which athletes won the gold medal in curling at the 2022 Winter Olympics?', model=GPT_MODELS[1])" ] }, { @@ -1390,7 +1221,7 @@ "id": "046a8cfd", "metadata": {}, "source": [ - "GPT-4 succeeds perfectly, correctly identifying all 12 gold medal winners in curling. " + "GPT-4 models tend to succeed, correctly identifying all 12 gold medal winners in curling. " ] }, { @@ -1406,7 +1237,7 @@ }, { "cell_type": "code", - "execution_count": 16, + "execution_count": 30, "id": "05fb04ef", "metadata": {}, "outputs": [ @@ -1416,7 +1247,7 @@ "'I could not find an answer.'" ] }, - "execution_count": 16, + "execution_count": 30, "metadata": {}, "output_type": "execute_result" } @@ -1428,17 +1259,17 @@ }, { "cell_type": "code", - "execution_count": 17, + "execution_count": 31, "id": "30da5271", "metadata": {}, "outputs": [ { "data": { "text/plain": [ - "\"Jamaica had more athletes at the 2022 Winter Olympics. According to the provided information, Jamaica had a total of 7 athletes (6 men and 1 woman) competing in 2 sports, while there is no information about Cuba's participation in the 2022 Winter Olympics.\"" + "\"Jamaica had more athletes at the 2022 Winter Olympics. Jamaica's team consisted of seven athletes. There is no information provided about Cuba's participation in the 2022 Winter Olympics in the articles, so it is unclear if Cuba had any athletes at the event.\"" ] }, - "execution_count": 17, + "execution_count": 31, "metadata": {}, "output_type": "execute_result" } @@ -1450,7 +1281,7 @@ }, { "cell_type": "code", - "execution_count": 18, + "execution_count": 32, "id": "42449926", "metadata": {}, "outputs": [ @@ -1460,7 +1291,7 @@ "'I could not find an answer.'" ] }, - "execution_count": 18, + "execution_count": 32, "metadata": {}, "output_type": "execute_result" } @@ -1472,7 +1303,7 @@ }, { "cell_type": "code", - "execution_count": 19, + "execution_count": 33, "id": "34e4b7e1", "metadata": {}, "outputs": [ @@ -1482,7 +1313,7 @@ "'I could not find an answer.'" ] }, - "execution_count": 19, + "execution_count": 33, "metadata": {}, "output_type": "execute_result" } @@ -1494,7 +1325,7 @@ }, { "cell_type": "code", - "execution_count": 20, + "execution_count": 34, "id": "57d13b1f", "metadata": {}, "outputs": [ @@ -1504,7 +1335,7 @@ "'I could not find an answer.'" ] }, - "execution_count": 20, + "execution_count": 34, "metadata": {}, "output_type": "execute_result" } @@ -1516,17 +1347,17 @@ }, { "cell_type": "code", - "execution_count": 21, + "execution_count": 35, "id": "f997e261", "metadata": {}, "outputs": [ { "data": { "text/plain": [ - "\"In the marsh, the Shoebill stands tall and stark,\\nWith a grace that lights up the day's dark.\\nIts elegance in flight, a breathtaking art,\\nA living masterpiece, nature's work of heart.\"" + "\"In the marsh, a silhouette stark,\\nStands the elegant Shoebill Stork.\\nWith a gaze so keen and bill so bold,\\nNature's marvel, a sight to behold.\"" ] }, - "execution_count": 21, + "execution_count": 35, "metadata": {}, "output_type": "execute_result" } @@ -1538,17 +1369,17 @@ }, { "cell_type": "code", - "execution_count": 22, + "execution_count": 36, "id": "0d3dad92", "metadata": {}, "outputs": [ { "data": { "text/plain": [ - "\"According to the provided information, the gold medal winners in curling at the 2022 Winter Olympics were:\\n\\n- Men's tournament: Sweden (Niklas Edin, Oskar Eriksson, Rasmus Wranå, Christoffer Sundgren, Daniel Magnusson)\\n- Women's tournament: Great Britain (Eve Muirhead, Vicky Wright, Jennifer Dodds, Hailey Duff, Mili Smith)\\n- Mixed doubles tournament: Italy (Stefania Constantini, Amos Mosaner)\"" + "\"The gold medal winners in curling at the 2022 Winter Olympics were:\\n\\n- Men's tournament: Sweden (Niklas Edin, Oskar Eriksson, Rasmus Wranå, Christoffer Sundgren, Daniel Magnusson)\\n- Women's tournament: Great Britain (Eve Muirhead, Vicky Wright, Jennifer Dodds, Hailey Duff, Mili Smith)\\n- Mixed doubles tournament: Italy (Stefania Constantini, Amos Mosaner)\"" ] }, - "execution_count": 22, + "execution_count": 36, "metadata": {}, "output_type": "execute_result" } @@ -1560,7 +1391,7 @@ }, { "cell_type": "code", - "execution_count": 23, + "execution_count": 57, "id": "afa3b95f", "metadata": {}, "outputs": [ @@ -1570,7 +1401,7 @@ "'I could not find an answer.'" ] }, - "execution_count": 23, + "execution_count": 57, "metadata": {}, "output_type": "execute_result" } @@ -1582,7 +1413,7 @@ }, { "cell_type": "code", - "execution_count": 24, + "execution_count": 37, "id": "627e131e", "metadata": {}, "outputs": [ @@ -1592,7 +1423,7 @@ "'I could not find an answer.'" ] }, - "execution_count": 24, + "execution_count": 37, "metadata": {}, "output_type": "execute_result" } @@ -1604,17 +1435,17 @@ }, { "cell_type": "code", - "execution_count": 25, + "execution_count": 38, "id": "c5aad00d", "metadata": {}, "outputs": [ { "data": { "text/plain": [ - "'COVID-19 had several impacts on the 2022 Winter Olympics. Here are some of the effects:\\n\\n1. Changes in Qualification: The qualifying process for curling and women\\'s ice hockey had to be altered due to the cancellation of tournaments in 2020. Qualification for curling was based on placement in the 2021 World Curling Championships and an Olympic Qualification Event. The women\\'s tournament qualification was based on existing IIHF World Rankings.\\n\\n2. Biosecurity Protocols: The International Olympic Committee (IOC) announced biosecurity protocols for the Games, which included a \"closed-loop management system\" where athletes had to remain within a bio-secure bubble. Athletes were required to undergo daily COVID-19 testing and could only travel to and from Games-related venues. Only residents of China were allowed to attend the Games as spectators.\\n\\n3. NHL Player Withdrawal: The National Hockey League (NHL) and National Hockey League Players\\' Association (NHLPA) announced that NHL players would not participate in the men\\'s hockey tournament due to concerns over COVID-19 and the need to make up postponed games.\\n\\n4. Limited Spectators: Ticket sales to the general public were canceled, and only limited numbers of spectators were admitted by invitation only. The Games were closed to the general public, with spectators only present at events held in Beijing and Zhangjiakou.\\n\\n5. Use of My2022 App: Everyone present at the Games, including athletes, staff, and attendees, were required to use the My2022 mobile app as part of the biosecurity protocols. The app was used for health reporting, COVID-19 vaccination and testing records, customs declarations, and messaging.\\n\\n6. Athlete Absences: Some top athletes, including Austrian ski jumper Marita Kramer and Russian skeletonist Nikita Tregubov, were unable to travel to China after testing positive for COVID-19, even if asymptomatic.\\n\\n7. COVID-19 Cases: There were a total of 437 COVID-19 cases linked to the 2022 Winter Olympics, with 171 cases among the COVID-19 protective bubble residents and the rest detected through airport testing of games-related arrivals.\\n\\nPlease note that this answer is based on the provided articles and may not include all possible impacts of COVID-19 on the 2022 Winter Olympics.'" + "\"COVID-19 had a significant impact on the 2022 Winter Olympics in several ways:\\n\\n1. **Qualification Changes**: The pandemic led to changes in the qualification process for sports like curling and women's ice hockey due to the cancellation of tournaments in 2020. Qualification for curling was based on placement in the 2021 World Curling Championships and an Olympic Qualification Event, while the IIHF used existing world rankings for women's ice hockey.\\n\\n2. **Biosecurity Protocols**: The IOC announced strict biosecurity protocols, requiring all athletes to remain within a bio-secure bubble, undergo daily COVID-19 testing, and only travel to and from Games-related venues. Athletes who were not fully vaccinated or did not have a valid medical exemption had to quarantine for 21 days upon arrival.\\n\\n3. **Spectator Restrictions**: Initially, only residents of the People's Republic of China were allowed to attend as spectators. Later, ticket sales to the general public were canceled, and only limited numbers of spectators were admitted by invitation, making it the second consecutive Olympics closed to the general public.\\n\\n4. **NHL Withdrawal**: The National Hockey League (NHL) withdrew its players from the men's hockey tournament due to COVID-19 concerns and the need to make up postponed games.\\n\\n5. **Quarantine and Testing**: Everyone present at the Games had to use the My2022 mobile app for health reporting and COVID-19 testing records. Concerns about the app's security led some delegations to advise athletes to use burner phones and laptops.\\n\\n6. **Athlete Absences**: Some top athletes, considered medal contenders, were unable to travel to China after testing positive for COVID-19, even if asymptomatic. This included athletes like Austrian ski jumper Marita Kramer and Russian skeletonist Nikita Tregubov.\\n\\n7. **Complaints and Controversies**: There were complaints from athletes and team officials about quarantine conditions, including issues with food, facilities, and lack of training equipment. Some athletes expressed frustration over the testing process and quarantine management.\\n\\n8. **COVID-19 Cases**: A total of 437 COVID-19 cases were reported during the Olympics, with 171 cases among the protective bubble residents and 266 detected from airport testing. Despite strict containment efforts, the number of cases was only slightly lower than those reported during the 2020 Tokyo Summer Olympics.\\n\\nOverall, COVID-19 significantly influenced the organization, participation, and experience of the 2022 Winter Olympics.\"" ] }, - "execution_count": 25, + "execution_count": 38, "metadata": {}, "output_type": "execute_result" } @@ -1641,7 +1472,7 @@ "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", - "version": "3.10.5" + "version": "3.9.6" }, "vscode": { "interpreter": {