Created
April 29, 2024 21:15
-
-
Save janduplessis883/6663448e68723632d652942b4767fd3c to your computer and use it in GitHub Desktop.
Local Ollama Rag.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| { | |
| "cells": [ | |
| { | |
| "cell_type": "markdown", | |
| "id": "d4d5cab6-515e-4dd6-95ae-6393f0c4435c", | |
| "metadata": {}, | |
| "source": [ | |
| "## Ingesting PDF" | |
| ] | |
| }, | |
| { | |
| "cell_type": "code", | |
| "execution_count": null, | |
| "id": "c2e8b999-83ba-484a-9b94-f56c201d2036", | |
| "metadata": {}, | |
| "outputs": [], | |
| "source": [ | |
| "%pip install --q unstructured langchain\n", | |
| "%pip install --q \"unstructured[all-docs]\"" | |
| ] | |
| }, | |
| { | |
| "cell_type": "code", | |
| "execution_count": 499, | |
| "id": "3c0e2f74-7c4b-4665-8d87-bc00656f31e0", | |
| "metadata": {}, | |
| "outputs": [], | |
| "source": [ | |
| "from langchain_community.document_loaders import UnstructuredPDFLoader\n", | |
| "from langchain_community.document_loaders import OnlinePDFLoader" | |
| ] | |
| }, | |
| { | |
| "cell_type": "code", | |
| "execution_count": 500, | |
| "id": "104c0b18-1c06-41a1-a2ca-f9ee23f4f952", | |
| "metadata": {}, | |
| "outputs": [], | |
| "source": [ | |
| "local_path = \"WEF_The_Global_Cooperation_Barometer_2024.pdf\"\n", | |
| "\n", | |
| "# Local PDF file uploads\n", | |
| "if local_path:\n", | |
| " loader = UnstructuredPDFLoader(file_path=local_path)\n", | |
| " data = loader.load()\n", | |
| "else:\n", | |
| " print(\"Upload a PDF file\")" | |
| ] | |
| }, | |
| { | |
| "cell_type": "code", | |
| "execution_count": 520, | |
| "id": "38119195-9c91-4e58-aa46-8a74244032af", | |
| "metadata": { | |
| "scrolled": true | |
| }, | |
| "outputs": [ | |
| { | |
| "data": { | |
| "text/plain": [ | |
| "'In collaboration with McKinsey & Company\\n\\nThe Global Cooperation Barometer 2024\\n\\nI N S I G H T R E P O R T\\n\\nJ A N U A R Y 2 0 2 4\\n\\nImages: Getty Images\\n\\nThe Global Cooperation Barometer 2024\\n\\nContents\\n\\nForeword\\n\\n3\\n\\nAbout the Global Cooperation Barometer\\n\\n4\\n\\nExecutive summary\\n\\n6\\n\\nIntroduction: The state of global cooperation\\n\\n7\\n\\nFive pillars of global cooperation\\n\\n9\\n\\nPillar 1 Trade and capital\\n\\n9\\n\\nPillar 2 Innovation and technology\\n\\n11\\n\\nPillar 3 Climate and natural capital\\n\\n13\\n\\nPillar 4 Health and wellness\\n\\n15\\n\\nPillar 5 Peace and security\\n\\n17\\n\\nConclusion: Towards a more cooperative future\\n\\n19\\n\\nAppendix: Sources and methodology\\n\\n20\\n\\nContributors\\n\\n22\\n\\nEndnotes\\n\\n23\\n\\nDisclaimer This document is published by the World Economic Forum as a contribution to a project, insight area or interaction. The findings, interpretations and conclusions expressed herein are a result of a collaborative process facilitated and endorsed by the World Economic Forum but whose results do not necessarily represent the views of the World Economic Forum, nor the entirety of its Members, Partners or other stakeholders.\\n\\n© 2024 World Economic Forum. All rights reserved. No part of this publication may be reproduced or transmitted in any form or by any means, including photocopying and recording, or by any information storage and retrieval system.\\n\\n2\\n\\nJanuary 2024\\n\\nThe Global Cooperation Barometer 2024\\n\\nThe Global Cooperation Barometer 2024\\n\\nForeword\\n\\nBob Sternfels Global Managing Partner, McKinsey & Company\\n\\nBørge Brende President, World Economic Forum\\n\\nThe launch of the Global Cooperation Barometer comes at the start of a crucial year, amid a period of immense geopolitical, geo-economic and market uncertainty, when the bedrock of what was once a stable global system is shifting underfoot. Leaders in the public and private sectors will need to gain fluency in the dynamics driving the changes to not just stabilize their position, but to be equipped to shape a beneficial future.\\n\\nseeking opportunities for collaboration. Notably, at the height of the Cold War, the United States and the Soviet Union coordinated on eradicating smallpox and addressing the ozone layer in the atmosphere. And many companies that compete with one another also find ways to cooperate in areas of mutual benefit.\\n\\nIt is within today’s complex geopolitical context that gaining an understanding of the shape of global cooperation – and competition – is vital. Leaders in business and government will need to recognize where the contours of opposition end and those of alignment begin to navigate through the geopolitical turbulence and also to shape a more cooperative future.\\n\\nIt is no secret that the current global context is concerning, as heightened competition and conflict appear to be replacing cooperation. The result is that new power dynamics, changing demographic realities and breakthrough frontier technologies are raising the temperature on long-simmering distrust rather than fueling opportunities for benefit. Many businesses are responding to these complicated – and often fraught – geopolitical developments by shifting operations and facilities closer to home.\\n\\nIt is for this reason that the World Economic Forum and McKinsey & Company developed the Global Cooperation Barometer. The purpose of this analysis, which uses 42 indicators to measure the state of global cooperation broadly and along five areas, is to help stakeholders in business and government gain a better understanding of the nature of cooperation that is, or is not, taking place.\\n\\nLeaders in business and government will need to recognize where the contours of opposition end and those of alignment begin to navigate through the geopolitical turbulence and also to shape a more cooperative future.\\n\\nYet, although the world is heading towards a dangerous divide by some measures, elsewhere there are prospects for and progress on cooperative arrangements. For instance, for the first time since countries began meeting to address global warming, an agreement was reached at the COP28 climate change conference on transitioning away from fossil fuels.\\n\\nOur hope is that the Global Cooperation Barometer will offer stakeholders a tool to use in shaping a healthier, more prosperous and more sustainable world in the year ahead and beyond.\\n\\nThat cooperation and confrontation can coexist should not come as a surprise. History is replete with parties at odds with one another, but still\\n\\n3\\n\\nAbout the Global Cooperation Barometer\\n\\nThe Global Cooperation Barometer is structured along five dimensions of global connection: trade and capital, innovation and technology, climate and natural capital, health and wellness, and peace and security.\\n\\nThese five pillars were chosen because of their impact on global development and their explicit dependence on cooperative efforts among nations and economies. As a guiding element in the analysis, the barometer identified goals that actors are working toward in each of these themes. In doing so, the barometer draws inspiration from the United Nations Sustainable Development Goals and the efforts of other global institutions.\\n\\nTo quantify change in these pillars, 42 indicators were identified that research suggests are either cooperative actions that advance progress on the goals of the pillars or demonstrate a broad outcome from those actions. Cooperative action metrics measure actions that provide evidence of cooperation; these indicators (such as flows of goods and exchange of intellectual property) are evidence of\\n\\nreal, manifested cooperation and do not include “on paper” commitments. Outcome metrics (such as life expectancy) measure the progress of cooperation, but typically are influenced by additional factors beyond just cooperation. The metrics span countries in all geographies and all levels of development.\\n\\nThe barometer looks back at the last 11 years, from 2012 through 2022 to establish a trend line of cooperation. It indexes data to 2020 for the following reason: as the COVID-19 pandemic took hold, it accelerated many trends existing in business and society and set in motion many new ones. Indexing the time series to 2020 allows us to see what trends were in place before the pandemic, and the trends that emerged from it (without influencing or distorting the trends themselves). Note that some metrics have been inverted such that any increase represents a positive development.\\n\\nThe methodology used for the Global Cooperation Barometer is outlined below. Details on sourcing of individual metrics are in the Appendix.\\n\\nThe Global Cooperation Barometer’s 5 pillars of global cooperation\\n\\nTrade and capital\\n\\nPromote global development and resilience Focus of analysis is on i) development and resilient outcomes; through ii) presence of global economic flows that promote likely opportunities for these outcomes\\n\\nInnovation and technology\\n\\nAccelerate innovation and beneficial technological progress Focus of analysis is on i) global progress in innovation and technology; through ii) presence of the global sharing of underlying knowledge that contributes to these outcomes by fostering collaboration across global talent\\n\\nClimate and natural capital\\n\\nSupport the resolution of climate and natural capital challenges Focus of analysis is on i) lowering of emissions, preservation of natural capital, and preparedness for likely impact of climate change; through ii) shared global goals/commitments that increase humanity’s ability to limit and adapt to the dynamics of a changing climate\\n\\nHealth and wellness Enable global population to lead longer and better lives Focus of analysis is on i) impact of the burden of disease on duration and quality of life; through ii) commitment to global public health standards and collaboration through flows of goods, R&D/IP and health financing\\n\\nPeace and security\\n\\nPrevent and resolve conflicts Focus of analysis is on i) prevention of death and long-term negative implications of conflict; through ii) commitment to multilateral peacekeeping operations and international stabilization efforts\\n\\n4\\n\\nData coverage\\n\\n1. Indexed trendlines\\n\\n1. Geography\\n\\nAcross all metrics, the barometer aims to collect global data. In most cases, an aggregate global weighted average is available. When a global weighted average is not available, the most comprehensive data is used (e.g. OECD countries, or a sample set of countries where data is available for all years).\\n\\n2. Years\\n\\nWhile the barometer measures cooperation from 2012 through 2022, a few metrics do not have data for all years. All metrics have 2020 data to ensure the indexed trendline can be calculated.\\n\\nData from 2020 serves as the base year to develop comparable trendlines, with all values in 2020 equal to 1 (2020=1). This base-year standardization is the basis of the score calculation, enabling a uniform reference point for all metrics and comparability, despite different units and datasets.\\n\\n2. Data normalization\\n\\nWhere possible, metrics are normalized to ensure that trendlines can be assessed independently of the effects of economic growth or population changes. For example, trade, capital, and other financial flows are normalized to global GDP, while migration metrics are normalized to global population levels.\\n\\n3. Weighting\\n\\nIndex calculation\\n\\nTo evaluate global cooperation fairly and compare trendlines of the action and outcome metrics across the five pillars, the global cooperation barometer applies the following methodology:\\n\\nEach pillar comprises two indices: an action index and an outcome index. To arrive at each, the metrics within are weighted equally (i.e. the action index is a simple average of metrics measuring cooperative actions). The overall index for a pillar is calculated as an average of the action and outcome metrics. Aggregate indices across pillars are also calculated as a simple average of pillar indices (i.e. equal weighting across pillars).\\n\\n5\\n\\nExecutive summary Cooperation is multifaceted and can coexist with competition.\\n\\nThe world is facing complex challenges. Addressing them demands cooperation at the global level.\\n\\nAfter trending positively for much of the past decade, global cooperation risks moving into reverse. The story varies by pillar:\\n\\nToday’s economy is in a fragile state, with growth expected to be well below the historical average, according to the International Monetary Fund (IMF).1 Revitalizing trade will be crucial to strengthening the economic outlook ahead and boosting livelihoods. However, the IMF has raised alarms about the possibility of global fragmentation, which could shave off 7% of global GDP.2\\n\\nSimilarly, technological innovation is key to boosting currently sluggish productivity growth, with generative artificial intelligence (AI) holding extraordinary potential – $2.6 trillion to $4.4 trillion in additional annual value across industries, as estimated by the McKinsey Global Institute.3 The only way to unlock this benefit and manage undesirable consequences is through global coordination.\\n\\n– Trade and capital: trade and capital cooperation\\n\\ngrew through the pandemic disruption, but slowed in 2023; geopolitical tensions and new restrictions make the future path unclear.\\n\\n–\\n\\nInnovation and technology: flows of data, IP and international students powered an increase in cooperation until 2020, but new questions have arisen about how to work together to harness opportunities.\\n\\n– Climate and natural capital: the level of\\n\\ncooperation for climate and natural capital has been rising steadily, due in large measure to an increase in commitments, but emissions also continue to rise.\\n\\nClimate change requires governments and businesses to work together to reach net zero, adapt to shifts in climate already locked in by previous emissions, and do all of this in a way that supports economic development across the globe. Just like the health of the planet, the health of people requires cooperation globally between governments and businesses. Long-term advancements in health and immediate responses to acute crises like pandemics require parties around the world to work together. Yet, in terms of addressing the health and well-being of people and the planet, the world appears off course, with just 15% of the Sustainable Development Goals on track.4\\n\\n– Health and wellness: cooperation in health and wellness rose swiftly in response to the pandemic, but appears to be settling back to historical patterns.\\n\\n– Peace and security: cooperation in peace and security has declined since 2016 and plummeted recently.\\n\\nBecause it is unlikely that the current geopolitical climate will change and competition and confrontation will soon cool, the barometer suggests that leaders in business and government should reimagine cooperation.\\n\\nYet, as cooperation is becoming an imperative, the world order appears to be fragmenting. Indeed, the global security landscape – once a largely cooperative domain in the post-Cold War era – is deteriorating, with the United Nations noting at the start of 2023 that the world was witnessing the highest number of violent conflicts since World War II.5\\n\\nThe barometer shows that cooperation is multifaceted, and elements of cooperation can coexist with elements of rivalry. Leaders can practice “coopetition” – balancing cooperation and competition – to advance shared interests in specific areas, despite lack of alignment elsewhere. Further, leaders can use these instances of cooperation to build mutual trust, which in turn could strengthen cooperation in other areas.\\n\\nThe Global Cooperation Barometer 2024 presents an approach to measure the current state of global cooperation. In doing so, the report is meant to serve as a tool for leaders to better understand the contours of cooperation broadly and along five pillars – trade and capital flows, innovation and technology, climate and natural capital, health and wellness, and peace and security.\\n\\nFundamentally, companies and countries should remember that cooperation breeds strength and resilience. Those that thoughtfully and constructively manage relationships bounce back better from challenges and achieve objectives.6\\n\\n6\\n\\nIntroduction The state of global cooperation Measuring cooperation is a critical step in identifying ways to strengthening it.\\n\\nThe world is facing a plethora of challenges that require global cooperation to solve. Global temperatures shattered previous highs and last year was the hottest on record.7 And, over 114 million people have been forcibly displaced worldwide – the highest level ever.8 At the same time, ongoing threats of a pandemic and the risks of new, unregulated technologies warrant concern.\\n\\nCooperation is not only necessary as a reactive mechanism to address threatening global developments, but it is also needed to unlock new opportunities. Indeed, generative AI has the potential to contribute as much as $2.6 trillion to $4.4 trillion to the global economy, but requires substantial coordination across the global ecosystem to mitigate risks and ensure benefits are shared widely.9\\n\\nRecent history has shown that global cooperation can deliver profound benefits. During the first quarter-century after the end of the Cold War – a period largely seen as a high point for global cooperation – expanded trade lifted global incomes and as a result, the number of people living in extreme poverty was cut in half.10 Instances of the international community reflexively coming together during this period are most evident through security coordination in the aftermath of the September 11, 2001 attacks, financial coordination in the wake of the global financial crisis in 2008, which included upgrading the G20, and global commitments to address the growing danger of climate change through the 2015 signing of the Paris Climate Agreement.\\n\\nDespite the challenging context, the story about global cooperation is not black and white. Countries and companies can compete while also cooperating. Competition, and even confrontation, can spike in one area while cooperation can deepen in others. In a notable example, in 2022, amid heightened tensions between the United States and China, as climate negotiations between both countries were suspended and talk of decoupling dominated airwaves, bilateral trade reached record levels.13\\n\\nTo help develop a better understanding of the current state of global cooperation, this report presents the Global Cooperation Barometer – a tool that examines cooperation in five pillars: trade and capital, innovation and technology, climate and natural capital, health and wellness, and peace and security. The five pillars were chosen because, given the interconnected nature of the world, cooperation at the global level is necessary to see advancements in each of these areas.\\n\\nOverall, the barometer indicates that after trending positively for much of the past decade, global cooperation has been mildly reversing (down 2%) since 2020 (Figure 1). The period from 2012 to the pandemic was marked by increased cooperation across four of the five pillars (peace and security was the exception), led by innovation and technology’s more than 30% increase in cooperation (Figure 2). However, in more recent years new questions have arisen about how to work together to harness opportunities that arise from innovation.\\n\\nOverall, the\\n\\nbarometer indicates that after trending positively for much of the past decade, global cooperation has been mildly reversing (down 2%) since 2020.\\n\\nBy many accounts, the geopolitical dial turned from cooperation to competition in the mid-2010s, as nationalist forces increased in many countries and protectionist policies rose.11 The dial then turned further away from cooperation as conflict broke out in Europe, Africa and the Middle East in recent years, with the UN warning in early 2023 that the world was witnessing the highest level of violent conflict since World War II.12\\n\\n7\\n\\nF I G U R E 1\\n\\nOverall global cooperation\\n\\nAverage index of cooperation metrics [2020=1]\\n\\n1.1\\n\\n1.0\\n\\n0.9\\n\\n0.8\\n\\n0.7\\n\\n0.6\\n\\n2012\\n\\n2013\\n\\n2014\\n\\n2015\\n\\n2016\\n\\n2017\\n\\n2018\\n\\n2019\\n\\nSource: McKinsey & Company\\n\\nThe main drags on overall cooperation since 2020 have been declines in cooperation in the health and wellness pillar and the peace and security pillar. For the latter pillar, the trend was broadly negative from 2016 until the pandemic and deteriorated rapidly after 2020 due to significant increases in forcibly displaced people and deaths from conflict.\\n\\nDespite this concerning trend, there have been signs of growing cooperation. The level of cooperation for climate and natural capital has been\\n\\nF I G U R E 2\\n\\nCooperation trends by pillar\\n\\nAverage index of cooperation metrics [2020=1]\\n\\n1.1\\n\\n1.0\\n\\n0.9\\n\\n0.8\\n\\n0.7\\n\\n0.6\\n\\n2012\\n\\n2013\\n\\n2014\\n\\n2015\\n\\n2016\\n\\n2017\\n\\n2018\\n\\n2019\\n\\nSource: McKinsey & Company\\n\\nOverall global cooperation\\n\\n2020\\n\\n2021\\n\\n2022\\n\\nrising steadily, due in large measure to cooperative efforts since 2020 around commitments. In the trade and capital pillar, cooperation showed signs of growing through the pandemic disruption (but signs are of moderation in 2023).\\n\\nThe following chapter examines the changes in global cooperation in each of the five pillars and is followed by a series of recommendations for helping leaders reimagine global cooperation in a new era.\\n\\nTrade and capital Climate and nature\\n\\nInnovation and technology\\n\\nHealth and wellness\\n\\nPeace and security\\n\\n2020\\n\\n2021\\n\\n2022\\n\\nFive pillars of global cooperation Measuring along five pillars presents a dynamic, complex picture of cooperation.\\n\\nThe Global Cooperation Barometer measures global cooperation across five areas, or pillars: trade and capital flows, innovation and technology, climate and natural capital, health and wellness, and peace and security.\\n\\nEach pillar examines evidence of cooperative actions and outcomes of cooperative action to determine an overall level of global cooperation in that area.\\n\\nPillar 1\\n\\nTrade and capital\\n\\nThe trade and capital pillar looks at cooperation in promoting global growth, development and resilience through global economic integration. It reflects the interconnected nature of the modern global economy through dynamics in trade, capital and people flows, all of which are an essential driver of global growth.\\n\\nbut experienced significant volatility during the pandemic and years immediately after, particularly in capital flows and labour migration patterns which declined relative to 2020. However, most metrics (e.g. goods trade, development assistance and developing countries’ share of FDI and manufacturing exports) returned to strong growth in the post-pandemic period, driving up the overall trend (Figure 3).\\n\\nFrom 2012-2020, cooperation in the form of global trade and capital flows rose moderately,\\n\\nF I G U R E 3\\n\\nPillar 1: Trade and capital\\n\\nIndex [2020=1]\\n\\nCompound annual growth rate (CAGR) %\\n\\n6\\n\\n5 -\\n\\n4\\n\\n3\\n\\n2\\n\\n1\\n\\n0\\n\\n1\\n\\n2\\n\\n3\\n\\n4\\n\\n5\\n\\n6\\n\\n7\\n\\n8\\n\\n1.1\\n\\nTrade and capital index\\n\\n1.0\\n\\nDev. countries’ share of FDI\\n\\nGoods trade\\n\\nODA\\n\\n0.9\\n\\nServices trade\\n\\nDev. countries’ share of mfg. exports*\\n\\n0.8\\n\\nTrade concentration* ,1\\n\\nRemittances\\n\\nLabour migration\\n\\n0.7\\n\\nFDI stock\\n\\nForeign portfolio investment (FPI)\\n\\n0.6\\n\\n2012\\n\\n13\\n\\n14 15 16 17 18 19 20 21 2022\\n\\n2012-2020\\n\\n2020-2022\\n\\nOutcome metrics\\n\\nNotes: 1. Metrics were reflected given negative connotation. Note: Due to missing data in some metrics, data from the closest years are used to calculate the trend. These metrics include labour migration, international students, cross-border IP R&D, trade in IT services, terrestrial protected areas, cross-border flows of pharma R&D, development assistance for health, child mortality, maternal mortality.\\n\\nSource: McKinsey & Company\\n\\n9\\n\\n10\\n\\n9\\n\\n2012-2022: Moderate growth in cooperation, followed by pandemic-related shake-ups\\n\\nworld and more multinationals relied on financing to navigate the disruption. After this initial surge, however, capital flows normalized. FDI stocks retreated to 44% of GDP in 2022 relative to 49% and 47% in 2020 and 2021, respectively.\\n\\nGlobal cooperation in the trade and capital pillar increased at an average annual rate of 0.9% between 2012-2020, driven by growth in the stock of foreign direct investment (FDI) positions across many countries. Globally, FDI stock rose from 30% in 2012 to 49% in 2020, as a share of GDP.\\n\\nInclusive potential and unanswered questions\\n\\nTrade presents a more mixed story in this period. Services flows (as a percentage of GDP) rose steadily between 2012-2019, when a collapse in travel triggered a fall in services from 13.7% of GDP in 2019 to 11.8% in 2020. Goods flows declined from 49.3% of GDP in 2012 to 41.9% in 2020.\\n\\nThe COVID-19 pandemic and the years that followed shook up trade and capital flows. Despite this, there has been a continued net increase, though it has been moderate. Trade flows fell in the immediate wake of quarantines and then rebounded strongly. At the onset of the pandemic, consumer demand decreased sharply and some production and shipping ground to a halt. Yet, trade soon rebounded as homebound consumers started spending more on goods. Countries remained interconnected and cooperative out of necessity as the world navigated a once-in-a-century event and this pattern persisted through 2022. For example, from 2021 to 2022, the flow of goods as a share of GDP increased by 10%, reaching a historical peak at 51% of GDP (up from 46.7% in 2021).\\n\\nAs for capital flows, they normalized after an initial spike in 2020 (for FDI) and 2021 (for foreign portfolio investment).14 As COVID-19 surged, flows of capital increased as banks reallocated liquidity around the\\n\\nIn a sign of what may come next, trade in 2023 grew more slowly than GDP, at an estimated 0.8% (nearly 2 percentage points lower than 2022) as compared to GDP growth of 2.6%.15 If barriers to trade continue to grow, some countries could suffer from slower economic growth and a decline in the diffusion of productivity and innovation.16 Nonetheless, a recent examination17 indicates that advanced economies have been boosting trade with emerging market economies, and also increasing greenfield FDI perhaps in advance of larger increases to come. For example, the United States has been trading more with Mexico and Viet Nam, and China has increased trade and investment across South-East Asia.\\n\\nThese trends could improve opportunities for global participation in trade and capital flows. Today, there is great disparity in global integration – some smaller European and Asian city-state economies are among the most integrated, while many emerging nations show low levels of trade relative to their size. Closing this gap between more and less integrated countries could lead to significant economic benefits. The question is whether leaders will work to rebuild the economic connections needed to promote growth, foster diversity, provide resilience, improve domestic economies and ensure that vulnerable people are not left behind.\\n\\n10\\n\\nPillar 2\\n\\nInnovation and technology\\n\\nThe innovation and technology pillar examines how global cooperation, through exchanges of knowledge and people, accelerates innovation and creates beneficial technological progress.\\n\\nin cross-border data flows and IT services trade). Since 2020, cooperation has leveled off, with critical aspects starting to decline (e.g. cross- border patent applications and international student flows) (Figure 4).\\n\\nFrom 2012-2020, innovation and technology cooperation maintained strong and significant growth across most barometer metrics (particularly\\n\\nF I G U R E 4\\n\\nPillar 2: Innovation and technology\\n\\nIndex [2020=1]\\n\\nCompound annual growth rate (CAGR) %\\n\\n5 -6 -5\\n\\n0 0\\n\\n5 5\\n\\n10 10\\n\\n15 15\\n\\n1.1\\n\\nInnovation and technology index\\n\\n1.0\\n\\nIndividuals using the internet*\\n\\nIT services trade\\n\\n0.9\\n\\nCross-border data flows\\n\\nTotal factor productivity growth*\\n\\nAverage price of a lithium ion battery*\\n\\n,1\\n\\n0.8\\n\\nCross-border R&D\\n\\nCross-border patent applications\\n\\n0.7\\n\\nIT goods/intermediates trade\\n\\nInternational students\\n\\n0.6\\n\\n2012 13\\n\\n14 15 16 17 18 19 20 21 2022\\n\\n2012-2020\\n\\n2020-2022\\n\\nOutcome metrics\\n\\nNotes: 1. Metrics were reflected given negative connotation. Note: Due to missing data in some metrics, data from the closest years are used to calculate the trend. These metrics include labour migration, international students, cross-border IP R&D, trade in IT services, terrestrial protected areas, cross-border flows of pharma R&D, development assistance for health, child mortality, maternal mortality.\\n\\nSource: McKinsey & Company\\n\\n2012-2022: Significant, sustained increase arrested by the pandemic\\n\\nGlobal cooperation in innovation and technology advanced significantly from 2012-2020, likely because these years saw a significant shift toward digital services, including cloud computing and applied AI. Rapid growth in technological streams such as intellectual property and data far outpaced growth in physical goods exchanges,18 with global data flows tripling and IT services trade doubling. At the same time, both the numbers of international students and cross-border R&D activity grew steadily.\\n\\nStill, measuring how cooperation has contributed to developments in technology and innovation is complicated, but some metrics point to signs of cooperation. For example, the price of lithium- ion battery cells, a critical component enabler for the energy transition, fell by 80%. The fall in cost reflected cooperation of countries across the global supply chain (e.g. basic research conducted in the US and Japan; mass production capabilities in China, where 70%+ of global supply originates; and extraction of raw materials in Australia and Chile, among other countries).19\\n\\n11\\n\\nYet, total factor productivity (TFP; also called multifactor productivity), while not the only indicator of technological progress, is a useful measurement of overall innovation – it measures the ratio of overall output (GDP) to overall inputs, with innovation a key factor in increasing the productivity level.20 This metric remained virtually stagnant from 2012-2020, averaging -0.1% annual growth over the past decade after a strong start of annual growth of 0.4% in the early 2010s.\\n\\nRedoubling efforts to promote innovation through public and private sector partnerships\\n\\nGiven recent trends and the growing uncertainty over the continued path of equitable technological progress, global leaders will need to address (at least) two critical areas of cooperation.\\n\\nSince the outset of the COVID-19 pandemic, trends in technology and innovation have become more mixed. While the pandemic drove widespread remote working for white-collar workers that supported continued growth in cross-border data flows and relatively robust IT services growth, other trends in global cooperation have experienced broad deceleration.\\n\\nPerceived risks to national security have contributed to the deceleration. The race to dominate the frontiers of technology development has led to import and export bans on 5G network technologies, limitations on semiconductors and bans on some social media platforms.21 From 2021-2022, restrictions on products in the IT goods sector grew five times faster than trade restrictions overall. Trade in IT goods and intermediates (e.g. laptop components) as a share of GDP declined by 5% during the same period. The share of cross-border patents also fell sharply to the lowest point in the past decade. And cross-border data flows declined by 2%.\\n\\nThe first is to commit to greater cross-border collaboration through foundational R&D, international student exchanges and cross-border patent applications. For example, the US and China collaborated on AI publications more than any other country pair from 2010 to 2021. The number of publications grew roughly four-fold since 2010, but only 2.1% from 2020 to 2021.22 Broadening the potential base of collaborative networks (potentially through the continued expansion of universities in low- and middle-income countries (LMICs) or increased public sector support of exchange programmes for researchers) will be important to minimizing the potential for the gains of innovation and technology to become increasingly concentrated in fewer hands.\\n\\nThe second area is working to harmonize and simplify approaches to global regulation of frontier technologies. Generative AI is the most recent prominent example – this technology has the potential to add up to $4.4 trillion in value to the global economy,23 but there are significant risks and concerns that need to be allayed for successful deployment of the technology (e.g. AI-related incidents and controversies have risen 26-fold since 2012).24 There have been multiple regulatory frameworks advanced to manage generative AI, but despite efforts from public-sector leaders,25 no consistent global framework has yet emerged.\\n\\n12\\n\\nPillar 3\\n\\nClimate and natural capital\\n\\nThe climate and natural capital pillar looks at the impact of cooperation on the remediation and resolution of challenges to the global climate and natural capital. The focus is on lowering emissions, preserving natural capital and preparing for the likely impact of climate change through shared global goals that increase humanity’s ability to limit and adapt to a changing climate.\\n\\nClimate and natural capital is the sole pillar in which the majority of indicators rose across the entire period of 2012-2022, with sustained positive trends in financial commitments to mitigation and adaptation and a significant expansion of marine- protected areas. But, emissions continue to increase and progress toward ecological outcomes is stagnant (Figure 5).\\n\\nF I G U R E 5\\n\\nPillar 3: Climate and natural capital\\n\\nIndex [2020=1]\\n\\nCompound annual growth rate (CAGR) %\\n\\n0\\n\\n5\\n\\n10\\n\\n1.1\\n\\nClimate and natural capital index\\n\\n1.0\\n\\nMitigation finance\\n\\nAdaptation finance\\n\\n0.9\\n\\nEmissions intensity*\\n\\n,1\\n\\nLow-carbon goods trade\\n\\nMarine protected area\\n\\n0.8\\n\\nTerrestrial protected area\\n\\nOcean Health Index*\\n\\n0.7\\n\\nBiodiversity Intactness Index*\\n\\nEmissions*\\n\\n,1\\n\\n0.6\\n\\n2012 13\\n\\n14 15 16 17 18 19 20 21 2022\\n\\n2012-2020\\n\\n2020-2022\\n\\nOutcome metrics\\n\\nNotes: 1. Metrics were reflected given negative connotation. Note: Due to missing data in some metrics, data from the closest years are used to calculate the trend. These metrics include labour migration, international students, cross-border IP R&D, trade in IT services, terrestrial protected areas, cross-border flows of pharma R&D, development assistance for health, child mortality, maternal mortality.\\n\\nSource: McKinsey & Company\\n\\n2012-2022: Steady increase in commitments with rising emissions\\n\\nglobal economy (by market capitalization) have set science-based targets for emissions reductions.26 Associated trade and investment also rose.\\n\\nThe period of 2012-2020 showed significant growth in financing commitments towards both climate mitigation and adaptation, with finance flows for mitigation nearly doubling and flows for adaptation rising by 56% as a share of GDP.\\n\\nNet-zero commitments in the private sector have also proliferated, with groups such as Glasgow Financial Alliance for Net Zero (GFANZ), the Task Force of Climate-Related Financial Disclosures (TCFD) and the Science Based Targets initiative (SBTi) growing in influence. Companies representing over 34% of the\\n\\nOn nature, advancement was mixed. More of the world became protected: the global percentage of marine protected areas increased by over 60%, while the share of terrestrial protected areas grew nearly 8% (from a considerably larger base) over the same time window. However, ocean health and biodiversity remained stable over this period, suggesting limited impact (to date) of these initiatives. This trend threatens the survival of one million species around the world,27 as well as the livelihoods of one in five people who rely on wild species for food and income.28\\n\\n13\\n\\nDespite progress on cooperative actions, real- world impact has not materialized at the same pace. Emissions intensity (emissions relative to GDP) improved over the decade (reducing at an average annual rate of 1.8%29), reflecting advances in electrification, decreases in heavy industry and increasing presence of renewable energy sources. However, the pace at which absolute emissions have risen has remained virtually unchanged over the past decade.\\n\\nBolstering cooperation to achieve interdependent climate objectives\\n\\nFour interdependent objectives are required to achieve the net-zero transition: emissions reduction, affordability, reliability and industrial competitiveness.31 All four require a redoubling of efforts on international cooperation across both public and private sectors.\\n\\nFor many indicators, the years 2020-2022 either maintained prior trends or represented an uptick in progress. Mitigation financing grew by almost 14%; adaptation financing grew by over 13% (both as a percentage of GDP). There was continued focus on driving public commitments to low-carbon growth with a step-change in impact; the share of countries by GDP with long-term low-carbon development strategies grew from 15% in 2020 to 82% in 2022.30\\n\\nHowever, the signs were not all positive in this period. While 2020 represented an anomaly in terms of emissions growth (falling by 3.5% given the pandemic-driven cessation in many core drivers of emissions), by 2021 emissions had retained their upward momentum and by 2022 they were 5.7% higher than 2020 and 2.4% higher than 2019.\\n\\nTo achieve these objectives, spending must be allocated effectively, focusing on creating incentives to deploy lower-cost solutions (e.g. solar/wind power) and reducing the costs of expensive solutions (e.g. passenger battery EVs; onshore wind power). At the same time, energy systems must be redesigned, with parties anticipating and removing bottlenecks for materials (e.g. lithium and nickel), land, infrastructure and labour. Energy markets and planning approaches for an electrified world also need to be prioritized (e.g. incentives for companies generating electricity to provide flexible capacity to support wind/solar transition). All of these efforts will demand greater collaborative action.\\n\\n14\\n\\nPillar 4\\n\\nHealth and wellness\\n\\nThe health and wellness pillar examines the impact of global cooperation in enabling people worldwide to lead longer and healthier lives. The focus is on understanding the burden of disease on the duration and quality of life and the growing commitments to global public health standards and collaboration through flows of goods, R&D/IP and health financing.\\n\\nCooperation on health and wellness rose consistently from 2012 to 2020 and was essential in certain ways to navigate the COVID-19 pandemic, for example through the development of vaccines (though not their distribution). Since the peak in 2020, cooperation in these areas has declined slightly (Figure 6).\\n\\nF I G U R E 6\\n\\nPillar 4: Health and wellness\\n\\nIndex [2020=1]\\n\\nCompound annual growth rate (CAGR) %\\n\\n5 -\\n\\n0\\n\\n5\\n\\n10\\n\\n1.1\\n\\nHealth and wellness index\\n\\n1.0\\n\\nChild mortality*\\n\\n,1\\n\\nHealth-related goods trade\\n\\n0.9\\n\\nMaternal mortality*\\n\\n,1\\n\\nIHR score\\n\\n0.8\\n\\nDALYs*\\n\\n,1\\n\\nLife expectancy at birth*\\n\\n0.7\\n\\nDevelopment assistance for health\\n\\nCross-border pharma R&D\\n\\n0.6\\n\\n2012 13\\n\\n14 15 16 17 18 19 20 21 2022\\n\\n2012-2020\\n\\n2020-2022\\n\\nOutcome metrics\\n\\nNotes: 1. Metrics were reflected given negative connotation. Note: Due to missing data in some metrics, data from the closest years are used to calculate the trend. These metrics include labour migration, international students, cross-border IP R&D, trade in IT services, terrestrial protected areas, cross-border flows of pharma R&D, development assistance for health, child mortality, maternal mortality.\\n\\nSource: McKinsey & Company\\n\\n2012-2022: Steady growth and then a pandemic surge, with outcomes negatively impacted by COVID-19\\n\\nPrior to 2020, most indicators of health cooperation – development assistance for health, trade in health goods, and flows of health-related R&D and IP – grew slowly and steadily. Health outcomes – life expectancy, disability-adjusted life years (DALYs), maternal and child mortality – improved from 2012 through 2019, due in part to an increase in healthcare development aid and global efforts to address preventable and controllable diseases.\\n\\nIn 2020, cooperation in certain areas surged in response to the pandemic. Cross-border flows of pharma R&D/IP (as a share of GDP) nearly doubled. Development assistance for health jumped 40%. International scientists made the COVID-19 genome freely available, accelerating vaccine development, and health-related aid flowed to emerging economies. International agencies, such as Gavi, also played a pivotal role in providing basic life- saving vaccines.32\\n\\nWhile there were major boosts to some aspects of global cooperation in reaction to the pandemic, other areas lagged significantly and, in some cases, reinforced existing inequities. Disparities in the distribution of vaccines33 and competition for scarce\\n\\n15\\n\\nThe Global Cooperation Barometer 2024\\n\\nresources like protective and testing equipment34 impeded collective resolution of the pandemic. There was a retrenchment in development assistance as a percentage of GDP of ~15% for health in 2021 (admittedly from the high watermark in 2020 as 2021 remained almost 25% higher than 2019).\\n\\nin the pandemic longstanding institutions such as the Coalition for Epidemic Preparedness Innovations (CEPI) and the World Health Organization (WHO) saw their budgets rise by 15% from pre-COVID levels37 and continued growth in funding is needed. New mechanisms, like the G20’s $1.4 billion Pandemic Fund38 and the Partnerships for African Vaccine Manufacturing (PAVM), offer promising avenues for continued collaboration.39 The WHO’s Pandemic Preparedness Treaty (to be considered in 2024) is a prime example of international cooperation in progress, demonstrating how global leaders are working together to enhance pandemic prevention and response efforts through a comprehensive treaty framework.40\\n\\nAs the immediate impact of COVID-19 subsides, global health cooperation appears to be decreasing but remains above 2019 levels for certain metrics (e.g. reductions in child mortality continue). However, other metrics present a more mixed picture; overall life expectancy and DALYs35 suffered due to COVID-19-related deaths and the diversion of resources from other health priorities. Life expectancy at birth declined from 72.8 to 71.0 from 2019 to 2021. Malaria deaths rose by 10% from 2019 to 2020.36 And maternal mortality rates increased for the first time in three decades.\\n\\nBeyond pandemic efforts, there are four broader areas where redoubling cooperation will be essential. International partnerships will play an integral role in coordinating and deepening basic research on a variety of health conditions, ranging from chronic disease to accelerating approaches to clinical trials on frontier conditions.41 Sustained cooperation is needed to tackle the continued proliferation of synthetic drugs globally (of which the UN Synthetic Drug Strategy in 2021 and the July 2023 launch of the Global Coalition to Address Synthetic Drug Threats42 are two prominent examples). There is significant potential to coordinate emerging best practices to support improved outcomes in mental health in the working- age population (e.g. approaches to support/leave for parents and caregivers).43 Finally, coordinated approaches are needed to engage and increase participation of ageing populations (where the global population of people over the age of 65 is forecast to reach 16.5% by 2050, up from 9.4% today).44\\n\\nRedoubling efforts on pandemic- era cooperation and addressing chronic health and wellness challenges\\n\\nNational governments and private companies can learn from the instances in which resources and expertise were pooled during the pandemic. Many of the global health norms and infrastructure established during the pandemic (and before) can be preserved to support improved health outcomes and meet the test of future pandemics, aging populations, and chronic conditions. For example,\\n\\n16\\n\\nPillar 5\\n\\nPeace and security\\n\\nThe peace and security pillar looks at the impact of global cooperation in preventing and resolving conflicts. The focus is on the prevention of death and ameliorating the long-term negative implications of conflict through commitment to multilateral peacekeeping operations and international stabilization efforts.\\n\\nCooperation trends in peace and security demonstrated considerable decline starting in 2016 (Figure 7). This trend is driven by a rise in forcibly displaced people and cyberattacks, and a recent rise in the number of conflicts and conflict-related deaths, indicating an increasingly unstable global security environment and increased intensity of conflicts.\\n\\nF I G U R E 7\\n\\nPillar 5: Peace and security\\n\\nIndex [2020=1]\\n\\nCompound annual growth rate (CAGR) %\\n\\n-70\\n\\n-60\\n\\n-50\\n\\n-40\\n\\n-30\\n\\n-20\\n\\n-10\\n\\n0\\n\\n1.1\\n\\nPeace and security index\\n\\n1.0\\n\\nSignificant cyber incidents*\\n\\n,1\\n\\n0.9\\n\\nRatio of multilateral peacekeeping operations-to-conflicts\\n\\nForcibly displaced people*\\n\\n,1\\n\\n0.8\\n\\nConflicts\\n\\n1\\n\\n0.7\\n\\nRatio of UNSC resolutions-to-conflicts\\n\\nFatalities from conflict*\\n\\n,1\\n\\n0.6\\n\\n2012 13\\n\\n14 15 16 17 18 19 20 21 2022\\n\\n2012-2020\\n\\n2020-2022\\n\\nOutcome metrics\\n\\nNotes: 1. Metrics were reflected given negative connotation. Note: Due to missing data in some metrics, data from the closest years are used to calculate the trend. These metrics include labour migration, international students, cross-border IP R&D, trade in IT services, terrestrial protected areas, cross-border flows of pharma R&D, development assistance for health, child mortality, maternal mortality.\\n\\nSource: McKinsey & Company\\n\\nRising displacement and cyberattacks, sharp declines in peace and security\\n\\nAlthough the number of global conflicts declined from approximately 18,000 in 2012 to 13,000 in 2020, suggesting that peace and security had improved, other indicators show a deteriorating landscape. Forcible displacement has grown markedly, with the number of forcibly displaced people nearly doubling between 2012 and 2020 (from 42 million to 82 million). Syria accounted for 24% of the additional 40 million people; Venezuela 12% and Yemen 8%.\\n\\nA second development also lowered the score for global cooperation on peace and security – cyberspace became a new theater for conflicts. Between 2012 and 2020, significant cyberattacks45 quadrupled in number and became more costly. It is estimated that global cybercrime cost the world economy $1 trillion in 2020.46 Cyberattackers have reached across national borders to target space systems and other critical infrastructure, sent malware attacks against central private sector organizations (like oil companies47), conducted the first successful attack on a power grid,48 breached defenses at government agencies49 and attacked health system infrastructure.50\\n\\n10\\n\\n17\\n\\nThe devastating human costs of conflicts have grown immensely over the last two years. Though the level of conflict is similar to 2014, today’s battles are proving more deadly and destructive. In recent years, fatalities from conflict have risen dramatically to roughly 240,000 in 2022 – a nearly three-fold increase since 2020 and well above the previous peak of 150,000 in 2014. On average, deaths per conflict remained steady between 2012 and 2020 but have more than doubled since then.\\n\\nIn addition, global attempts at conflict resolution have not kept pace. The ratio of United Nations Security Council resolutions to the number of conflicts was 0.43:1 in 2020; that fell to 0.31:1 in 2022. Similarly, the ratio of peacekeeping operations to conflicts was 0.47:1 in 2020 and 0.36:1 in 2022.\\n\\nSupporting vulnerable populations could start by addressing two critical needs. The first is managing the integration of refugee populations from conflict zones. For example, 58% of Ukraine’s 6.4 million refugees have now moved beyond Ukraine’s immediately neighbouring countries and may place strains on the social net or cohesion of Europe’s poorer countries if not integrated.53 The UN’s Regional Refugee Response Plan, a well-organized and rapidly scaled international humanitarian aid programme, provides an example of how to address critical immediate needs.54 Supporting leading practices in improving the integration of refugees in the medium term will be essential for allowing both refugees and host communities to benefit from these shifts,55 especially given tight labour market conditions in developed countries.\\n\\nForcible displacement also rose sharply in 2022, reaching a record for the period (of 2012-2022) at 108.4 million people,51 up from 89.3 million in 2021 (an increase of ~18%). More than 13 million people from Syria were displaced, as were 11.6 million from Ukraine and 10.2 million from Afghanistan.\\n\\nIn terms of cyberattacks, the number of significant cyberattacks remained stable from 2020 to 2022, at around 11.3 per month. However, in the context of the conflict in Ukraine, Russian attacks on Ukraine internet users rose by 250% and attacks on NATO countries by more than 300% in the same period, and these cyberattacks were coordinated with kinetic attacks to support ground efforts, representing a new twist in cyberwarfare.52\\n\\nThe second is identifying mechanisms and approaches that will support impacted individuals in conflict zones, particularly inflows of funds to support the provision of basic needs and reduce friction in aid flows without compromising compliance, security, and risk standards. This will require close collaboration between public sector approaches to financial crime regulation, private sector organizations with expertise in money transmission and the 10 million non-profit organizations who serve across a variety of needs.\\n\\nFinally, given the evolving nature of cyberattacks and potential linkages to kinetic efforts, there is a need for redoubling cooperative efforts in the cyber domain, integrating public and private sector actors to boost sharing of data flows on cybersecurity threats, and identifying patterns of anomalous activity and new threat vectors.\\n\\nSupport for vulnerable populations and cyber collaboration\\n\\nGiven challenging trends in peace and security in the past decade, the public and private sectors should focus energies on supporting vulnerable populations and finding new mechanisms of collaboration to respond to the evolving challenge of cyberattacks.\\n\\n18\\n\\nConclusion Towards a more cooperative future Even in today’s challenging geopolitical context leaders can take steps to forge greater cooperation.\\n\\nIn the context of the barometer findings, what can leaders in the public and private sectors do to protect their interests and help foster global cooperation?\\n\\nPractice “coopetition” Amid an era of heightened geopolitical competition, parties should not take competition to mean cooperation is impossible, or that a decline in cooperation in one area means cooperation is impossible elsewhere. Instead, parties should focus on identifying avenues toward advancing shared interest that can exist despite competition – a practice known in the private sector as “coopetition”.56\\n\\nrole of their organization in supporting global cooperation in specific areas or with specific outcomes in mind. This may also require upgrading the board’s understanding given the complexities and nuances of these issues, drawing on the latest research and frameworks. Boards may want to invite global experts for regular sessions to discuss the latest developments, potential scenarios, and implications for the organization. Boards should also be more proactive in pressure- testing management on the potential controls or mitigations established to counteract the impact of declines in global cooperation.\\n\\nUse cooperation to beget cooperation While cooperation can coexist with competition, cooperation can also be used to increase overall trust and diminish unnecessary rivalry or conflict. Parties should use instances of cooperation to not only advance interests in that area but also as an opportunity to explore other potential areas of alignment and to deepen trust with counterparts.\\n\\nRaise the capabilities of management Every company, especially the largest multinationals, will be touched in some way by the ongoing mutations in globalization (including global trade flows).57 Cooperation needs to be treated like a muscle that can be strengthened and can react well in the face of geopolitical shocks. An understanding of both global connections and geopolitical realities – and implications for the business – should be a core competency for every multinational corporation C-suite executive.58 That means not just understanding the headlines, but having a subtle grasp of the nuances, context and potential implications for the business.\\n\\nEvaluate board expertise and engagement In parallel with shifts in management, boards should be building their capabilities to conduct more nuanced discussions and decisions on topics of global cooperation, including the appropriate\\n\\nBuild dynamic strategic options The old paradigm of globalization largely depended on businesses shaping the way. Now governments are moving back into the lead, and this is likely to be a core consideration for every multinational. A starting point here will be a careful and clinical diagnostic of each firm’s interconnectedness – where, with whom, how – combined with a rigorous risk assessment of potential points of weakness. That understanding will form the basis for detailed scenario planning, including resilient alternatives for supply chains, and the elaboration of new strategy options that take into account dynamic world events.\\n\\nThink diversifying, not decoupling Companies and countries that thoughtfully manage their concentrated exposures are likely to be more resilient – not only able to absorb a supply disruption, but also to bounce back better. There is already evidence of this in action: in April 2022, 81% of global supply-chain leaders surveyed said they had initiated dual sourcing of raw materials, up 26 percentage points from the previous year. Greater diversification not only strengthens resilience; it could also promote a more inclusive trading system and economy.59 The connection between trade and wealth creation is strong: diversification could enable more countries to participate more fully.\\n\\n19\\n\\nAppendix Sources and methodology\\n\\nThe below text highlights two important features of the 42 indicators included in the barometer: their sources and the methodology used to construct global trendlines (if a transformation was applied), organized by pillar.\\n\\nTrade and capital\\n\\nDeveloping countries’ share of FDI Source: UNCTAD\\n\\nMethodological notes: FDI is defined as inward stock.\\n\\nGoods trade (as a % of GDP) Source: World Bank\\n\\nCalculation uses categorization of developing and developed\\n\\ncountries defined by the UN Statistics Division.\\n\\nServices trade (as a % of GDP) Source: World Bank\\n\\nTrade concentration Source: UN Comtrade\\n\\nMethodological notes: Concentration is defined in this\\n\\nFDI stock (as a % of GDP) Source: United Nations Conference on Trade and\\n\\ninstance as the total value of concentrated imports as a share\\n\\nof total imports. First, the Herfindahl–Hirschman index (HHI)\\n\\nDevelopment (UNCTAD)\\n\\nis computed for imports across all products for all countries.\\n\\nThen, each country’s imported product is categorized as\\n\\nForeign portfolio investment (FPI) (as a % of GDP) Source: International Monetary Fund (IMF)\\n\\n“high concentration” (HHI > 3000) or “low concentration”\\n\\n(HHI < 3000). The total value of trade for both concentration\\n\\nMethodological notes: End-December holdings used for 2012;\\n\\ncategories is aggregated over time to calculate the value share\\n\\nend-June holdings used for 2013-22 (due to data availability)\\n\\nof high and low-concentration products globally.\\n\\nODA (as a % of GDP) Source: Organisation for Economic Co-operation and\\n\\nInnovation and technology\\n\\nDevelopment (OECD)\\n\\nMethodological notes: According to the OECD, prior to 2018,\\n\\nthe ODA flows basis methodology covered loans expressed\\n\\non a “cash basis”, meaning their full face value was included,\\n\\nCross-border R&D (as a % of GDP) Source: OECD\\n\\nthen repayments were subtracted as they came in. From\\n\\nMethodological notes: Total R&D is used in this instance as a\\n\\n2018, the ODA grant-equivalent methodology is used whereby\\n\\nproxy for cross-border R&D, given that cross-border R&D data\\n\\nonly the “grant portion” of the loan, i.e. the amount “given” by\\n\\nis scant.\\n\\nlending below market rates, counts as ODA\\n\\nRemittances (as a % of GDP) Source: World Bank\\n\\nCross-border patent applications (as a % of total patent applications) Source: European Patent Office, PATSTAT\\n\\nLabor migrants (as a % of population) Source: International Labour Organization (ILO)\\n\\nCross-border data flows (as a % of total IP traffic) Source: International Telecommunication Union (international\\n\\nMethodological notes: Figures for 2014-2016 and 2018 were\\n\\nbandwidth usage); Cisco (IP traffic)\\n\\nlinearly interpolating using data points in 2013, 2017, and 2019.\\n\\nFigure for 2020 was extrapolated. From 2019 to 2020, overall\\n\\ninternational migrant stock grew from 272 to 281 million, and in\\n\\nInternational students (as a % of population) Source: Institute for International Education\\n\\n2019 labour migrants accounted for 62% of overall migration.\\n\\nMethodological notes: Due to data availability, destination\\n\\nThis 62% was assumed to remain constant in 2020 and was\\n\\ncountries included are Australia, Canada, China, France,\\n\\nused to extrapolate the 2020 value for labour migrants.\\n\\nGermany, Japan, New Zealand, Norway, Spain, the United\\n\\nStates, the United Kingdom; 2021 values were linearly\\n\\nDeveloping countries’ share of manufacturing exports Source: World Bank\\n\\nMethodological notes: Calculation uses categorization of\\n\\ninterpolated for China and Norway.\\n\\nIT goods trade (as a % of GDP) Source: UNCTAD, UN Comtrade\\n\\ndeveloping and developed countries defined by the UN\\n\\nMethodological notes: UN Comtrade data was used to\\n\\nStatistics Division.\\n\\nextrapolate the 2022 figure. The rate of change between 2021\\n\\nQ1-Q3 and 2022 Q1-Q3 was applied to UNCTAD’s 2021\\n\\nfigure to estimate the value in 2022.\\n\\n20\\n\\nIT services trade (as a % of GDP) Source: UNCTAD\\n\\ninstance as a proxy for cross-border R&D, given that cross-\\n\\nborder R&D data is scant.\\n\\nTotal factor productivity Source: The Conference Board\\n\\nHealth-related goods trade (as a % of GDP) Source: UN Comtrade\\n\\nMethodological notes: The 2022 figure was extrapolated by\\n\\nIndividuals using the internet Source: International Telecommunication Union\\n\\napplying the rate of change between 2021 Q1-Q3 and 2022\\n\\nQ1-Q3 was to the 2021 figure.\\n\\nAverage price of a lithium-ion battery Source: BloombergNEF\\n\\nMethodological notes: Two published charts were used to\\n\\nDevelopment assistance for health (DAH) (as a % of GDP) Source: Institute for Health Metrics and Evaluation (IHME)\\n\\nconstruct the decade trendline: one presenting data from\\n\\n2010-2018 and on presenting data from 2013-2022. Data\\n\\nfrom the former chart was used for years 2012-2018 and\\n\\nInternational Health Regulations (IHR) score Source: World Health Organization\\n\\n2019-2022 was extrapolated using the y-o-y growth rates\\n\\nMethodological notes: All capacities average score used.\\n\\nfrom the latter chart.\\n\\nLife expectancy at birth Source: United Nations\\n\\nClimate and natural capital\\n\\nMethodological notes: Medium variant UN forecast was used\\n\\nfor the 2022 figure.\\n\\nMitigation finance (as a % of GDP) Source: Climate Policy Initiative\\n\\nDisability-adjusted life years (DALYs) Source: IHME\\n\\nMethodological notes: Mitigation finance includes dual-\\n\\nMethodological notes: IHME’s forecasted values were used for\\n\\nuse finance as it is assumed to be total climate finance\\n\\n2020-2022 figures.\\n\\nminus adaptation finance. The 2021 figure is a low-bound\\n\\nestimate by CPI. The 2022 figure for total climate finance was\\n\\nextrapolated based on the 2011-2020 CAGR.\\n\\nUnder-5 mortality Source: IHME\\n\\nMethodological notes: IHME’s forecasted value was used for\\n\\nAdaptation finance (as a % of GDP) Source: Climate Policy Initiative\\n\\nthe 2022 figure.\\n\\nMethodological notes: 2021 and 2022 figures were\\n\\nextrapolated based on 2011-2020 CAGR.\\n\\nMaternal mortality Source: IHME\\n\\nMethodological notes: IHME’s forecasted value was used for\\n\\nLow carbon goods trade (as a % of GDP) Source: IMF\\n\\nthe 2022 figure.\\n\\nTerrestrial protected area Source: Protected Planet\\n\\nPeace and security\\n\\nMethodological notes: The 2022 figure was extrapolated\\n\\nbased on the 2012-2021 CAGR.\\n\\nConflicts Source: Uppsala Conflict Data Program\\n\\nMarine protected area Source: Protected Planet\\n\\nUNSC resolutions Source: United Nations\\n\\nGHG emissions Source: IMF\\n\\nMultilateral peacekeeping operations Source: Stockholm International Peace Research Institute\\n\\nGHG emissions intensity (ratio of emissions to GDP) Source: IMF\\n\\n(SIPRI)\\n\\nBiodiversity Intactness Index Source: The National History Museum\\n\\nFatalities Source: Uppsala Conflict Data Program\\n\\nOcean Health Index Source: Ocean Health Index\\n\\nForcibly displaced people Source: United Nations High Commissioner for Refugees\\n\\n(UNHCR)\\n\\nHealth and wellness\\n\\nSignificant cyber incidents Source: Center for Strategic and International Studies\\n\\nMethodological notes: Significant cyber incidents are defined\\n\\nby CSIS as cyberattacks on government agencies, defense\\n\\nCross-border health-related R&D (as a % of GDP) Source: Policy Cures Research\\n\\nand high-tech companies, or economic crimes with losses of\\n\\nmore than a million dollars.\\n\\nMethodological notes: Total health-related R&D is used in this\\n\\n21\\n\\nContributors\\n\\nMcKinsey & Company\\n\\nWorld Economic Forum\\n\\nDaniel Pacthod Senior Partner, New York, Global Head, Sustainability Practice\\n\\nAriel Kastner Head, Geopolitical Agenda and Communications\\n\\nOlivia White Senior Partner, San Francisco, Director, McKinsey Global Institute\\n\\nOliver Bevan Partner, Chicago, Risk and Resilience Practice\\n\\nJessica Margolis Lead, Geopolitical Agenda\\n\\nNicolai Ruge Lead, Geopolitical Agenda and Trade Investment Platform\\n\\nTiago Devesa Senior Fellow, McKinsey Lisbon Global Institute\\n\\nProduction\\n\\nMark Staples Editorial Director, New York Firm Publishing\\n\\nBianca Gay-Fulconis Designer\\n\\nKendyll Hicks Project Manager, New York\\n\\nMark Schulman Editor\\n\\nYasmine Gordon Consultant, Chicago\\n\\nAndres Cadena Senior Partner, Bogota, Strategy and Corporate Finance Practice\\n\\nMekala Krishnan Partner, Boston, McKinsey Global Institute\\n\\nMayowa Kuyoro Partner, Lagos, Financial Services Practice\\n\\nAcha Leke Senior Partner, Johannesburg, Social, Healthcare, and Public Sector Entities Practice and Chairman of McKinsey’s Africa region\\n\\nJeongmin Seong Partner, Shanghai, McKinsey Global Institute\\n\\nAcknowledgements\\n\\nThank you to Mirek Dušek and Sean Doherty at the World Economic Forum for offering valuable input and feedback. Thank you also to Max Hall and Floris Landi.\\n\\n22\\n\\nEndnotes\\n\\n1.\\n\\nInternational Monetary Fund, World Economic Outlook: Navigating Global Divergences, October 2023, https://www.imf. org/en/Publications/WEO/Issues/2023/10/10/world-economic-outlook-october-2023.\\n\\n2.\\n\\nInternational Monetary Fund, “The High Cost of Global Economic Fragmentation,” 28 August 2023, https://www.imf.org/ en/Blogs/Articles/2023/08/28/the-high-cost-of-global-economic-fragmentation.\\n\\n3.\\n\\nMcKinsey Global Institute, “The economic potential of generative AI: The next productivity frontier,” 14 June 2023, https://www.mckinsey.com/capabilities/mckinsey-digital/our-insights/the-economic-potential-of-generative-ai-the-next- productivity-frontier.\\n\\n4.\\n\\nUnited Nations, “Sustainable Development Development Goals: Progress Chart 2023”, https://unstats.un.org/sdgs/ report/2023/progress-chart/Progress-Chart-2023.pdf.\\n\\n5.\\n\\nUnited Nations, “With Highest Number of Violent Conflicts Since Second World War, United Nations Must Rethink Efforts to Achieve, Sustain Peace, Speakers Tell Security Council,” 26 January 2023, https://press.un.org/en/2023/sc15184. doc.htm.\\n\\n6.\\n\\nBrende, Børge and Bob Sternfels, “Resilience for sustainable, inclusive growth”, McKinsey & Company, 7 June 2022, https://www.mckinsey.com/capabilities/risk-and-resilience/our-insights/resilience-for-sustainable-inclusive-growth.\\n\\n7.\\n\\nWorld Meteorological Organization, “2023 shatters climate records, with major impacts”, 30 November 2023, https://wmo.int/news/media-centre/2023-shatters-climate-records-major-impacts#:~:text=Geneva%2FDubai%20 (WMO)%20%2D,World%20Meteorological%20Organization%20(WMO).&text=The%20WMO%20provisional%20 State%20of,the%20warmest%20year%20on%20record.\\n\\n8.\\n\\nUnited Nations, “Over 114 million displaced by war, violence worldwide”, 25 October 2023, https://news.un.org/en/ story/2023/10/1142827.\\n\\n9.\\n\\nMcKinsey & Company, “Generative AI holds huge economic potential for the global economy”, 4 July 2023, https://www.mckinsey.com/fi/news/generative-ai-holds-huge-economic-potential-for-the-global-economy.\\n\\n10. World Bank, “The Role of Trade in Ending Poverty”, https://www.worldbank.org/en/topic/trade/publication/the-role-of-\\n\\ntrade-in-ending-poverty.\\n\\n11.\\n\\nBrende, Børge, “The Dawn of Stakeholder Geopolitics”, Foreign Affairs, 16 January 2023, https://www.foreignaffairs.com/ world/dawn-stakeholder-geopolitics.\\n\\n12.\\n\\nUnited Nations, “With Highest Number of Violent Conflicts Since Second World War, United Nations Must Rethink Efforts to Achieve, Sustain Peace, Speakers Tell Security Council”, 26 January 2023, https://press.un.org/en/2023/sc15184. doc.htm.\\n\\n13.\\n\\nLiu, Juliana, “US-China trade defies talk of decoupling to hit record high in 2022”, CNN, 8 February 2023, https://edition. cnn.com/2023/02/08/economy/us-china-trade-record-hnk-intl/index.html.\\n\\n14. McKinsey Global Institute, “Global balance sheet 2022: Enter volatility”, 15 December 2022, https://www.mckinsey.com/\\n\\ncapabilities/strategy-and-corporate-finance/our-insights/global-balance-sheet-2022-enter-volatility.\\n\\n15. World Trade Organization, “WTO lowers 2023 trade growth forecast amid global manufacturing slowdown”,\\n\\n5 October 2023, https://www.wto.org/english/news_e/news23_e/tfore_05oct23_e.htm.\\n\\n16.\\n\\nOECD, “Global value chains: Efficiency and risks in the context of COVID-19”, 11 February 2021, https://www.oecd.org/ coronavirus/policy-responses/global-value-chains-efficiency-and-riss-in-the-context-of-covid-19-67c75fdc.\\n\\n17.\\n\\nTo be published in upcoming McKinsey Global Institute report (January 2024).\\n\\n18.\\n\\nSeong, Jeongmin, Olivia White, et al., “Global flows: The ties that bind in an interconnected world”, 15 November 2022, https://www.mckinsey.com/capabilities/strategy-and-corporate-finance/our-insights/global-flows-the-ties-that-bind-in-an- interconnected-world.\\n\\n19.\\n\\nInternational Energy Agency, “Energy Technology Perspectives”, January 2023, https://www.iea.org/reports/energy- technology-perspectives-2023.\\n\\n20.\\n\\nOECD, OECD Factbook 2008, https://www.oecd-ilibrary.org/economics/oecd-factbook-2008/multi-factor-productivity_ factbook-2008-92-en;jsessionid=CDNpiVey-gVIrTiDYi4HIsQFkPDGv-weHdptFqDN.ip-10-240-5-95#:~:text=MFP%20 is%20the%20change%20in,of%20either%20labour%20or%20capital.\\n\\n21.\\n\\nGarcia-Macia, Daniel and Rishi Goyal, “Decoupling In The Digital Era”, IMF, Spring 2021, https://www.imf.org/external/ pubs/ft/fandd/2021/03/international-cooperation-and-the-digital-economy-garcia.htm.\\n\\n22.\\n\\nHAI, Artificial Intelligence Index Report 2023, https://aiindex.stanford.edu/wp-content/uploads/2023/04/HAI_AI-Index- Report_2023.pdf.\\n\\n23. McKinsey & Company, “The economic potential of generative AI: The next productivity frontier”, 14 June 2023,\\n\\nhttps://www.mckinsey.com/capabilities/mckinsey-digital/our-insights/the-economic-potential-of-generative-ai-the-next- productivity-frontier#key-insights.\\n\\n24.\\n\\nHAI, Artificial Intelligence Index Report 2023, https://aiindex.stanford.edu/wp-content/uploads/2023/04/HAI_AI-Index- Report_2023.pdf.\\n\\n23\\n\\n25.\\n\\nSee, for example, the recent Bletchley Declaration stemming from the AI Summit in the UK, https://www.gov.uk/ government/publications/ai-safety-summit-2023-the-bletchley-declaration/the-bletchley-declaration-by-countries- attending-the-ai-safety-summit-1-2-november-2023.\\n\\n26.\\n\\nScience Based Targets, “Corporate climate action accelerated in 2022, with an 87% increase in companies setting science-based targets”, 17 August 2023, https://sciencebasedtargets.org/news/corporate-climate-action-accelerated- in-2022-with-an-87-increase-in-companies-setting-science-based-targets#:~:text=Companies%20representing%20mo- re%20than%20a,and%2042%25%20of%20S%26P%20companies.\\n\\n27.\\n\\nLondon School of Economics, “What are the extent and causes of biodiversity loss?”, 2 December 2022, https://www.lse.ac.uk/granthaminstitute/explainers/what-are-the-extent-and-causes-of-biodiversity-loss/.\\n\\n28.\\n\\nScimex, “Expert Reaction: 1 in 5 people rely on wild species for income and food”, 8 July 2022, https://www.scimex.org/ newsfeed/expert-reaction-1-in-5-people-rely-on-wild-species-for-income-and-food#:~:text=%E2%80%9C70%25%20 of%20the%20world’s%20poor,Emery.\\n\\n29.\\n\\nIEA, “Energy intensity”, https://www.iea.org/reports/sdg7-data-and-projections/energy-intensity.\\n\\n30.\\n\\nUNFCCC, “Long-term strategies portal”, https://unfccc.int/process/the-paris-agreement/long-term-strategies.\\n\\n31. McKinsey & Company, “An affordable, reliable, competitive path to net zero”, 30 November 2023, https://www.mckinsey.\\n\\ncom/capabilities/sustainability/our-insights/an-affordable-reliable-competitive-path-to-net-zero#/.\\n\\n32.\\n\\nZhang, Yong-Zhen and Edward C. Holmes, “A Genomic Perspective on the Origin and Emergence of SARS-CoV-2”, Cell, 16 April 2020, https://www.ncbi.nlm.nih.gov/pmc/articles/PMC7194821/#:~:text=With%20the%20help%20of%20 Dr,early%20on%20January%2011%2C%202020.\\n\\n33.\\n\\nTatar, Moosa, Jalal Montazeri Shoorekchali, et al., “COVID-19 vaccine inequality: A global perspective”, Journal of Global Health, 14 October 2022, https://www.ncbi.nlm.nih.gov/pmc/articles/PMC9559176/#:~:text=The%20inequality%20 in%20vaccines%20was,on%20December%207%2C%202021.\\n\\n34.\\n\\nORF, “Global contest for medical equipment amidst the COVID19 pandemic”, 20 May 2020, https://www.orfonline.org/ expert-speak/global-contest-for-medical-equipment-amidst-the-covid19-pandemic-66438/.\\n\\n35.\\n\\nCalculated as the sum of years of life lost (YLL) and years lost due to disability (YLD).\\n\\n36. World Health Organization “Malaria”, https://www.who.int/data/gho/data/themes/malaria.\\n\\n37.\\n\\nKFF, “The U.S. Government and the World Health Organization”, 22 May 2023, https://www.kff.org/coronavirus- covid-19/fact-sheet/the-u-s-government-and-the-world-health-organization/#:~:text=The%20revised%20amount%20 represents%20a,is%20set%20at%20%246.86%20billion.\\n\\n38.\\n\\nThe World Bank, “G20 hosts Official Launch of The Pandemic Fund”, 13 November 2022, https://www.worldbank.org/ en/news/press-release/2022/11/12/g20-hosts-official-launch-of-the-pandemic-fund.\\n\\n39.\\n\\nAfrica CDC, “Partnerships for African Vaccine Manufacturing (PAVM) Framework for Action”, 3 March 2022, https://africacdc.org/download/partnerships-for-african-vaccine-manufacturing-pavm-framework-for-action/.\\n\\n40.\\n\\nButchard, Patrick and Bukky Balogun, “What is the proposed WHO Pandemic Preparedness Treaty?”, House of Commons Library,14 December 2023, https://commonslibrary.parliament.uk/research-briefings/cbp-9550/.\\n\\n41.\\n\\nFor example, the EU has a series of initiatives calling for greater international cooperation here: “Global Partnerships in Health: Details of cooperation agreements in the field of health research”, https://research-and-innovation.ec.europa.eu/ research-area/health/global-partnerships-health_en.\\n\\n42.\\n\\nUS Department of State, “Global Coalition to Address Synthetic Drug Threats”, https://www.state.gov/globalcoalition/.\\n\\n43.\\n\\nBrassey, Jacqueline, Brad Herbig, Barbara Jeffery, and Drew Ungerman “Reframing employee health: Moving beyond burnout to holistic health”, McKinsey Health Institute, 2 November 2023, https://www.mckinsey.com/mhi/our-insights/ reframing-employee-health-moving-beyond-burnout-to-holistic-health.\\n\\n44. McKinsey Health Institute, “Aging with purpose: Why meaningful engagement with society matters”, October 23, 2023,\\n\\nhttps://www.mckinsey.com/mhi/our-insights/aging-with-purpose-why-meaningful-engagement-with-society-matters.\\n\\n45.\\n\\nSignificant cyberattacks defined as those with an estimated impact of greater than $1 million or involving over 1 million files leaked classified as significant.\\n\\n46.\\n\\nLewis, James Andrew, Zhanna L. Malekos Smith, and Eugenia Lostri, “The Hidden Costs of Cybercrime”, CSIS, 9 December 2020, https://www.csis.org/analysis/hidden-costs-cybercrime.\\n\\n47.\\n\\nCimpanu, Catalin, “A decade of hacking: The most notable cyber-security events of the 2010s”, ZDNet, https://www.zdnet.com/article/a-decade-of-hacking-the-most-notable-cyber-security-events-of-the-2010s/.\\n\\n48.\\n\\nIbid.\\n\\n49.\\n\\nArctic Wolf, “A Brief History of Cybercrime”, 16 November 2022, https://arcticwolf.com/resources/blog/decade-of- cybercrime/.\\n\\n50.\\n\\nCollier, Roger, “NHS ransomware attack spreads worldwide”, 5 June 2017, https://www.ncbi.nlm.nih.gov/pmc/articles/ PMC5461132/.\\n\\n51.\\n\\nUNHCR, “Global Trends”, https://www.unhcr.org/global-trends.\\n\\n24\\n\\n52. White, Olivia, Kevin Buehler, et al., “War in Ukraine: Twelve disruptions changing the world—update”, McKinsey &\\n\\nCompany, 28 July 2023, https://www.mckinsey.com/capabilities/strategy-and-corporate-finance/our-insights/war-in- ukraine-twelve-disruptions-changing-the-world-update.\\n\\n53.\\n\\nIbid.\\n\\n54.\\n\\nIbid.\\n\\n55. Woetzel, Jonathan, Anu Madgavkar, et al., “Global migration’s impact and opportunity”, McKinsey Global Institute,\\n\\n30 November 2016, https://www.mckinsey.com/featured-insights/employment-and-growth/global-migrations-impact- and-opportunity.\\n\\n56.\\n\\nBrende, Børge “Cooperating On Global Goals Requires Competition”, Forbes, 21 September 2023, https://www.forbes. com/sites/worldeconomicforum/2023/09/21/cooperating-on-global-goals-requires-competition/?sh=5138d01e6f10.\\n\\n57.\\n\\nSeong, Jeongmin, Olivia White, et al., “Global flows: The ties that bind in an interconnected world”, McKinsey Global Institute, 15 November 2022, https://www.mckinsey.com/capabilities/strategy-and-corporate-finance/our-insights/global- flows-the-ties-that-bind-in-an-interconnected-world.\\n\\n58.\\n\\nFor a more detailed discussion of the implications for boards, see Haider, Ziad, Jon Huntsman Jr., and Chris Leech “Geopolitical resilience: The new board imperative”, McKinsey & Company, 8 August 2023, https://www.mckinsey.com/ capabilities/risk-and-resilience/our-insights/geopolitical-resilience-the-new-board-imperative.\\n\\n59.\\n\\nSternfels, Bob and Olivia White, “To reinvent globalization, companies and countries should think ‘diversifying,’ not ‘decoupling,’ according to McKinsey Global Institute’s research”, Fortune, 20 January 2023, https://fortune.com/ europe/2023/01/20/reinvent-globalization-companies-trade-countries-diversifying-not-decoupling-mckinsey-global- sternfels-white/.\\n\\n25\\n\\nThe World Economic Forum, committed to improving the state of the world, is the International Organization for Public-Private Cooperation.\\n\\nThe Forum engages the foremost political, business and other leaders of society to shape global, regional and industry agendas.\\n\\nWorld Economic Forum 91–93 route de la Capite CH-1223 Cologny/Geneva Switzerland\\n\\nTel.: +41 (0) 22 869 1212 Fax: +41 (0) 22 786 2744 contact@weforum.org www.weforum.org'" | |
| ] | |
| }, | |
| "execution_count": 520, | |
| "metadata": {}, | |
| "output_type": "execute_result" | |
| } | |
| ], | |
| "source": [ | |
| "# Preview first page\n", | |
| "data[0].page_content" | |
| ] | |
| }, | |
| { | |
| "cell_type": "markdown", | |
| "id": "c2faacc1-be29-4d52-a46e-94f5b5b8e728", | |
| "metadata": {}, | |
| "source": [ | |
| "## Vector Embeddings" | |
| ] | |
| }, | |
| { | |
| "cell_type": "code", | |
| "execution_count": null, | |
| "id": "2dcf2cfe-a7aa-4ecf-85e3-f77b9e850514", | |
| "metadata": { | |
| "scrolled": true | |
| }, | |
| "outputs": [], | |
| "source": [ | |
| "!ollama pull nomic-embed-text" | |
| ] | |
| }, | |
| { | |
| "cell_type": "code", | |
| "execution_count": 505, | |
| "id": "39aebbf8-92bf-42e5-951e-40bb458852d5", | |
| "metadata": {}, | |
| "outputs": [ | |
| { | |
| "name": "stdout", | |
| "output_type": "stream", | |
| "text": [ | |
| "NAME \tID \tSIZE \tMODIFIED \n", | |
| "codellama:7b-code \tfc84f39375bc\t3.8 GB\t2 months ago \t\n", | |
| "gemma:latest \t430ed3535049\t5.2 GB\t5 weeks ago \t\n", | |
| "llama2:latest \t78e26419b446\t3.8 GB\t2 hours ago \t\n", | |
| "llama2-uncensored:latest\t44040b922233\t3.8 GB\t3 months ago \t\n", | |
| "llava:latest \t8dd30f6b0cb1\t4.7 GB\t2 months ago \t\n", | |
| "mistral:latest \t4d9f4b269c33\t4.1 GB\t3 months ago \t\n", | |
| "nomic-embed-text:latest \t0a109f422b47\t274 MB\t17 seconds ago\t\n" | |
| ] | |
| } | |
| ], | |
| "source": [ | |
| "!ollama list" | |
| ] | |
| }, | |
| { | |
| "cell_type": "code", | |
| "execution_count": 507, | |
| "id": "5394d61f-906b-4776-b8b5-9f0045c76193", | |
| "metadata": {}, | |
| "outputs": [], | |
| "source": [ | |
| "%pip install --q chromadb\n", | |
| "%pip install --q langchain-text-splitters" | |
| ] | |
| }, | |
| { | |
| "cell_type": "code", | |
| "execution_count": 6, | |
| "id": "83a39856-0cc0-4ebe-8024-9db32455a545", | |
| "metadata": {}, | |
| "outputs": [], | |
| "source": [ | |
| "from langchain_community.embeddings import OllamaEmbeddings\n", | |
| "from langchain_text_splitters import RecursiveCharacterTextSplitter\n", | |
| "from langchain_community.vectorstores import Chroma" | |
| ] | |
| }, | |
| { | |
| "cell_type": "code", | |
| "execution_count": 7, | |
| "id": "bad040e2-3abe-4e23-abb9-951b223b9262", | |
| "metadata": {}, | |
| "outputs": [ | |
| { | |
| "ename": "NameError", | |
| "evalue": "name 'data' is not defined", | |
| "output_type": "error", | |
| "traceback": [ | |
| "\u001b[0;31m---------------------------------------------------------------------------\u001b[0m", | |
| "\u001b[0;31mNameError\u001b[0m Traceback (most recent call last)", | |
| "Cell \u001b[0;32mIn[7], line 3\u001b[0m\n\u001b[1;32m 1\u001b[0m \u001b[38;5;66;03m# Split and chunk \u001b[39;00m\n\u001b[1;32m 2\u001b[0m text_splitter \u001b[38;5;241m=\u001b[39m RecursiveCharacterTextSplitter(chunk_size\u001b[38;5;241m=\u001b[39m\u001b[38;5;241m7500\u001b[39m, chunk_overlap\u001b[38;5;241m=\u001b[39m\u001b[38;5;241m100\u001b[39m)\n\u001b[0;32m----> 3\u001b[0m chunks \u001b[38;5;241m=\u001b[39m text_splitter\u001b[38;5;241m.\u001b[39msplit_documents(\u001b[43mdata\u001b[49m)\n", | |
| "\u001b[0;31mNameError\u001b[0m: name 'data' is not defined" | |
| ] | |
| } | |
| ], | |
| "source": [ | |
| "# Split and chunk \n", | |
| "text_splitter = RecursiveCharacterTextSplitter(chunk_size=7500, chunk_overlap=100)\n", | |
| "chunks = text_splitter.split_documents(data)" | |
| ] | |
| }, | |
| { | |
| "cell_type": "code", | |
| "execution_count": 8, | |
| "id": "efb11c92-e732-4a88-8f57-57a19b38e383", | |
| "metadata": {}, | |
| "outputs": [ | |
| { | |
| "ename": "NameError", | |
| "evalue": "name 'chunks' is not defined", | |
| "output_type": "error", | |
| "traceback": [ | |
| "\u001b[0;31m---------------------------------------------------------------------------\u001b[0m", | |
| "\u001b[0;31mNameError\u001b[0m Traceback (most recent call last)", | |
| "Cell \u001b[0;32mIn[8], line 3\u001b[0m\n\u001b[1;32m 1\u001b[0m \u001b[38;5;66;03m# Add to vector database\u001b[39;00m\n\u001b[1;32m 2\u001b[0m vector_db \u001b[38;5;241m=\u001b[39m Chroma\u001b[38;5;241m.\u001b[39mfrom_documents(\n\u001b[0;32m----> 3\u001b[0m documents\u001b[38;5;241m=\u001b[39m\u001b[43mchunks\u001b[49m, \n\u001b[1;32m 4\u001b[0m embedding\u001b[38;5;241m=\u001b[39mOllamaEmbeddings(model\u001b[38;5;241m=\u001b[39m\u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mnomic-embed-text\u001b[39m\u001b[38;5;124m\"\u001b[39m,show_progress\u001b[38;5;241m=\u001b[39m\u001b[38;5;28;01mTrue\u001b[39;00m),\n\u001b[1;32m 5\u001b[0m collection_name\u001b[38;5;241m=\u001b[39m\u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mlocal-rag\u001b[39m\u001b[38;5;124m\"\u001b[39m\n\u001b[1;32m 6\u001b[0m )\n", | |
| "\u001b[0;31mNameError\u001b[0m: name 'chunks' is not defined" | |
| ] | |
| } | |
| ], | |
| "source": [ | |
| "# Add to vector database\n", | |
| "vector_db = Chroma.from_documents(\n", | |
| " documents=chunks, \n", | |
| " embedding=OllamaEmbeddings(model=\"nomic-embed-text\",show_progress=True),\n", | |
| " collection_name=\"local-rag\"\n", | |
| ")" | |
| ] | |
| }, | |
| { | |
| "cell_type": "markdown", | |
| "id": "39eadf50-2f3d-4420-8858-94e9c1682ffa", | |
| "metadata": {}, | |
| "source": [ | |
| "## Retrieval" | |
| ] | |
| }, | |
| { | |
| "cell_type": "code", | |
| "execution_count": 1, | |
| "id": "5ec338c4-f282-462f-b0a0-c1899538eb07", | |
| "metadata": {}, | |
| "outputs": [], | |
| "source": [ | |
| "from langchain.prompts import ChatPromptTemplate, PromptTemplate\n", | |
| "from langchain_core.output_parsers import StrOutputParser\n", | |
| "from langchain_community.chat_models import ChatOllama\n", | |
| "from langchain_core.runnables import RunnablePassthrough\n", | |
| "from langchain.retrievers.multi_query import MultiQueryRetriever" | |
| ] | |
| }, | |
| { | |
| "cell_type": "code", | |
| "execution_count": 2, | |
| "id": "d1d6ceeb-6883-4688-b923-e771c2b2cb07", | |
| "metadata": {}, | |
| "outputs": [], | |
| "source": [ | |
| "# LLM from Ollama\n", | |
| "local_model = \"mistral\"\n", | |
| "llm = ChatOllama(model=local_model)" | |
| ] | |
| }, | |
| { | |
| "cell_type": "code", | |
| "execution_count": 3, | |
| "id": "c436d5cd-5dd0-448c-b5c0-6eddab879c2a", | |
| "metadata": {}, | |
| "outputs": [], | |
| "source": [ | |
| "QUERY_PROMPT = PromptTemplate(\n", | |
| " input_variables=[\"question\"],\n", | |
| " template=\"\"\"You are an AI language model assistant. Your task is to generate five\n", | |
| " different versions of the given user question to retrieve relevant documents from\n", | |
| " a vector database. By generating multiple perspectives on the user question, your\n", | |
| " goal is to help the user overcome some of the limitations of the distance-based\n", | |
| " similarity search. Provide these alternative questions separated by newlines.\n", | |
| " Original question: {question}\"\"\",\n", | |
| ")" | |
| ] | |
| }, | |
| { | |
| "cell_type": "code", | |
| "execution_count": 4, | |
| "id": "71e423dc-f632-46f8-9bec-d74cb268ab74", | |
| "metadata": {}, | |
| "outputs": [ | |
| { | |
| "ename": "NameError", | |
| "evalue": "name 'vector_db' is not defined", | |
| "output_type": "error", | |
| "traceback": [ | |
| "\u001b[0;31m---------------------------------------------------------------------------\u001b[0m", | |
| "\u001b[0;31mNameError\u001b[0m Traceback (most recent call last)", | |
| "Cell \u001b[0;32mIn[4], line 2\u001b[0m\n\u001b[1;32m 1\u001b[0m retriever \u001b[38;5;241m=\u001b[39m MultiQueryRetriever\u001b[38;5;241m.\u001b[39mfrom_llm(\n\u001b[0;32m----> 2\u001b[0m \u001b[43mvector_db\u001b[49m\u001b[38;5;241m.\u001b[39mas_retriever(), \n\u001b[1;32m 3\u001b[0m llm,\n\u001b[1;32m 4\u001b[0m prompt\u001b[38;5;241m=\u001b[39mQUERY_PROMPT\n\u001b[1;32m 5\u001b[0m )\n\u001b[1;32m 7\u001b[0m \u001b[38;5;66;03m# RAG prompt\u001b[39;00m\n\u001b[1;32m 8\u001b[0m template \u001b[38;5;241m=\u001b[39m \u001b[38;5;124m\"\"\"\u001b[39m\u001b[38;5;124mAnswer the question based ONLY on the following context:\u001b[39m\n\u001b[1;32m 9\u001b[0m \u001b[38;5;132;01m{context}\u001b[39;00m\n\u001b[1;32m 10\u001b[0m \u001b[38;5;124mQuestion: \u001b[39m\u001b[38;5;132;01m{question}\u001b[39;00m\n\u001b[1;32m 11\u001b[0m \u001b[38;5;124m\"\"\"\u001b[39m\n", | |
| "\u001b[0;31mNameError\u001b[0m: name 'vector_db' is not defined" | |
| ] | |
| } | |
| ], | |
| "source": [ | |
| "retriever = MultiQueryRetriever.from_llm(\n", | |
| " vector_db.as_retriever(), \n", | |
| " llm,\n", | |
| " prompt=QUERY_PROMPT\n", | |
| ")\n", | |
| "\n", | |
| "# RAG prompt\n", | |
| "template = \"\"\"Answer the question based ONLY on the following context:\n", | |
| "{context}\n", | |
| "Question: {question}\n", | |
| "\"\"\"\n", | |
| "\n", | |
| "prompt = ChatPromptTemplate.from_template(template)" | |
| ] | |
| }, | |
| { | |
| "cell_type": "code", | |
| "execution_count": 516, | |
| "id": "cb1f308f-8472-4506-9517-d79b61d408f2", | |
| "metadata": {}, | |
| "outputs": [], | |
| "source": [ | |
| "chain = (\n", | |
| " {\"context\": retriever, \"question\": RunnablePassthrough()}\n", | |
| " | prompt\n", | |
| " | llm\n", | |
| " | StrOutputParser()\n", | |
| ")" | |
| ] | |
| }, | |
| { | |
| "cell_type": "code", | |
| "execution_count": 518, | |
| "id": "915fb18b-cb57-42cf-a9b3-c6f95d3c4e32", | |
| "metadata": { | |
| "scrolled": true | |
| }, | |
| "outputs": [ | |
| { | |
| "name": "stdout", | |
| "output_type": "stream", | |
| "text": [ | |
| " what is this about?\n" | |
| ] | |
| }, | |
| { | |
| "name": "stderr", | |
| "output_type": "stream", | |
| "text": [ | |
| "OllamaEmbeddings: 100%|███████████████████████████| 1/1 [00:01<00:00, 1.15s/it]\n", | |
| "OllamaEmbeddings: 100%|███████████████████████████| 1/1 [00:00<00:00, 36.58it/s]\n", | |
| "OllamaEmbeddings: 100%|███████████████████████████| 1/1 [00:00<00:00, 14.64it/s]\n", | |
| "OllamaEmbeddings: 100%|███████████████████████████| 1/1 [00:00<00:00, 23.34it/s]\n", | |
| "OllamaEmbeddings: 100%|███████████████████████████| 1/1 [00:00<00:00, 23.14it/s]\n" | |
| ] | |
| }, | |
| { | |
| "data": { | |
| "text/plain": [ | |
| "' This document is the Insight Report of The Global Cooperation Barometer 2024 by the World Economic Forum in collaboration with McKinsey & Company. It provides an analysis of the state of global cooperation across five pillars: trade and capital, innovation and technology, climate and natural capital, health and wellness, and peace and security. The report examines trends in cooperative actions and their outcomes to determine the overall level of global cooperation in each area. It also includes recommendations for leaders on how to reimagine global cooperation in a new era.'" | |
| ] | |
| }, | |
| "execution_count": 518, | |
| "metadata": {}, | |
| "output_type": "execute_result" | |
| } | |
| ], | |
| "source": [ | |
| "chain.invoke(input(\"\"))" | |
| ] | |
| }, | |
| { | |
| "cell_type": "code", | |
| "execution_count": 519, | |
| "id": "06c25c1d-d205-409e-90a2-179d0bd7c41a", | |
| "metadata": {}, | |
| "outputs": [ | |
| { | |
| "name": "stderr", | |
| "output_type": "stream", | |
| "text": [ | |
| "OllamaEmbeddings: 100%|███████████████████████████| 1/1 [00:01<00:00, 1.33s/it]\n", | |
| "OllamaEmbeddings: 100%|███████████████████████████| 1/1 [00:00<00:00, 26.36it/s]\n", | |
| "OllamaEmbeddings: 100%|███████████████████████████| 1/1 [00:00<00:00, 36.23it/s]\n", | |
| "OllamaEmbeddings: 100%|███████████████████████████| 1/1 [00:00<00:00, 49.43it/s]\n", | |
| "OllamaEmbeddings: 100%|███████████████████████████| 1/1 [00:00<00:00, 63.03it/s]\n", | |
| "OllamaEmbeddings: 100%|███████████████████████████| 1/1 [00:00<00:00, 58.14it/s]\n", | |
| "OllamaEmbeddings: 100%|███████████████████████████| 1/1 [00:00<00:00, 59.76it/s]\n", | |
| "OllamaEmbeddings: 100%|███████████████████████████| 1/1 [00:00<00:00, 56.69it/s]\n", | |
| "OllamaEmbeddings: 100%|███████████████████████████| 1/1 [00:00<00:00, 48.34it/s]\n", | |
| "OllamaEmbeddings: 100%|███████████████████████████| 1/1 [00:00<00:00, 51.85it/s]\n" | |
| ] | |
| }, | |
| { | |
| "data": { | |
| "text/plain": [ | |
| "' The 5 pillars of global cooperation are:\\n\\n1. Trade and capital\\n2. Innovation and technology\\n3. Climate and natural capital\\n4. Health and wellness\\n5. Peace and security.'" | |
| ] | |
| }, | |
| "execution_count": 519, | |
| "metadata": {}, | |
| "output_type": "execute_result" | |
| } | |
| ], | |
| "source": [ | |
| "chain.invoke(\"What are the 5 pillars of global cooperation?\")" | |
| ] | |
| }, | |
| { | |
| "cell_type": "code", | |
| "execution_count": null, | |
| "id": "dfe79f21-48aa-4820-aa9f-79f3d1a0a519", | |
| "metadata": {}, | |
| "outputs": [], | |
| "source": [ | |
| "# Delete all collections in the db\n", | |
| "vector_db.delete_collection()" | |
| ] | |
| } | |
| ], | |
| "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.10.6" | |
| }, | |
| "widgets": { | |
| "application/vnd.jupyter.widget-state+json": { | |
| "state": {}, | |
| "version_major": 2, | |
| "version_minor": 0 | |
| } | |
| } | |
| }, | |
| "nbformat": 4, | |
| "nbformat_minor": 5 | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment