{
  "cells": [
    {
      "cell_type": "code",
      "execution_count": 2,
      "metadata": {
        "colab": {
          "base_uri": "https://localhost:8080/"
        },
        "id": "UJkIk0uLIk81",
        "outputId": "20548051-4e68-4216-f1f4-93176e49e24e"
      },
      "outputs": [
        {
          "name": "stdout",
          "output_type": "stream",
          "text": [
            "\n",
            "\u001b[1m[\u001b[0m\u001b[34;49mnotice\u001b[0m\u001b[1;39;49m]\u001b[0m\u001b[39;49m A new release of pip is available: \u001b[0m\u001b[31;49m23.0\u001b[0m\u001b[39;49m -> \u001b[0m\u001b[32;49m25.0.1\u001b[0m\n",
            "\u001b[1m[\u001b[0m\u001b[34;49mnotice\u001b[0m\u001b[1;39;49m]\u001b[0m\u001b[39;49m To update, run: \u001b[0m\u001b[32;49mpip install --upgrade pip\u001b[0m\n",
            "Note: you may need to restart the kernel to use updated packages.\n"
          ]
        }
      ],
      "source": [
        "%pip install faiss-cpu openai --quiet"
      ]
    },
    {
      "cell_type": "markdown",
      "metadata": {
        "id": "Ldw6KWEVI9kx"
      },
      "source": [
        "Get your openai api key from settings: https://platform.openai.com/account/api-keys"
      ]
    },
    {
      "cell_type": "code",
      "execution_count": 3,
      "metadata": {
        "colab": {
          "base_uri": "https://localhost:8080/"
        },
        "id": "ilyYnCcSI4T1",
        "outputId": "ab26692e-605d-437d-e47f-16b1de202a1d"
      },
      "outputs": [],
      "source": [
        "# get the openai secret key\n",
        "import getpass\n",
        "\n",
        "secret_key = getpass.getpass('Please enter your openai key: ')"
      ]
    },
    {
      "cell_type": "code",
      "execution_count": 8,
      "metadata": {
        "colab": {
          "base_uri": "https://localhost:8080/"
        },
        "id": "JIa3ng_HIimg",
        "outputId": "6d5e6131-8355-4115-9f5f-055895db402a"
      },
      "outputs": [
        {
          "data": {
            "text/plain": [
              "[0.005132982973009348,\n",
              " 0.017242904752492905,\n",
              " -0.018698474392294884,\n",
              " -0.01855851523578167,\n",
              " -0.047250036150217056,\n",
              " -0.03028704971075058,\n",
              " 0.027669822797179222,\n",
              " 0.003614431945607066,\n",
              " 0.011217685416340828,\n",
              " 0.006434598471969366,\n",
              " -0.0016865016659721732,\n",
              " 0.01581532694399357,\n",
              " -0.0012849952327087522,\n",
              " -0.00785867776721716,\n",
              " 0.05990229919552803,\n",
              " 0.050357118248939514,\n",
              " -0.02754385955631733,\n",
              " 0.00991606991738081,\n",
              " -0.040392063558101654,\n",
              " 0.04999322444200516,\n",
              " -0.0003859796852339059,\n",
              " 0.030231066048145294,\n",
              " -0.013729942962527275,\n",
              " 0.032974254339933395,\n",
              " 0.01731288433074951,\n",
              " 0.01680903322994709,\n",
              " -0.0017661030869930983,\n",
              " 0.020391974598169327,\n",
              " 0.040811941027641296,\n",
              " -0.03770485892891884,\n",
              " -0.02617226541042328,\n",
              " -0.0500212162733078,\n",
              " 0.024184852838516235,\n",
              " -0.05519968643784523,\n",
              " -0.03224647045135498,\n",
              " 0.04232349246740341,\n",
              " 0.06466089189052582,\n",
              " 0.014695657417178154,\n",
              " -0.015619384124875069,\n",
              " -0.04134378209710121,\n",
              " 0.02218344435095787,\n",
              " 0.007361824624240398,\n",
              " 0.04495471343398094,\n",
              " 0.007074909284710884,\n",
              " -0.024072885513305664,\n",
              " 0.0523725226521492,\n",
              " -0.020056072622537613,\n",
              " -0.032190486788749695,\n",
              " 0.016249198466539383,\n",
              " 0.046494260430336,\n",
              " 0.02384895272552967,\n",
              " -0.01886642538011074,\n",
              " -0.00532542634755373,\n",
              " 0.043919019401073456,\n",
              " -0.006175674963742495,\n",
              " 0.007326834835112095,\n",
              " -0.014947582967579365,\n",
              " 0.07261054217815399,\n",
              " -0.0055143702775239944,\n",
              " -0.037676867097616196,\n",
              " 0.016095243394374847,\n",
              " 0.03428986668586731,\n",
              " 0.007116897031664848,\n",
              " -0.004758593626320362,\n",
              " -0.026704108342528343,\n",
              " 0.028999431058764458,\n",
              " -0.03857260197401047,\n",
              " 0.023219138383865356,\n",
              " -0.00515747582539916,\n",
              " 0.01186849270015955,\n",
              " 0.02551445923745632,\n",
              " -0.014611681923270226,\n",
              " -0.011049734428524971,\n",
              " 0.003782382234930992,\n",
              " 0.0005786414840258658,\n",
              " -0.023275122046470642,\n",
              " -0.01633317396044731,\n",
              " -0.004394701216369867,\n",
              " 0.020755866542458534,\n",
              " -0.004216254223138094,\n",
              " 0.040196120738983154,\n",
              " -0.002821916015818715,\n",
              " -0.025332514196634293,\n",
              " -0.020154044032096863,\n",
              " -0.04817376285791397,\n",
              " 0.020643899217247963,\n",
              " -0.07563365250825882,\n",
              " 0.027963737025856972,\n",
              " -0.017074953764677048,\n",
              " 0.00835553091019392,\n",
              " -0.018348578363656998,\n",
              " -0.012064434587955475,\n",
              " -0.022603319957852364,\n",
              " -0.007074909284710884,\n",
              " -0.01581532694399357,\n",
              " 0.005552859045565128,\n",
              " -0.03275032341480255,\n",
              " 0.0040692975744605064,\n",
              " -0.005850271321833134,\n",
              " -0.03837665915489197,\n",
              " 0.04711007699370384,\n",
              " -0.012071432545781136,\n",
              " -0.02004207670688629,\n",
              " 0.002688955282792449,\n",
              " -0.03154667839407921,\n",
              " 0.011119714006781578,\n",
              " 0.011952468194067478,\n",
              " -0.002426533028483391,\n",
              " -0.046858154237270355,\n",
              " -0.021329697221517563,\n",
              " -0.08543075621128082,\n",
              " 0.007256855256855488,\n",
              " 0.006256151013076305,\n",
              " 0.020643899217247963,\n",
              " 0.0012814962537959218,\n",
              " 0.004226751159876585,\n",
              " 0.06885965168476105,\n",
              " -0.014499715529382229,\n",
              " 0.021665597334504128,\n",
              " -0.022645307704806328,\n",
              " 0.025262534618377686,\n",
              " -0.0027974233962595463,\n",
              " 0.03185458481311798,\n",
              " -0.0568791925907135,\n",
              " 0.0036739143542945385,\n",
              " -0.0410078801214695,\n",
              " 0.005626337137073278,\n",
              " -0.03549351170659065,\n",
              " -0.037956781685352325,\n",
              " 0.015465429984033108,\n",
              " 0.021259717643260956,\n",
              " -0.048509664833545685,\n",
              " -0.011189693585038185,\n",
              " -0.00932824332267046,\n",
              " -0.05018916726112366,\n",
              " -0.007123894989490509,\n",
              " -0.04585045203566551,\n",
              " 0.04123181477189064,\n",
              " -0.03056696616113186,\n",
              " 0.04268738627433777,\n",
              " -0.015451434068381786,\n",
              " -0.029727214947342873,\n",
              " -0.0033432620111852884,\n",
              " -0.011602571234107018,\n",
              " -0.02463272027671337,\n",
              " -0.018306590616703033,\n",
              " -0.03227446228265762,\n",
              " -0.006161679048091173,\n",
              " -0.024268828332424164,\n",
              " 0.018740462139248848,\n",
              " -0.035605479031801224,\n",
              " 0.03479371964931488,\n",
              " -0.06639637798070908,\n",
              " 0.03398195654153824,\n",
              " 0.027040008455514908,\n",
              " -0.013897893019020557,\n",
              " 0.026214253157377243,\n",
              " -0.02450675703585148,\n",
              " -0.04445086419582367,\n",
              " 0.004692113492637873,\n",
              " -0.021763568744063377,\n",
              " -0.057019151747226715,\n",
              " -0.004968531895428896,\n",
              " 0.013506008312106133,\n",
              " -0.03350609913468361,\n",
              " -0.04604639112949371,\n",
              " 0.03792878985404968,\n",
              " 0.024366799741983414,\n",
              " -0.04366709664463997,\n",
              " 0.02334510162472725,\n",
              " -0.013072136789560318,\n",
              " -0.0410078801214695,\n",
              " -0.049293432384729385,\n",
              " -0.005419898312538862,\n",
              " -0.008642446249723434,\n",
              " 0.042155541479587555,\n",
              " 0.021231725811958313,\n",
              " -0.01007002405822277,\n",
              " -0.021371684968471527,\n",
              " 0.048397697508335114,\n",
              " 0.021077770739793777,\n",
              " 0.04047603905200958,\n",
              " 0.00820157676935196,\n",
              " -0.00869842991232872,\n",
              " -0.004135777708142996,\n",
              " -0.006700519938021898,\n",
              " 0.03692108765244484,\n",
              " 0.022939221933484077,\n",
              " 0.00810360535979271,\n",
              " -0.013254082761704922,\n",
              " 0.007991638034582138,\n",
              " -0.005755798891186714,\n",
              " 0.019426260143518448,\n",
              " 0.0011170449433848262,\n",
              " -0.01925830915570259,\n",
              " 0.02072787471115589,\n",
              " 0.03428986668586731,\n",
              " -0.013624973595142365,\n",
              " 0.03988821059465408,\n",
              " 0.06662031263113022,\n",
              " 0.03585740178823471,\n",
              " 0.06348524242639542,\n",
              " -0.02461872436106205,\n",
              " -0.005042009986937046,\n",
              " -0.08576665818691254,\n",
              " -0.0288314800709486,\n",
              " -0.0447307825088501,\n",
              " 0.015129528939723969,\n",
              " 0.013212095946073532,\n",
              " 0.026158269494771957,\n",
              " 0.09119705110788345,\n",
              " -0.019594209268689156,\n",
              " -0.009356235153973103,\n",
              " -0.019888123497366905,\n",
              " -0.0502171590924263,\n",
              " -0.03798477351665497,\n",
              " 0.003490218659862876,\n",
              " 0.019286300987005234,\n",
              " 0.012344351969659328,\n",
              " -0.06113393232226372,\n",
              " -0.018320586532354355,\n",
              " 0.029475290328264236,\n",
              " 0.0600142665207386,\n",
              " 0.024954626336693764,\n",
              " 0.028495579957962036,\n",
              " 0.007270851172506809,\n",
              " 0.025262534618377686,\n",
              " 0.022295411676168442,\n",
              " -0.0031945558730512857,\n",
              " 0.03602535277605057,\n",
              " 0.03778883442282677,\n",
              " -0.02688605524599552,\n",
              " 0.009594164788722992,\n",
              " -0.03770485892891884,\n",
              " 0.023317109793424606,\n",
              " 0.015115533024072647,\n",
              " 0.0003822620492428541,\n",
              " -0.010279961861670017,\n",
              " 0.02139967679977417,\n",
              " 0.019272305071353912,\n",
              " -0.07182677090167999,\n",
              " -0.025360506027936935,\n",
              " 0.08039224147796631,\n",
              " 0.045766476541757584,\n",
              " 0.019958101212978363,\n",
              " -0.01574534736573696,\n",
              " -0.024002905935049057,\n",
              " -0.027207959443330765,\n",
              " 0.026158269494771957,\n",
              " 0.03605334460735321,\n",
              " 0.02180555649101734,\n",
              " 0.015759343281388283,\n",
              " 0.020601911470294,\n",
              " -0.0035899390932172537,\n",
              " 0.02599032036960125,\n",
              " -0.017466837540268898,\n",
              " -0.02053193189203739,\n",
              " 0.031042825430631638,\n",
              " 0.04778188094496727,\n",
              " -0.0419875904917717,\n",
              " -0.033282164484262466,\n",
              " -0.034233883023262024,\n",
              " -0.03778883442282677,\n",
              " -0.0024947626516222954,\n",
              " -0.004160270560532808,\n",
              " -0.00038969735032878816,\n",
              " 0.025164563208818436,\n",
              " 0.0038593595381826162,\n",
              " -0.0004340904706623405,\n",
              " -0.03837665915489197,\n",
              " -0.04229550063610077,\n",
              " -0.004618634935468435,\n",
              " 0.028061706572771072,\n",
              " 0.040811941027641296,\n",
              " -0.03311421349644661,\n",
              " 0.06617244333028793,\n",
              " -0.010881784372031689,\n",
              " -0.020545927807688713,\n",
              " -0.002933882875367999,\n",
              " 0.0196222010999918,\n",
              " -0.04263140261173248,\n",
              " 0.0112806661054492,\n",
              " 0.010825800709426403,\n",
              " -0.018586507067084312,\n",
              " -0.028999431058764458,\n",
              " -0.02167959325015545,\n",
              " 0.028369616717100143,\n",
              " -0.0030720920767635107,\n",
              " 0.009797104634344578,\n",
              " 0.021049778908491135,\n",
              " 0.0027501871809363365,\n",
              " -0.03241442143917084,\n",
              " 0.022449366748332977,\n",
              " -0.008327539078891277,\n",
              " -0.027026012539863586,\n",
              " 0.03851661831140518,\n",
              " -0.018054664134979248,\n",
              " 0.024170856922864914,\n",
              " 0.013387043960392475,\n",
              " 0.05240051448345184,\n",
              " 0.03037102520465851,\n",
              " 0.05377211049199104,\n",
              " 0.0045486558228731155,\n",
              " 0.0027221955824643373,\n",
              " -0.02463272027671337,\n",
              " 0.017452841624617577,\n",
              " 0.03398195654153824,\n",
              " -0.023177150636911392,\n",
              " 0.044310905039310455,\n",
              " -0.013939880765974522,\n",
              " 0.01547942589968443,\n",
              " -0.027585847303271294,\n",
              " -0.004408697132021189,\n",
              " -0.03462576866149902,\n",
              " -0.07512979954481125,\n",
              " -0.010454910807311535,\n",
              " 0.06342925876379013,\n",
              " 0.021945515647530556,\n",
              " -0.0410078801214695,\n",
              " -0.0519806407392025,\n",
              " 0.05268043279647827,\n",
              " -0.01952422969043255,\n",
              " 0.041483741253614426,\n",
              " -0.006480085197836161,\n",
              " 0.005136481951922178,\n",
              " 0.04288332909345627,\n",
              " 0.05298834294080734,\n",
              " 0.01573135145008564,\n",
              " 0.014485719613730907,\n",
              " -0.010468906722962856,\n",
              " 0.01787271909415722,\n",
              " -0.07238660752773285,\n",
              " 0.026410195976495743,\n",
              " -0.01612323522567749,\n",
              " 0.0026032307650893927,\n",
              " -0.012155408039689064,\n",
              " 0.0011747778626158834,\n",
              " 0.0203079991042614,\n",
              " 0.04044804722070694,\n",
              " 0.04632630944252014,\n",
              " -0.005741802975535393,\n",
              " -0.02365300990641117,\n",
              " 0.015129528939723969,\n",
              " 0.008831390179693699,\n",
              " -0.006700519938021898,\n",
              " -0.03294626250863075,\n",
              " -0.03515760973095894,\n",
              " 0.04789384827017784,\n",
              " 0.006392610725015402,\n",
              " 0.011665552854537964,\n",
              " 0.0070294225588440895,\n",
              " 0.028271645307540894,\n",
              " 0.0273619145154953,\n",
              " -0.04193160682916641,\n",
              " 0.04361111298203468,\n",
              " -0.08072814345359802,\n",
              " -0.019818143919110298,\n",
              " 0.011749527417123318,\n",
              " 0.00909031368792057,\n",
              " 0.008334537036716938,\n",
              " -0.024492761120200157,\n",
              " -0.011301659978926182,\n",
              " 0.018012676388025284,\n",
              " 0.0061126938089728355,\n",
              " -0.009783108718693256,\n",
              " 0.048117779195308685,\n",
              " -0.020377978682518005,\n",
              " -0.0030983344186097383,\n",
              " 0.04229550063610077,\n",
              " -0.025374501943588257,\n",
              " -0.004216254223138094,\n",
              " 0.0036354255862534046,\n",
              " 0.022883238270878792,\n",
              " 0.013009155169129372,\n",
              " -0.051252853125333786,\n",
              " 0.002804421354085207,\n",
              " -0.03370204195380211,\n",
              " 0.04111984744668007,\n",
              " 0.03095885179936886,\n",
              " 0.007305840961635113,\n",
              " -0.03168663755059242,\n",
              " 0.027040008455514908,\n",
              " -0.0417916513979435,\n",
              " -0.016263194382190704,\n",
              " 0.025920340791344643,\n",
              " -0.008432508446276188,\n",
              " 0.006857973523437977,\n",
              " 0.028201665729284286,\n",
              " -0.037956781685352325,\n",
              " 0.009776110760867596,\n",
              " 0.031714629381895065,\n",
              " 0.014093834906816483,\n",
              " -0.01465366967022419,\n",
              " 0.0286355372518301,\n",
              " -0.048005811870098114,\n",
              " 0.03666916489601135,\n",
              " 0.006913956720381975,\n",
              " 0.01079780887812376,\n",
              " 0.03342212364077568,\n",
              " -0.04822974652051926,\n",
              " 0.0784888043999672,\n",
              " -0.014821619726717472,\n",
              " -0.008677436038851738,\n",
              " -0.04008415341377258,\n",
              " -0.03916042670607567,\n",
              " 0.005090995691716671,\n",
              " -0.04487074166536331,\n",
              " -0.03345011547207832,\n",
              " 0.004933542106300592,\n",
              " -0.030818892642855644,\n",
              " 0.056515298783779144,\n",
              " -0.030818892642855644,\n",
              " 0.03888050839304924,\n",
              " 0.012106422334909439,\n",
              " -0.000954342947807163,\n",
              " 0.04408697038888931,\n",
              " 0.007165882270783186,\n",
              " 0.009041327983140945,\n",
              " 0.01549342181533575,\n",
              " -0.007319836877286434,\n",
              " -0.009706132113933563,\n",
              " -0.024394791573286057,\n",
              " -0.03350609913468361,\n",
              " -0.026844067499041557,\n",
              " 0.000995455775409937,\n",
              " 0.05175670608878136,\n",
              " 0.0015937789576128125,\n",
              " -0.05794287845492363,\n",
              " 0.0288314800709486,\n",
              " -0.0670681819319725,\n",
              " -0.012281370349228382,\n",
              " -0.014863607473671436,\n",
              " 0.01787271909415722,\n",
              " -0.0010925520909950137,\n",
              " -0.015017561614513397,\n",
              " -0.04397500306367874,\n",
              " -0.008474495261907578,\n",
              " 0.026228249073028564,\n",
              " -0.030231066048145294,\n",
              " -0.018012676388025284,\n",
              " -0.011217685416340828,\n",
              " 0.021273713558912277,\n",
              " -0.04632630944252014,\n",
              " -0.014009859412908554,\n",
              " 0.005720809567719698,\n",
              " 0.010000044479966164,\n",
              " 0.05483579635620117,\n",
              " 0.028103694319725037,\n",
              " -0.02726394310593605,\n",
              " -0.027235951274633408,\n",
              " 0.01529747899621725,\n",
              " -0.024954626336693764,\n",
              " -0.05069302022457123,\n",
              " -0.02012605220079422,\n",
              " 0.02775379829108715,\n",
              " 0.01235134992748499,\n",
              " 0.04260341078042984,\n",
              " 0.023876944556832314,\n",
              " -0.009874082170426846,\n",
              " -0.023904936388134956,\n",
              " -0.007242859806865454,\n",
              " -0.0033817505463957787,\n",
              " -0.03342212364077568,\n",
              " -0.027991728857159615,\n",
              " -0.008271555416285992,\n",
              " -0.038236699998378754,\n",
              " -0.009979050606489182,\n",
              " 0.031882576644420624,\n",
              " 0.059454429894685745,\n",
              " -0.028117690235376358,\n",
              " -0.019090358167886734,\n",
              " 0.035129617899656296,\n",
              " 0.03734096512198448,\n",
              " 0.026354212313890457,\n",
              " 0.004653624724596739,\n",
              " -0.03664117306470871,\n",
              " 0.013813917525112629,\n",
              " -0.014975574798882008,\n",
              " -0.019972097128629684,\n",
              " -0.011497601866722107,\n",
              " -0.0001862106000771746,\n",
              " 0.03594137728214264,\n",
              " -0.03028704971075058,\n",
              " 0.02747388184070587,\n",
              " -0.025430485606193542,\n",
              " 0.10412922501564026,\n",
              " -0.0296152476221323,\n",
              " -0.013044144958257675,\n",
              " -0.0019016880542039871,\n",
              " -0.0044261920265853405,\n",
              " -0.04190361499786377,\n",
              " 0.000921977567486465,\n",
              " 0.03773285076022148,\n",
              " -0.01610923931002617,\n",
              " -0.024254832416772842,\n",
              " -0.028565557673573494,\n",
              " -0.013869901187717915,\n",
              " -0.017424849793314934,\n",
              " 0.011154703795909882,\n",
              " -0.0368930958211422,\n",
              " 0.01865648664534092,\n",
              " 0.0030231066048145294,\n",
              " 0.004622133914381266,\n",
              " 0.03812473267316818,\n",
              " 0.02522054687142372,\n",
              " 0.00894335750490427,\n",
              " -0.030902868136763573,\n",
              " 0.012519299983978271,\n",
              " 0.028943447396159172,\n",
              " 0.022743279114365578,\n",
              " 0.012792219407856464,\n",
              " -0.018292594701051712,\n",
              " 0.010608864948153496,\n",
              " -0.008054619655013084,\n",
              " -0.0018981890752911568,\n",
              " 0.04554254189133644,\n",
              " 0.014009859412908554,\n",
              " 0.009874082170426846,\n",
              " -0.011189693585038185,\n",
              " -0.03557748720049858,\n",
              " -0.014107830822467804,\n",
              " 0.012281370349228382,\n",
              " 0.02891545556485653,\n",
              " -0.04624233394861221,\n",
              " -0.0030685930978506804,\n",
              " -0.04366709664463997,\n",
              " -0.02081185020506382,\n",
              " -0.0555075965821743,\n",
              " 0.025822369381785393,\n",
              " -0.0035601980052888393,\n",
              " -0.013939880765974522,\n",
              " -0.010979754850268364,\n",
              " 0.04249144345521927,\n",
              " 0.0022638309746980667,\n",
              " -0.006525571458041668,\n",
              " -0.007634743582457304,\n",
              " -0.0037403947208076715,\n",
              " 0.0026277233846485615,\n",
              " 0.033758025616407394,\n",
              " 0.02502460405230522,\n",
              " 0.023219138383865356,\n",
              " 0.013408037833869457,\n",
              " 0.010370935313403606,\n",
              " -0.012876194901764393,\n",
              " -0.043415170162916183,\n",
              " 0.015549404546618462,\n",
              " -0.01065085269510746,\n",
              " -0.0047096083872020245,\n",
              " 0.005923749413341284,\n",
              " 0.012386339716613293,\n",
              " -0.008313543163239956,\n",
              " -0.019314292818307877,\n",
              " 0.0023757978342473507,\n",
              " 0.015269487164914608,\n",
              " 0.01806866005063057,\n",
              " 0.009559174999594688,\n",
              " -0.026718104258179665,\n",
              " -0.015885306522250175,\n",
              " 0.007711721118539572,\n",
              " 0.026158269494771957,\n",
              " 0.022813258692622185,\n",
              " -0.0008314417791552842,\n",
              " 0.0029601252172142267,\n",
              " 0.005626337137073278,\n",
              " -0.03818071633577347,\n",
              " 0.02021002769470215,\n",
              " -0.006280643865466118,\n",
              " 0.05004920810461044,\n",
              " 0.05444391071796417,\n",
              " 0.010825800709426403,\n",
              " -0.0025035100989043713,\n",
              " 0.007071410305798054,\n",
              " -0.0572710745036602,\n",
              " 0.026116281747817993,\n",
              " 0.03359007462859154,\n",
              " -0.03876854479312897,\n",
              " -0.009363233111798763,\n",
              " 0.032582372426986694,\n",
              " -0.015955284237861633,\n",
              " -0.02072787471115589,\n",
              " 0.0026802080683410168,\n",
              " 0.012449321337044239,\n",
              " 0.014044849202036858,\n",
              " 0.010461908765137196,\n",
              " -0.04397500306367874,\n",
              " 0.013296070508658886,\n",
              " -0.001736361882649362,\n",
              " -0.03694907948374748,\n",
              " 0.004016812890768051,\n",
              " 0.014527706429362297,\n",
              " 0.047138068825006485,\n",
              " -0.011882488615810871,\n",
              " 0.008516483008861542,\n",
              " 0.05226055532693863,\n",
              " 0.011350645683705807,\n",
              " -0.028747504577040672,\n",
              " -0.008635448291897774,\n",
              " -0.03459777683019638,\n",
              " -0.016879012808203697,\n",
              " 0.016263194382190704,\n",
              " -0.008544474840164185,\n",
              " -0.029867174103856087,\n",
              " 0.02082584612071514,\n",
              " -0.04209955781698227,\n",
              " 0.018250606954097748,\n",
              " 0.0017757252790033817,\n",
              " -0.018348578363656998,\n",
              " -0.0017949695466086268,\n",
              " 0.009888078086078167,\n",
              " -0.02755785547196865,\n",
              " -0.04111984744668007,\n",
              " -0.0016165223205462098,\n",
              " -0.009216275997459888,\n",
              " -0.028411604464054108,\n",
              " 0.003974825609475374,\n",
              " 0.017172925174236298,\n",
              " -0.006137186195701361,\n",
              " 0.011231680400669575,\n",
              " -0.007998635992407799,\n",
              " -0.019692180678248405,\n",
              " 0.008397518657147884,\n",
              " 0.004979028832167387,\n",
              " 0.01661309041082859,\n",
              " -0.0021378681994974613,\n",
              " -0.03331015631556511,\n",
              " 0.001287619466893375,\n",
              " 0.011147705838084221,\n",
              " -0.03280630707740784,\n",
              " 0.017830731347203255,\n",
              " 0.0054723829962313175,\n",
              " 0.013652965426445007,\n",
              " 0.03339413180947304,\n",
              " 0.011049734428524971,\n",
              " -0.028271645307540894,\n",
              " -0.007648739498108625,\n",
              " -0.03417789936065674,\n",
              " 0.05500374734401703,\n",
              " 0.0018509529763832688,\n",
              " -0.009174289181828499,\n",
              " -0.017522821202874184,\n",
              " 0.01114070788025856,\n",
              " -0.027319926768541336,\n",
              " 0.029391314834356308,\n",
              " -0.013736940920352936,\n",
              " 0.0001765884371707216,\n",
              " 0.02734791859984398,\n",
              " 0.008607456460595131,\n",
              " 0.03916042670607567,\n",
              " 0.011098720133304596,\n",
              " 0.0003118453314527869,\n",
              " 0.006616544909775257,\n",
              " 0.0300071332603693,\n",
              " 0.02677408792078495,\n",
              " -0.0006035716505721211,\n",
              " 0.0025839863810688257,\n",
              " 0.024590732529759407,\n",
              " -0.021637605503201485,\n",
              " -0.028369616717100143,\n",
              " -0.0044891731813549995,\n",
              " -0.02470269985496998,\n",
              " 0.004611636977642775,\n",
              " 0.026648124679923058,\n",
              " -0.007228863891214132,\n",
              " -0.029559263959527016,\n",
              " -0.0119664641097188,\n",
              " -0.0008611829834990203,\n",
              " -0.03426187485456467,\n",
              " -0.015689363703131676,\n",
              " 0.012624269351363182,\n",
              " -0.00981809850782156,\n",
              " -0.0074527976103127,\n",
              " 0.03417789936065674,\n",
              " 0.020951807498931885,\n",
              " 0.021161746233701706,\n",
              " -0.005633335094898939,\n",
              " 0.013051142916083336,\n",
              " -0.022827254608273506,\n",
              " -0.051252853125333786,\n",
              " 0.010370935313403606,\n",
              " 0.006095198914408684,\n",
              " -5.8881036238744855e-05,\n",
              " 0.03235843777656555,\n",
              " -0.012085428461432457,\n",
              " -0.010573875159025192,\n",
              " 0.013107126578688622,\n",
              " -0.0026767090894281864,\n",
              " 0.036389246582984924,\n",
              " -0.008474495261907578,\n",
              " 0.01055288128554821,\n",
              " 0.01249830611050129,\n",
              " -0.02014004811644554,\n",
              " -0.01886642538011074,\n",
              " 0.00613368721678853,\n",
              " 0.0054723829962313175,\n",
              " 0.027795786038041115,\n",
              " -0.003247040556743741,\n",
              " 0.013156112283468246,\n",
              " 0.004331720061600208,\n",
              " -0.008859382010996342,\n",
              " -0.05181268975138664,\n",
              " -0.009454206563532352,\n",
              " 0.004468179773539305,\n",
              " -0.005787289701402187,\n",
              " 0.025766385719180107,\n",
              " -0.0007662735297344625,\n",
              " -0.04307926818728447,\n",
              " -0.004083293490111828,\n",
              " -0.0201120562851429,\n",
              " 0.05156076326966286,\n",
              " 0.007795696146786213,\n",
              " 0.00948219746351242,\n",
              " -0.018390566110610962,\n",
              " -0.010195987299084663,\n",
              " -0.00011524719593580812,\n",
              " -0.009251265786588192,\n",
              " -0.0065605612471699715,\n",
              " 0.0067914929240942,\n",
              " -0.027040008455514908,\n",
              " -0.01699097827076912,\n",
              " -0.029391314834356308,\n",
              " 0.003273282665759325,\n",
              " 0.02608828991651535,\n",
              " 0.009160293266177177,\n",
              " -0.015087541192770004,\n",
              " -0.011147705838084221,\n",
              " -0.01945425011217594,\n",
              " 0.009048325940966606,\n",
              " 0.0014337013708427548,\n",
              " -0.0022410876117646694,\n",
              " 0.029363323003053665,\n",
              " 0.005283438600599766,\n",
              " 0.035409536212682724,\n",
              " 0.0029951150063425303,\n",
              " 0.02941930666565895,\n",
              " -0.0050665028393268585,\n",
              " 0.0050070201978087425,\n",
              " -0.03157467022538185,\n",
              " -0.0607980340719223,\n",
              " -0.013121122494339943,\n",
              " -0.01904837042093277,\n",
              " -0.03417789936065674,\n",
              " -0.01549342181533575,\n",
              " 0.018530523404479027,\n",
              " 0.03538154438138008,\n",
              " -0.018054664134979248,\n",
              " 0.007060913369059563,\n",
              " 0.0037683863192796707,\n",
              " -0.011252674274146557,\n",
              " -0.03308622166514397,\n",
              " -0.011945470236241817,\n",
              " -0.018782449886202812,\n",
              " 0.012736236676573753,\n",
              " 0.0011030490277335048,\n",
              " -0.02286924235522747,\n",
              " -0.011924476362764835,\n",
              " -0.0018387066666036844,\n",
              " 0.011812509037554264,\n",
              " 0.019384272396564484,\n",
              " 0.03596936911344528,\n",
              " -0.003526957705616951,\n",
              " -0.009608160704374313,\n",
              " 0.014695657417178154,\n",
              " 0.00967114232480526,\n",
              " 0.02628423273563385,\n",
              " -0.060518115758895874,\n",
              " -0.012302364222705364,\n",
              " -0.0026259738951921463,\n",
              " 0.01728489249944687,\n",
              " -0.002146615646779537,\n",
              " 0.010944765992462635,\n",
              " 0.023904936388134956,\n",
              " -0.048425689339637756,\n",
              " -0.0121134202927351,\n",
              " -0.008537476882338524,\n",
              " 0.02228141576051712,\n",
              " -0.02639620006084442,\n",
              " -0.08011232316493988,\n",
              " 0.03613732010126114,\n",
              " 0.021343693137168884,\n",
              " 0.012785221450030804,\n",
              " -0.0017766000237315893,\n",
              " -0.008999340236186981,\n",
              " -0.004338718019425869,\n",
              " 0.0006250027799978852,\n",
              " 0.01249830611050129,\n",
              " -0.048201754689216614,\n",
              " 0.033674050122499466,\n",
              " -0.004615135956555605,\n",
              " 0.010049030184745789,\n",
              " -0.028201665729284286,\n",
              " -0.013023151084780693,\n",
              " 0.0017932200571522117,\n",
              " 0.013995864428579807,\n",
              " -0.01748083345592022,\n",
              " -0.008663440123200417,\n",
              " -0.00932824332267046,\n",
              " -0.005731306504458189,\n",
              " -0.05111289396882057,\n",
              " -0.004405198153108358,\n",
              " 0.019692180678248405,\n",
              " -0.021637605503201485,\n",
              " -0.02950328215956688,\n",
              " -0.008215571753680706,\n",
              " 0.017522821202874184,\n",
              " 0.03496166691184044,\n",
              " 0.004023810848593712,\n",
              " -0.01818062737584114,\n",
              " 0.04711007699370384,\n",
              " -0.017914706841111183,\n",
              " -0.015129528939723969,\n",
              " 0.0607980340719223,\n",
              " 0.015675367787480354,\n",
              " -0.02862154133617878,\n",
              " 0.040783949196338654,\n",
              " -0.007172880228608847,\n",
              " -0.006504577584564686,\n",
              " -0.036585189402103424,\n",
              " -0.03182659298181534,\n",
              " 0.015437438152730465,\n",
              " 0.020965803414583206,\n",
              " 0.014527706429362297,\n",
              " -0.03398195654153824,\n",
              " -0.023611022159457207,\n",
              " -0.0031368229538202286,\n",
              " 0.01708894968032837,\n",
              " 0.024884646758437157,\n",
              " -0.003810374066233635,\n",
              " 0.018292594701051712,\n",
              " -0.0037578893825411797,\n",
              " -0.025668414309620857,\n",
              " -0.014443731866776943,\n",
              " -0.02187553606927395,\n",
              " 0.0003715464554261416,\n",
              " -0.013114124536514282,\n",
              " -0.0029758706223219633,\n",
              " 0.02365300990641117,\n",
              " -0.003338013542816043,\n",
              " -0.003855860559269786,\n",
              " -0.04408697038888931,\n",
              " -0.018096651881933212,\n",
              " 0.053296249359846115,\n",
              " -0.006728511769324541,\n",
              " 0.044198937714099884,\n",
              " 0.008327539078891277,\n",
              " -0.011539589613676071,\n",
              " -0.0007448424003086984,\n",
              " -0.021511642262339592,\n",
              " 0.007305840961635113,\n",
              " 0.015675367787480354,\n",
              " 0.03949632868170738,\n",
              " 0.011679548770189285,\n",
              " -0.03566146269440651,\n",
              " 0.020657895132899284,\n",
              " -0.04652225226163864,\n",
              " -0.020154044032096863,\n",
              " 0.0063996086828410625,\n",
              " 0.0031735622324049473,\n",
              " 0.0016900005284696817,\n",
              " -0.0212877094745636,\n",
              " -0.0410078801214695,\n",
              " 0.009867084212601185,\n",
              " 0.003161315806210041,\n",
              " 0.007057414390146732,\n",
              " -0.05430395156145096,\n",
              " 0.0276558268815279,\n",
              " 0.0235410425812006,\n",
              " 4.871216879109852e-05,\n",
              " 0.009055323898792267,\n",
              " 0.045290615409612656,\n",
              " 0.008236565627157688,\n",
              " -0.003180560190230608,\n",
              " 0.022421374917030334,\n",
              " -0.010105013847351074,\n",
              " -0.011084724217653275,\n",
              " 0.022883238270878792,\n",
              " 0.032078519463539124,\n",
              " 0.01708894968032837,\n",
              " 0.034737735986709595,\n",
              " 0.03636125475168228,\n",
              " 0.008516483008861542,\n",
              " 0.0429673008620739,\n",
              " 0.00016160849190782756,\n",
              " 0.005073500797152519,\n",
              " -0.0031018333975225687,\n",
              " -0.02688605524599552,\n",
              " -0.00029413183801807463,\n",
              " 0.02891545556485653,\n",
              " 0.07417807728052139,\n",
              " 0.024688703939318657,\n",
              " 0.011014744639396667,\n",
              " 0.011574579402804375,\n",
              " -0.026214253157377243,\n",
              " -0.03792878985404968,\n",
              " 0.001764353597536683,\n",
              " -0.021763568744063377,\n",
              " -0.014079838991165161,\n",
              " -0.00720787001773715,\n",
              " 0.03812473267316818,\n",
              " 0.0069769383408129215,\n",
              " 0.0010890531120821834,\n",
              " -0.0008183206664398313,\n",
              " -0.011231680400669575,\n",
              " 0.003152568358927965,\n",
              " 0.008950355462729931,\n",
              " -0.006028718315064907,\n",
              " -0.018978390842676163,\n",
              " -0.05150477960705757,\n",
              " -0.017522821202874184,\n",
              " -0.003009110689163208,\n",
              " 0.029755206778645515,\n",
              " 0.012652261182665825,\n",
              " -0.0419875904917717,\n",
              " 0.04565450921654701,\n",
              " 0.008530478924512863,\n",
              " -0.009510189294815063,\n",
              " -0.0061126938089728355,\n",
              " -0.045682501047849655,\n",
              " 0.0026784585788846016,\n",
              " -0.003105332376435399,\n",
              " 0.020545927807688713,\n",
              " -0.053884077817201614,\n",
              " -0.0235410425812006,\n",
              " 0.001231636037118733,\n",
              " -0.032190486788749695,\n",
              " -0.008173584938049316,\n",
              " -0.008915365673601627,\n",
              " -0.006843977607786655,\n",
              " -0.0031368229538202286,\n",
              " 0.007564764469861984,\n",
              " 0.019804148003458977,\n",
              " -0.0032138002570718527,\n",
              " 0.004118282813578844,\n",
              " -0.02237938717007637,\n",
              " -0.006630540359765291,\n",
              " 0.028593549504876137,\n",
              " -0.00894335750490427,\n",
              " -0.0006643661763519049,\n",
              " 0.018208619207143784,\n",
              " -0.0022708289325237274,\n",
              " 0.016753049567341805,\n",
              " -0.02706800028681755,\n",
              " 0.014709653332829475,\n",
              " 0.005899256560951471,\n",
              " -0.006438097450882196,\n",
              " -0.006161679048091173,\n",
              " -0.03997218608856201,\n",
              " -0.039636287838220596,\n",
              " -0.004958034958690405,\n",
              " 0.016291186213493347,\n",
              " -0.03129475191235542,\n",
              " -0.029055412858724594,\n",
              " -0.04279935359954834,\n",
              " -0.015451434068381786,\n",
              " -0.027235951274633408,\n",
              " 0.003574193688109517,\n",
              " -0.0047096083872020245,\n",
              " 0.025388497859239578,\n",
              " -0.007508780807256699,\n",
              " 0.02050394006073475,\n",
              " -0.00672151381149888,\n",
              " -0.02666212059557438,\n",
              " 0.007753708865493536,\n",
              " -0.014247789978981018,\n",
              " -0.014009859412908554,\n",
              " 0.01689300872385502,\n",
              " -0.004170767497271299,\n",
              " -0.006256151013076305,\n",
              " -0.008208573795855045,\n",
              " -0.020000088959932327,\n",
              " -0.004583645612001419,\n",
              " -0.022225432097911835,\n",
              " 0.024898642674088478,\n",
              " 0.011511597782373428,\n",
              " 0.061021968722343445,\n",
              " -0.03526957705616951,\n",
              " 0.013254082761704922,\n",
              " 0.035017650574445724,\n",
              " 0.011917478404939175,\n",
              " -0.03163065388798714,\n",
              " -0.044114962220191956,\n",
              " 0.006025219336152077,\n",
              " 0.032778315246105194,\n",
              " -0.014485719613730907,\n",
              " -0.0028813984245061874,\n",
              " 0.007578760385513306,\n",
              " -0.011399631388485432,\n",
              " 0.03482171148061752,\n",
              " 0.0028009223751723766,\n",
              " -0.0144157400354743,\n",
              " 0.020769862458109856,\n",
              " -0.007648739498108625,\n",
              " 0.021455658599734306,\n",
              " -0.024842659011483192,\n",
              " 0.056319355964660645,\n",
              " 0.030846884474158287,\n",
              " -0.0127502316609025,\n",
              " -0.022127460688352585,\n",
              " 0.0300071332603693,\n",
              " -0.0024685205426067114,\n",
              " 0.0017608546186238527,\n",
              " ...]"
            ]
          },
          "execution_count": 8,
          "metadata": {},
          "output_type": "execute_result"
        }
      ],
      "source": [
        "import openai\n",
        "import numpy as np\n",
        "from openai import OpenAI\n",
        "\n",
        "# Initialize OpenAI client\n",
        "client = OpenAI(api_key=secret_key)\n",
        "MODEL = \"gpt-4.1-mini\"\n",
        "\n",
        "# Function to get the vector embedding for a given text\n",
        "def get_vector_embeddings(text):\n",
        "    response = client.embeddings.create(\n",
        "        input=text,\n",
        "        model=\"text-embedding-3-small\"  # Using latest embedding model\n",
        "    )\n",
        "    embeddings = response.data[0].embedding\n",
        "    return embeddings\n",
        "\n",
        "\n",
        "get_vector_embeddings(\"Your text string goes here\")"
      ]
    },
    {
      "cell_type": "code",
      "execution_count": 5,
      "metadata": {
        "colab": {
          "background_save": true
        },
        "id": "8xLHPh-uHrU8",
        "outputId": "c77d546f-f439-4aec-ad84-d4e28cf4792f"
      },
      "outputs": [
        {
          "name": "stdout",
          "output_type": "stream",
          "text": [
            "10\n"
          ]
        },
        {
          "data": {
            "text/plain": [
              "['From Adam West to Robert Pattinson: this is how Batman has changed over the years\\nBatman is one of the most recognizable superheroes in pop culture, starting with his first appearance in Detective Comics #27 in 1939. He has been listed as one of the most iconic characters in popular culture, and among the greatest comic book superheroes and fictional characters ever created. While Batman is sometimes paired with Superman,\\n\\nIsabel Cara\\n\\n\\n\\n\\n\\n00:08 / 00:20\\nBatman is one of the most recognizable superheroes in pop culture, starting with his first appearance in Detective Comics #27 in 1939. He has been listed as one of the most iconic characters in popular culture, and among the greatest comic book superheroes and fictional characters ever created.\\n\\nWhile Batman is sometimes paired with Superman, Wonder Woman, and others from the Justice League, his stories have so much potential that they have been made into movies, tv shows, videogames, toy lines, radio, even musical theatre.\\n\\nYou might find interesting: ‘The Batman’: Villains who would be exceptional candidates for the sequel\\n\\nADVERTISING\\n\\nSo, let’s talk about how Batman, in his live-action version, has changed through the years:\\n\\nThe Batman series (1966-1968), played by Adam West\\nV2qn2wliqvchxfxv6w56zqm6se - from adam west to robert pattinson: this is how batman has changed over the years\\nThis tv show (and a movie in 1966) portrays the character in a camp aesthetic, meaning that it could be appealing because of its bad taste and ironic value (like those “so bad it’s good” movies), but they camp things can also be described as “cheesy”.\\n\\nThis aesthetic was associated with Batman for years after the show ended, and comic creators worked hard to return the character to his darker roots in the decades that followed, culminating in The Dark Knight Returns (1986) by Frank Miller.\\n\\n\\nNevertheless, this Batman holds a special place in every fan because references to this show have appeared in almost every Batman movie made after.',\n",
              " 'He has been listed as one of the most iconic characters in popular culture, and among the greatest comic book superheroes and fictional characters ever created. While Batman is sometimes paired with Superman,\\n\\nIsabel Cara\\n\\n\\n\\n\\n\\n00:08 / 00:20\\nBatman is one of the most recognizable superheroes in pop culture, starting with his first appearance in Detective Comics #27 in 1939. He has been listed as one of the most iconic characters in popular culture, and among the greatest comic book superheroes and fictional characters ever created.\\n\\nWhile Batman is sometimes paired with Superman, Wonder Woman, and others from the Justice League, his stories have so much potential that they have been made into movies, tv shows, videogames, toy lines, radio, even musical theatre.\\n\\nYou might find interesting: ‘The Batman’: Villains who would be exceptional candidates for the sequel\\n\\nADVERTISING\\n\\nSo, let’s talk about how Batman, in his live-action version, has changed through the years:\\n\\nThe Batman series (1966-1968), played by Adam West\\nV2qn2wliqvchxfxv6w56zqm6se - from adam west to robert pattinson: this is how batman has changed over the years\\nThis tv show (and a movie in 1966) portrays the character in a camp aesthetic, meaning that it could be appealing because of its bad taste and ironic value (like those “so bad it’s good” movies), but they camp things can also be described as “cheesy”.\\n\\nThis aesthetic was associated with Batman for years after the show ended, and comic creators worked hard to return the character to his darker roots in the decades that followed, culminating in The Dark Knight Returns (1986) by Frank Miller.\\n\\n\\nNevertheless, this Batman holds a special place in every fan because references to this show have appeared in almost every Batman movie made after. With references appearing in media that is not related to the character, like the movie Ready Player One, and shows like The Simpsons, SpongeBob SquarePants, and The Fairly OddParents.\\n\\nWhile it might not be considered the best version of Batman, it’s the Batman that opened the doors to what we have now.\\n\\nBatman (1989), played by Michael Keaton\\n6aheuzaikfealdjwgzy6366xt4 - from adam west to robert pattinson: this is how batman has changed over the years\\nThis was a groundbreaking movie directed by Tim Burton, and starring Jack Nicholson, Michael Keaton, Kim Basinger, Robert Wuhl, Pat Hingle, Billy Dee Williams, Michael Gough, and Jack Palance.\\n\\nThe movie was successful critically and financially, making it the 5th highest-grossing film in history (at the time of its release).\\n\\nIt inspired Batman: The Animated Series (1992-1995), paving the way for the DC Animated Universe.',\n",
              " 'While Batman is sometimes paired with Superman,\\n\\nIsabel Cara\\n\\n\\n\\n\\n\\n00:08 / 00:20\\nBatman is one of the most recognizable superheroes in pop culture, starting with his first appearance in Detective Comics #27 in 1939. He has been listed as one of the most iconic characters in popular culture, and among the greatest comic book superheroes and fictional characters ever created.\\n\\nWhile Batman is sometimes paired with Superman, Wonder Woman, and others from the Justice League, his stories have so much potential that they have been made into movies, tv shows, videogames, toy lines, radio, even musical theatre.\\n\\nYou might find interesting: ‘The Batman’: Villains who would be exceptional candidates for the sequel\\n\\nADVERTISING\\n\\nSo, let’s talk about how Batman, in his live-action version, has changed through the years:\\n\\nThe Batman series (1966-1968), played by Adam West\\nV2qn2wliqvchxfxv6w56zqm6se - from adam west to robert pattinson: this is how batman has changed over the years\\nThis tv show (and a movie in 1966) portrays the character in a camp aesthetic, meaning that it could be appealing because of its bad taste and ironic value (like those “so bad it’s good” movies), but they camp things can also be described as “cheesy”.\\n\\nThis aesthetic was associated with Batman for years after the show ended, and comic creators worked hard to return the character to his darker roots in the decades that followed, culminating in The Dark Knight Returns (1986) by Frank Miller.\\n\\n\\nNevertheless, this Batman holds a special place in every fan because references to this show have appeared in almost every Batman movie made after. With references appearing in media that is not related to the character, like the movie Ready Player One, and shows like The Simpsons, SpongeBob SquarePants, and The Fairly OddParents.\\n\\nWhile it might not be considered the best version of Batman, it’s the Batman that opened the doors to what we have now.\\n\\nBatman (1989), played by Michael Keaton\\n6aheuzaikfealdjwgzy6366xt4 - from adam west to robert pattinson: this is how batman has changed over the years\\nThis was a groundbreaking movie directed by Tim Burton, and starring Jack Nicholson, Michael Keaton, Kim Basinger, Robert Wuhl, Pat Hingle, Billy Dee Williams, Michael Gough, and Jack Palance.\\n\\nThe movie was successful critically and financially, making it the 5th highest-grossing film in history (at the time of its release).\\n\\nIt inspired Batman: The Animated Series (1992-1995), paving the way for the DC Animated Universe. The film has also influenced Hollywood’s modern marketing and development techniques of the superhero film genre.\\n\\nIt created the “Batmania” pop-culture phenomenon and made Batman cool again.\\n\\nBatman Forever (1995), played by Val Kilmer\\n47zcqedjfrerpgasyogbpwjsvu - from adam west to robert pattinson: this is how batman has changed over the years\\nThis movie strayed away from the aesthetic of Tim Burton’s Batman, making it more colorful and over-the-top, especially with Jim Carey’s Ridley and Tommy Lee Jones’s Two-Face.\\n\\nIt received mixed reviews from critics, but was a box office success, becoming the 6th highest-grossing film worldwide in 1995.',\n",
              " 'He has been listed as one of the most iconic characters in popular culture, and among the greatest comic book superheroes and fictional characters ever created.\\n\\nWhile Batman is sometimes paired with Superman, Wonder Woman, and others from the Justice League, his stories have so much potential that they have been made into movies, tv shows, videogames, toy lines, radio, even musical theatre.\\n\\nYou might find interesting: ‘The Batman’: Villains who would be exceptional candidates for the sequel\\n\\nADVERTISING\\n\\nSo, let’s talk about how Batman, in his live-action version, has changed through the years:\\n\\nThe Batman series (1966-1968), played by Adam West\\nV2qn2wliqvchxfxv6w56zqm6se - from adam west to robert pattinson: this is how batman has changed over the years\\nThis tv show (and a movie in 1966) portrays the character in a camp aesthetic, meaning that it could be appealing because of its bad taste and ironic value (like those “so bad it’s good” movies), but they camp things can also be described as “cheesy”.\\n\\nThis aesthetic was associated with Batman for years after the show ended, and comic creators worked hard to return the character to his darker roots in the decades that followed, culminating in The Dark Knight Returns (1986) by Frank Miller.\\n\\n\\nNevertheless, this Batman holds a special place in every fan because references to this show have appeared in almost every Batman movie made after. With references appearing in media that is not related to the character, like the movie Ready Player One, and shows like The Simpsons, SpongeBob SquarePants, and The Fairly OddParents.\\n\\nWhile it might not be considered the best version of Batman, it’s the Batman that opened the doors to what we have now.\\n\\nBatman (1989), played by Michael Keaton\\n6aheuzaikfealdjwgzy6366xt4 - from adam west to robert pattinson: this is how batman has changed over the years\\nThis was a groundbreaking movie directed by Tim Burton, and starring Jack Nicholson, Michael Keaton, Kim Basinger, Robert Wuhl, Pat Hingle, Billy Dee Williams, Michael Gough, and Jack Palance.\\n\\nThe movie was successful critically and financially, making it the 5th highest-grossing film in history (at the time of its release).\\n\\nIt inspired Batman: The Animated Series (1992-1995), paving the way for the DC Animated Universe. The film has also influenced Hollywood’s modern marketing and development techniques of the superhero film genre.\\n\\nIt created the “Batmania” pop-culture phenomenon and made Batman cool again.\\n\\nBatman Forever (1995), played by Val Kilmer\\n47zcqedjfrerpgasyogbpwjsvu - from adam west to robert pattinson: this is how batman has changed over the years\\nThis movie strayed away from the aesthetic of Tim Burton’s Batman, making it more colorful and over-the-top, especially with Jim Carey’s Ridley and Tommy Lee Jones’s Two-Face.\\n\\nIt received mixed reviews from critics, but was a box office success, becoming the 6th highest-grossing film worldwide in 1995. Nevertheless, this movie tends to be ignored currently, with many fans not even remembering that Val Kilmer was Batman.\\n\\nBatman & Robin (1997), played by George Clooney\\n3bulsal75ncwzny3xvd2nz33le - from adam west to robert pattinson: this is how batman has changed over the years\\nThis film is regarded as the worst Batman movie and even getting spots as one of the worst movies ever made.\\n\\n\\nIt has become infamous because of the neon design, the Batnipples, and just being a franchise-killing movie (after being considered a box office disappointment, Warner Bros.',\n",
              " 'With references appearing in media that is not related to the character, like the movie Ready Player One, and shows like The Simpsons, SpongeBob SquarePants, and The Fairly OddParents.\\n\\nWhile it might not be considered the best version of Batman, it’s the Batman that opened the doors to what we have now.\\n\\nBatman (1989), played by Michael Keaton\\n6aheuzaikfealdjwgzy6366xt4 - from adam west to robert pattinson: this is how batman has changed over the years\\nThis was a groundbreaking movie directed by Tim Burton, and starring Jack Nicholson, Michael Keaton, Kim Basinger, Robert Wuhl, Pat Hingle, Billy Dee Williams, Michael Gough, and Jack Palance.\\n\\nThe movie was successful critically and financially, making it the 5th highest-grossing film in history (at the time of its release).\\n\\nIt inspired Batman: The Animated Series (1992-1995), paving the way for the DC Animated Universe. The film has also influenced Hollywood’s modern marketing and development techniques of the superhero film genre.\\n\\nIt created the “Batmania” pop-culture phenomenon and made Batman cool again.\\n\\nBatman Forever (1995), played by Val Kilmer\\n47zcqedjfrerpgasyogbpwjsvu - from adam west to robert pattinson: this is how batman has changed over the years\\nThis movie strayed away from the aesthetic of Tim Burton’s Batman, making it more colorful and over-the-top, especially with Jim Carey’s Ridley and Tommy Lee Jones’s Two-Face.\\n\\nIt received mixed reviews from critics, but was a box office success, becoming the 6th highest-grossing film worldwide in 1995. Nevertheless, this movie tends to be ignored currently, with many fans not even remembering that Val Kilmer was Batman.\\n\\nBatman & Robin (1997), played by George Clooney\\n3bulsal75ncwzny3xvd2nz33le - from adam west to robert pattinson: this is how batman has changed over the years\\nThis film is regarded as the worst Batman movie and even getting spots as one of the worst movies ever made.\\n\\n\\nIt has become infamous because of the neon design, the Batnipples, and just being a franchise-killing movie (after being considered a box office disappointment, Warner Bros. decided to cancel future Batman films, like Schumacher’s -the director of this movie and Batman Forever- Batman Unchained).\\n\\nIt’s not even considered by fans “so bad it’s good”, and it’s almost always skipped in rewatches of the films.\\n\\nBatman Begins (2005), played by Christian Bale\\nDoggryf3mbfklnwfyzr2t7vyoi - from adam west to robert pattinson: this is how batman has changed over the years\\nThe most iconic Batman for the modern audience.',\n",
              " 'The film has also influenced Hollywood’s modern marketing and development techniques of the superhero film genre.\\n\\nIt created the “Batmania” pop-culture phenomenon and made Batman cool again.\\n\\nBatman Forever (1995), played by Val Kilmer\\n47zcqedjfrerpgasyogbpwjsvu - from adam west to robert pattinson: this is how batman has changed over the years\\nThis movie strayed away from the aesthetic of Tim Burton’s Batman, making it more colorful and over-the-top, especially with Jim Carey’s Ridley and Tommy Lee Jones’s Two-Face.\\n\\nIt received mixed reviews from critics, but was a box office success, becoming the 6th highest-grossing film worldwide in 1995. Nevertheless, this movie tends to be ignored currently, with many fans not even remembering that Val Kilmer was Batman.\\n\\nBatman & Robin (1997), played by George Clooney\\n3bulsal75ncwzny3xvd2nz33le - from adam west to robert pattinson: this is how batman has changed over the years\\nThis film is regarded as the worst Batman movie and even getting spots as one of the worst movies ever made.\\n\\n\\nIt has become infamous because of the neon design, the Batnipples, and just being a franchise-killing movie (after being considered a box office disappointment, Warner Bros. decided to cancel future Batman films, like Schumacher’s -the director of this movie and Batman Forever- Batman Unchained).\\n\\nIt’s not even considered by fans “so bad it’s good”, and it’s almost always skipped in rewatches of the films.\\n\\nBatman Begins (2005), played by Christian Bale\\nDoggryf3mbfklnwfyzr2t7vyoi - from adam west to robert pattinson: this is how batman has changed over the years\\nThe most iconic Batman for the modern audience. Christopher Nolan’s work makes it one of the best superhero movies of all time.\\n\\nIt rebooted the Batman film series, giving it a darker and more realistic tone compared to previous films (especially Schumacher’s job).',\n",
              " 'Nevertheless, this movie tends to be ignored currently, with many fans not even remembering that Val Kilmer was Batman.\\n\\nBatman & Robin (1997), played by George Clooney\\n3bulsal75ncwzny3xvd2nz33le - from adam west to robert pattinson: this is how batman has changed over the years\\nThis film is regarded as the worst Batman movie and even getting spots as one of the worst movies ever made.\\n\\n\\nIt has become infamous because of the neon design, the Batnipples, and just being a franchise-killing movie (after being considered a box office disappointment, Warner Bros. decided to cancel future Batman films, like Schumacher’s -the director of this movie and Batman Forever- Batman Unchained).\\n\\nIt’s not even considered by fans “so bad it’s good”, and it’s almost always skipped in rewatches of the films.\\n\\nBatman Begins (2005), played by Christian Bale\\nDoggryf3mbfklnwfyzr2t7vyoi - from adam west to robert pattinson: this is how batman has changed over the years\\nThe most iconic Batman for the modern audience. Christopher Nolan’s work makes it one of the best superhero movies of all time.\\n\\nIt rebooted the Batman film series, giving it a darker and more realistic tone compared to previous films (especially Schumacher’s job). The film wanted to create an emotional connection with the audience and the Batman and Bruce Wayne identities.\\n\\nThe film became the 9th highest-grossing film of 2005 and was followed by The Dark Knight (2008), and The Dark Knight Rises (2012).',\n",
              " 'decided to cancel future Batman films, like Schumacher’s -the director of this movie and Batman Forever- Batman Unchained).\\n\\nIt’s not even considered by fans “so bad it’s good”, and it’s almost always skipped in rewatches of the films.\\n\\nBatman Begins (2005), played by Christian Bale\\nDoggryf3mbfklnwfyzr2t7vyoi - from adam west to robert pattinson: this is how batman has changed over the years\\nThe most iconic Batman for the modern audience. Christopher Nolan’s work makes it one of the best superhero movies of all time.\\n\\nIt rebooted the Batman film series, giving it a darker and more realistic tone compared to previous films (especially Schumacher’s job). The film wanted to create an emotional connection with the audience and the Batman and Bruce Wayne identities.\\n\\nThe film became the 9th highest-grossing film of 2005 and was followed by The Dark Knight (2008), and The Dark Knight Rises (2012). Creating The Dark Knight Trilogy, and the reason many DC fans say that DC movies are better than Marvel Films.\\n\\nBatman v Superman: Dawn of Justice (2016), played by Ben Affleck\\nR6tzxansdngnra5ee5izdeocva - from adam west to robert pattinson: this is how batman has changed over the years\\nAffleck is the only actor (so far) to not get his solo movie, and the possibilities of it happening are uncertain, maybe even impossible.\\n\\nNevertheless, his role is different from the other Batmans, with him being older and jaded because of all the deaths and destruction he has seen but being hopeful in humanity among the member of the Justice League.\\n\\nHe feels like Batman and Bruce are the same guys, and it really is a shame we couldn’t spend more time with him.\\n\\nGotham (2014-2019), played by David Mazouz\\nQf7qau37anf75nknc5wwobmnkm - from adam west to robert pattinson: this is how batman has changed over the years\\nWait, who?',\n",
              " 'Christopher Nolan’s work makes it one of the best superhero movies of all time.\\n\\nIt rebooted the Batman film series, giving it a darker and more realistic tone compared to previous films (especially Schumacher’s job). The film wanted to create an emotional connection with the audience and the Batman and Bruce Wayne identities.\\n\\nThe film became the 9th highest-grossing film of 2005 and was followed by The Dark Knight (2008), and The Dark Knight Rises (2012). Creating The Dark Knight Trilogy, and the reason many DC fans say that DC movies are better than Marvel Films.\\n\\nBatman v Superman: Dawn of Justice (2016), played by Ben Affleck\\nR6tzxansdngnra5ee5izdeocva - from adam west to robert pattinson: this is how batman has changed over the years\\nAffleck is the only actor (so far) to not get his solo movie, and the possibilities of it happening are uncertain, maybe even impossible.\\n\\nNevertheless, his role is different from the other Batmans, with him being older and jaded because of all the deaths and destruction he has seen but being hopeful in humanity among the member of the Justice League.\\n\\nHe feels like Batman and Bruce are the same guys, and it really is a shame we couldn’t spend more time with him.\\n\\nGotham (2014-2019), played by David Mazouz\\nQf7qau37anf75nknc5wwobmnkm - from adam west to robert pattinson: this is how batman has changed over the years\\nWait, who? Well… yeah.\\n\\nThe show started following James Gordon in his early days at the Gotham City Police Department following the tragic deaths of Bruce’s parents and started telling the origin stories of some of the most infamous Batman villains.\\n\\nDuring the fourth season, Bruce Wayne starts to fight crime as a masked vigilante, and in the fifth (and final) season it shows Bruce becoming Batman for the first time.\\n\\n\\nWhile not the most popular version of Batman (I didn’t even know the show had Batman in it until doing research for this article), it promises to give a good origin story, and a side of the character we haven’t seen before.\\n\\nThe Batman (2022), played by Robert Pattinson\\nWu23mtvdhzbspep3rpmkrwm3fm - from adam west to robert pattinson: this is how batman has changed over the years\\nThis film, directed by Matt Reeves, is considered a reboot of the Batman film franchise (after the studio didn’t know what to do with Ben Affleck’s version).\\n\\nYou might find interesting: Robert Pattinson’s must watch films from ‘Twilight’ to ‘The Batman’\\n\\nIt tells the story of a young Batman, who has only been fighting crime for two years and is uncovering corruption while pursuing the Riddler, a serial killer who targets Gotham’s elite.\\n\\nPerhaps you have already seen it, or perhaps you’re like me and haven’t been able to find the time.',\n",
              " 'The film wanted to create an emotional connection with the audience and the Batman and Bruce Wayne identities.\\n\\nThe film became the 9th highest-grossing film of 2005 and was followed by The Dark Knight (2008), and The Dark Knight Rises (2012). Creating The Dark Knight Trilogy, and the reason many DC fans say that DC movies are better than Marvel Films.\\n\\nBatman v Superman: Dawn of Justice (2016), played by Ben Affleck\\nR6tzxansdngnra5ee5izdeocva - from adam west to robert pattinson: this is how batman has changed over the years\\nAffleck is the only actor (so far) to not get his solo movie, and the possibilities of it happening are uncertain, maybe even impossible.\\n\\nNevertheless, his role is different from the other Batmans, with him being older and jaded because of all the deaths and destruction he has seen but being hopeful in humanity among the member of the Justice League.\\n\\nHe feels like Batman and Bruce are the same guys, and it really is a shame we couldn’t spend more time with him.\\n\\nGotham (2014-2019), played by David Mazouz\\nQf7qau37anf75nknc5wwobmnkm - from adam west to robert pattinson: this is how batman has changed over the years\\nWait, who? Well… yeah.\\n\\nThe show started following James Gordon in his early days at the Gotham City Police Department following the tragic deaths of Bruce’s parents and started telling the origin stories of some of the most infamous Batman villains.\\n\\nDuring the fourth season, Bruce Wayne starts to fight crime as a masked vigilante, and in the fifth (and final) season it shows Bruce becoming Batman for the first time.\\n\\n\\nWhile not the most popular version of Batman (I didn’t even know the show had Batman in it until doing research for this article), it promises to give a good origin story, and a side of the character we haven’t seen before.\\n\\nThe Batman (2022), played by Robert Pattinson\\nWu23mtvdhzbspep3rpmkrwm3fm - from adam west to robert pattinson: this is how batman has changed over the years\\nThis film, directed by Matt Reeves, is considered a reboot of the Batman film franchise (after the studio didn’t know what to do with Ben Affleck’s version).\\n\\nYou might find interesting: Robert Pattinson’s must watch films from ‘Twilight’ to ‘The Batman’\\n\\nIt tells the story of a young Batman, who has only been fighting crime for two years and is uncovering corruption while pursuing the Riddler, a serial killer who targets Gotham’s elite.\\n\\nPerhaps you have already seen it, or perhaps you’re like me and haven’t been able to find the time. Either way, the memes for this movie and the use of Nirvana’s Something in the Way have been incredible.']"
            ]
          },
          "execution_count": 5,
          "metadata": {},
          "output_type": "execute_result"
        }
      ],
      "source": [
        "import re\n",
        "\n",
        "def chunk_text(text, window_size=5, stride=2):\n",
        "    # Tokenize the text into sentences\n",
        "    sentences = re.split('(?<=[.!?]) +', text.strip())\n",
        "\n",
        "    # Initialize the list of chunks\n",
        "    chunks = []\n",
        "\n",
        "    # Slide the window over the sentences\n",
        "    for i in range(0, len(sentences) - window_size + 1, stride):\n",
        "        # Add the current window to the chunks\n",
        "        chunks.append(' '.join(sentences[i:i + window_size]))\n",
        "\n",
        "    return chunks\n",
        "\n",
        "text = \"\"\"\n",
        "From Adam West to Robert Pattinson: this is how Batman has changed over the years\n",
        "Batman is one of the most recognizable superheroes in pop culture, starting with his first appearance in Detective Comics #27 in 1939. He has been listed as one of the most iconic characters in popular culture, and among the greatest comic book superheroes and fictional characters ever created. While Batman is sometimes paired with Superman,\n",
        "\n",
        "Isabel Cara\n",
        "\n",
        "\n",
        "\n",
        "\n",
        "\n",
        "00:08 / 00:20\n",
        "Batman is one of the most recognizable superheroes in pop culture, starting with his first appearance in Detective Comics #27 in 1939. He has been listed as one of the most iconic characters in popular culture, and among the greatest comic book superheroes and fictional characters ever created.\n",
        "\n",
        "While Batman is sometimes paired with Superman, Wonder Woman, and others from the Justice League, his stories have so much potential that they have been made into movies, tv shows, videogames, toy lines, radio, even musical theatre.\n",
        "\n",
        "You might find interesting: ‘The Batman’: Villains who would be exceptional candidates for the sequel\n",
        "\n",
        "ADVERTISING\n",
        "\n",
        "So, let’s talk about how Batman, in his live-action version, has changed through the years:\n",
        "\n",
        "The Batman series (1966-1968), played by Adam West\n",
        "V2qn2wliqvchxfxv6w56zqm6se - from adam west to robert pattinson: this is how batman has changed over the years\n",
        "This tv show (and a movie in 1966) portrays the character in a camp aesthetic, meaning that it could be appealing because of its bad taste and ironic value (like those “so bad it’s good” movies), but they camp things can also be described as “cheesy”.\n",
        "\n",
        "This aesthetic was associated with Batman for years after the show ended, and comic creators worked hard to return the character to his darker roots in the decades that followed, culminating in The Dark Knight Returns (1986) by Frank Miller.\n",
        "\n",
        "\n",
        "Nevertheless, this Batman holds a special place in every fan because references to this show have appeared in almost every Batman movie made after. With references appearing in media that is not related to the character, like the movie Ready Player One, and shows like The Simpsons, SpongeBob SquarePants, and The Fairly OddParents.\n",
        "\n",
        "While it might not be considered the best version of Batman, it’s the Batman that opened the doors to what we have now.\n",
        "\n",
        "Batman (1989), played by Michael Keaton\n",
        "6aheuzaikfealdjwgzy6366xt4 - from adam west to robert pattinson: this is how batman has changed over the years\n",
        "This was a groundbreaking movie directed by Tim Burton, and starring Jack Nicholson, Michael Keaton, Kim Basinger, Robert Wuhl, Pat Hingle, Billy Dee Williams, Michael Gough, and Jack Palance.\n",
        "\n",
        "The movie was successful critically and financially, making it the 5th highest-grossing film in history (at the time of its release).\n",
        "\n",
        "It inspired Batman: The Animated Series (1992-1995), paving the way for the DC Animated Universe. The film has also influenced Hollywood’s modern marketing and development techniques of the superhero film genre.\n",
        "\n",
        "It created the “Batmania” pop-culture phenomenon and made Batman cool again.\n",
        "\n",
        "Batman Forever (1995), played by Val Kilmer\n",
        "47zcqedjfrerpgasyogbpwjsvu - from adam west to robert pattinson: this is how batman has changed over the years\n",
        "This movie strayed away from the aesthetic of Tim Burton’s Batman, making it more colorful and over-the-top, especially with Jim Carey’s Ridley and Tommy Lee Jones’s Two-Face.\n",
        "\n",
        "It received mixed reviews from critics, but was a box office success, becoming the 6th highest-grossing film worldwide in 1995. Nevertheless, this movie tends to be ignored currently, with many fans not even remembering that Val Kilmer was Batman.\n",
        "\n",
        "Batman & Robin (1997), played by George Clooney\n",
        "3bulsal75ncwzny3xvd2nz33le - from adam west to robert pattinson: this is how batman has changed over the years\n",
        "This film is regarded as the worst Batman movie and even getting spots as one of the worst movies ever made.\n",
        "\n",
        "\n",
        "It has become infamous because of the neon design, the Batnipples, and just being a franchise-killing movie (after being considered a box office disappointment, Warner Bros. decided to cancel future Batman films, like Schumacher’s -the director of this movie and Batman Forever- Batman Unchained).\n",
        "\n",
        "It’s not even considered by fans “so bad it’s good”, and it’s almost always skipped in rewatches of the films.\n",
        "\n",
        "Batman Begins (2005), played by Christian Bale\n",
        "Doggryf3mbfklnwfyzr2t7vyoi - from adam west to robert pattinson: this is how batman has changed over the years\n",
        "The most iconic Batman for the modern audience. Christopher Nolan’s work makes it one of the best superhero movies of all time.\n",
        "\n",
        "It rebooted the Batman film series, giving it a darker and more realistic tone compared to previous films (especially Schumacher’s job). The film wanted to create an emotional connection with the audience and the Batman and Bruce Wayne identities.\n",
        "\n",
        "The film became the 9th highest-grossing film of 2005 and was followed by The Dark Knight (2008), and The Dark Knight Rises (2012). Creating The Dark Knight Trilogy, and the reason many DC fans say that DC movies are better than Marvel Films.\n",
        "\n",
        "Batman v Superman: Dawn of Justice (2016), played by Ben Affleck\n",
        "R6tzxansdngnra5ee5izdeocva - from adam west to robert pattinson: this is how batman has changed over the years\n",
        "Affleck is the only actor (so far) to not get his solo movie, and the possibilities of it happening are uncertain, maybe even impossible.\n",
        "\n",
        "Nevertheless, his role is different from the other Batmans, with him being older and jaded because of all the deaths and destruction he has seen but being hopeful in humanity among the member of the Justice League.\n",
        "\n",
        "He feels like Batman and Bruce are the same guys, and it really is a shame we couldn’t spend more time with him.\n",
        "\n",
        "Gotham (2014-2019), played by David Mazouz\n",
        "Qf7qau37anf75nknc5wwobmnkm - from adam west to robert pattinson: this is how batman has changed over the years\n",
        "Wait, who? Well… yeah.\n",
        "\n",
        "The show started following James Gordon in his early days at the Gotham City Police Department following the tragic deaths of Bruce’s parents and started telling the origin stories of some of the most infamous Batman villains.\n",
        "\n",
        "During the fourth season, Bruce Wayne starts to fight crime as a masked vigilante, and in the fifth (and final) season it shows Bruce becoming Batman for the first time.\n",
        "\n",
        "\n",
        "While not the most popular version of Batman (I didn’t even know the show had Batman in it until doing research for this article), it promises to give a good origin story, and a side of the character we haven’t seen before.\n",
        "\n",
        "The Batman (2022), played by Robert Pattinson\n",
        "Wu23mtvdhzbspep3rpmkrwm3fm - from adam west to robert pattinson: this is how batman has changed over the years\n",
        "This film, directed by Matt Reeves, is considered a reboot of the Batman film franchise (after the studio didn’t know what to do with Ben Affleck’s version).\n",
        "\n",
        "You might find interesting: Robert Pattinson’s must watch films from ‘Twilight’ to ‘The Batman’\n",
        "\n",
        "It tells the story of a young Batman, who has only been fighting crime for two years and is uncovering corruption while pursuing the Riddler, a serial killer who targets Gotham’s elite.\n",
        "\n",
        "Perhaps you have already seen it, or perhaps you’re like me and haven’t been able to find the time. Either way, the memes for this movie and the use of Nirvana’s Something in the Way have been incredible.\n",
        "\"\"\"\n",
        "\n",
        "chunks = chunk_text(text, window_size=4, stride=1)\n",
        "print(len(chunks))\n",
        "chunks"
      ]
    },
    {
      "cell_type": "code",
      "execution_count": 7,
      "metadata": {
        "colab": {
          "base_uri": "https://localhost:8080/"
        },
        "id": "QT_RAwdxIUHl",
        "outputId": "eb41ce9f-2ffc-4953-b79e-a60024c94fca"
      },
      "outputs": [
        {
          "name": "stdout",
          "output_type": "stream",
          "text": [
            "(10, 1536)\n",
            "Search results:\n",
            "('The film wanted to create an emotional connection with the audience and the Batman and Bruce Wayne identities.\\n\\nThe film became the 9th highest-grossing film of 2005 and was followed by The Dark Knight (2008), and The Dark Knight Rises (2012). Creating The Dark Knight Trilogy, and the reason many DC fans say that DC movies are better than Marvel Films.\\n\\nBatman v Superman: Dawn of Justice (2016), played by Ben Affleck\\nR6tzxansdngnra5ee5izdeocva - from adam west to robert pattinson: this is how batman has changed over the years\\nAffleck is the only actor (so far) to not get his solo movie, and the possibilities of it happening are uncertain, maybe even impossible.\\n\\nNevertheless, his role is different from the other Batmans, with him being older and jaded because of all the deaths and destruction he has seen but being hopeful in humanity among the member of the Justice League.\\n\\nHe feels like Batman and Bruce are the same guys, and it really is a shame we couldn’t spend more time with him.\\n\\nGotham (2014-2019), played by David Mazouz\\nQf7qau37anf75nknc5wwobmnkm - from adam west to robert pattinson: this is how batman has changed over the years\\nWait, who? Well… yeah.\\n\\nThe show started following James Gordon in his early days at the Gotham City Police Department following the tragic deaths of Bruce’s parents and started telling the origin stories of some of the most infamous Batman villains.\\n\\nDuring the fourth season, Bruce Wayne starts to fight crime as a masked vigilante, and in the fifth (and final) season it shows Bruce becoming Batman for the first time.\\n\\n\\nWhile not the most popular version of Batman (I didn’t even know the show had Batman in it until doing research for this article), it promises to give a good origin story, and a side of the character we haven’t seen before.\\n\\nThe Batman (2022), played by Robert Pattinson\\nWu23mtvdhzbspep3rpmkrwm3fm - from adam west to robert pattinson: this is how batman has changed over the years\\nThis film, directed by Matt Reeves, is considered a reboot of the Batman film franchise (after the studio didn’t know what to do with Ben Affleck’s version).\\n\\nYou might find interesting: Robert Pattinson’s must watch films from ‘Twilight’ to ‘The Batman’\\n\\nIt tells the story of a young Batman, who has only been fighting crime for two years and is uncovering corruption while pursuing the Riddler, a serial killer who targets Gotham’s elite.\\n\\nPerhaps you have already seen it, or perhaps you’re like me and haven’t been able to find the time. Either way, the memes for this movie and the use of Nirvana’s Something in the Way have been incredible.', 1.2458552122116089)\n",
            "('Christopher Nolan’s work makes it one of the best superhero movies of all time.\\n\\nIt rebooted the Batman film series, giving it a darker and more realistic tone compared to previous films (especially Schumacher’s job). The film wanted to create an emotional connection with the audience and the Batman and Bruce Wayne identities.\\n\\nThe film became the 9th highest-grossing film of 2005 and was followed by The Dark Knight (2008), and The Dark Knight Rises (2012). Creating The Dark Knight Trilogy, and the reason many DC fans say that DC movies are better than Marvel Films.\\n\\nBatman v Superman: Dawn of Justice (2016), played by Ben Affleck\\nR6tzxansdngnra5ee5izdeocva - from adam west to robert pattinson: this is how batman has changed over the years\\nAffleck is the only actor (so far) to not get his solo movie, and the possibilities of it happening are uncertain, maybe even impossible.\\n\\nNevertheless, his role is different from the other Batmans, with him being older and jaded because of all the deaths and destruction he has seen but being hopeful in humanity among the member of the Justice League.\\n\\nHe feels like Batman and Bruce are the same guys, and it really is a shame we couldn’t spend more time with him.\\n\\nGotham (2014-2019), played by David Mazouz\\nQf7qau37anf75nknc5wwobmnkm - from adam west to robert pattinson: this is how batman has changed over the years\\nWait, who? Well… yeah.\\n\\nThe show started following James Gordon in his early days at the Gotham City Police Department following the tragic deaths of Bruce’s parents and started telling the origin stories of some of the most infamous Batman villains.\\n\\nDuring the fourth season, Bruce Wayne starts to fight crime as a masked vigilante, and in the fifth (and final) season it shows Bruce becoming Batman for the first time.\\n\\n\\nWhile not the most popular version of Batman (I didn’t even know the show had Batman in it until doing research for this article), it promises to give a good origin story, and a side of the character we haven’t seen before.\\n\\nThe Batman (2022), played by Robert Pattinson\\nWu23mtvdhzbspep3rpmkrwm3fm - from adam west to robert pattinson: this is how batman has changed over the years\\nThis film, directed by Matt Reeves, is considered a reboot of the Batman film franchise (after the studio didn’t know what to do with Ben Affleck’s version).\\n\\nYou might find interesting: Robert Pattinson’s must watch films from ‘Twilight’ to ‘The Batman’\\n\\nIt tells the story of a young Batman, who has only been fighting crime for two years and is uncovering corruption while pursuing the Riddler, a serial killer who targets Gotham’s elite.\\n\\nPerhaps you have already seen it, or perhaps you’re like me and haven’t been able to find the time.', 1.271134853363037)\n",
            "('With references appearing in media that is not related to the character, like the movie Ready Player One, and shows like The Simpsons, SpongeBob SquarePants, and The Fairly OddParents.\\n\\nWhile it might not be considered the best version of Batman, it’s the Batman that opened the doors to what we have now.\\n\\nBatman (1989), played by Michael Keaton\\n6aheuzaikfealdjwgzy6366xt4 - from adam west to robert pattinson: this is how batman has changed over the years\\nThis was a groundbreaking movie directed by Tim Burton, and starring Jack Nicholson, Michael Keaton, Kim Basinger, Robert Wuhl, Pat Hingle, Billy Dee Williams, Michael Gough, and Jack Palance.\\n\\nThe movie was successful critically and financially, making it the 5th highest-grossing film in history (at the time of its release).\\n\\nIt inspired Batman: The Animated Series (1992-1995), paving the way for the DC Animated Universe. The film has also influenced Hollywood’s modern marketing and development techniques of the superhero film genre.\\n\\nIt created the “Batmania” pop-culture phenomenon and made Batman cool again.\\n\\nBatman Forever (1995), played by Val Kilmer\\n47zcqedjfrerpgasyogbpwjsvu - from adam west to robert pattinson: this is how batman has changed over the years\\nThis movie strayed away from the aesthetic of Tim Burton’s Batman, making it more colorful and over-the-top, especially with Jim Carey’s Ridley and Tommy Lee Jones’s Two-Face.\\n\\nIt received mixed reviews from critics, but was a box office success, becoming the 6th highest-grossing film worldwide in 1995. Nevertheless, this movie tends to be ignored currently, with many fans not even remembering that Val Kilmer was Batman.\\n\\nBatman & Robin (1997), played by George Clooney\\n3bulsal75ncwzny3xvd2nz33le - from adam west to robert pattinson: this is how batman has changed over the years\\nThis film is regarded as the worst Batman movie and even getting spots as one of the worst movies ever made.\\n\\n\\nIt has become infamous because of the neon design, the Batnipples, and just being a franchise-killing movie (after being considered a box office disappointment, Warner Bros. decided to cancel future Batman films, like Schumacher’s -the director of this movie and Batman Forever- Batman Unchained).\\n\\nIt’s not even considered by fans “so bad it’s good”, and it’s almost always skipped in rewatches of the films.\\n\\nBatman Begins (2005), played by Christian Bale\\nDoggryf3mbfklnwfyzr2t7vyoi - from adam west to robert pattinson: this is how batman has changed over the years\\nThe most iconic Batman for the modern audience.', 1.306239128112793)\n"
          ]
        }
      ],
      "source": [
        "import numpy as np\n",
        "import faiss\n",
        "\n",
        "# Get vector embeddings for the chunks\n",
        "vectors = np.array([get_vector_embeddings(chunk) for chunk in chunks])\n",
        "print(vectors.shape)\n",
        "\n",
        "# Create a FAISS index\n",
        "index = faiss.IndexFlatL2(vectors.shape[1])\n",
        "index.add(vectors)\n",
        "\n",
        "# Function to perform a vector search\n",
        "def vector_search(query_text, k=3):\n",
        "    query_vector = get_vector_embeddings(query_text)\n",
        "    distances, indices = index.search(np.array([query_vector]), k)\n",
        "    return [(chunks[i], float(dist)) for dist, i in zip(distances[0], indices[0])]\n",
        "\n",
        "\n",
        "# Example search\n",
        "search_results = vector_search(\"robert pattinson\")\n",
        "print(\"Search results:\")\n",
        "for result in search_results:\n",
        "    print(result)\n"
      ]
    },
    {
      "cell_type": "code",
      "execution_count": 9,
      "metadata": {
        "colab": {
          "base_uri": "https://localhost:8080/"
        },
        "id": "kz7vk-fTIZgD",
        "outputId": "80062618-ef7f-4be8-b87e-adc3478b6def"
      },
      "outputs": [
        {
          "name": "stdout",
          "output_type": "stream",
          "text": [
            "Search results: [('The film wanted to create an emotional connection with the audience and the Batman and Bruce Wayne identities.\\n\\nThe film became the 9th highest-grossing film of 2005 and was followed by The Dark Knight (2008), and The Dark Knight Rises (2012). Creating The Dark Knight Trilogy, and the reason many DC fans say that DC movies are better than Marvel Films.\\n\\nBatman v Superman: Dawn of Justice (2016), played by Ben Affleck\\nR6tzxansdngnra5ee5izdeocva - from adam west to robert pattinson: this is how batman has changed over the years\\nAffleck is the only actor (so far) to not get his solo movie, and the possibilities of it happening are uncertain, maybe even impossible.\\n\\nNevertheless, his role is different from the other Batmans, with him being older and jaded because of all the deaths and destruction he has seen but being hopeful in humanity among the member of the Justice League.\\n\\nHe feels like Batman and Bruce are the same guys, and it really is a shame we couldn’t spend more time with him.\\n\\nGotham (2014-2019), played by David Mazouz\\nQf7qau37anf75nknc5wwobmnkm - from adam west to robert pattinson: this is how batman has changed over the years\\nWait, who? Well… yeah.\\n\\nThe show started following James Gordon in his early days at the Gotham City Police Department following the tragic deaths of Bruce’s parents and started telling the origin stories of some of the most infamous Batman villains.\\n\\nDuring the fourth season, Bruce Wayne starts to fight crime as a masked vigilante, and in the fifth (and final) season it shows Bruce becoming Batman for the first time.\\n\\n\\nWhile not the most popular version of Batman (I didn’t even know the show had Batman in it until doing research for this article), it promises to give a good origin story, and a side of the character we haven’t seen before.\\n\\nThe Batman (2022), played by Robert Pattinson\\nWu23mtvdhzbspep3rpmkrwm3fm - from adam west to robert pattinson: this is how batman has changed over the years\\nThis film, directed by Matt Reeves, is considered a reboot of the Batman film franchise (after the studio didn’t know what to do with Ben Affleck’s version).\\n\\nYou might find interesting: Robert Pattinson’s must watch films from ‘Twilight’ to ‘The Batman’\\n\\nIt tells the story of a young Batman, who has only been fighting crime for two years and is uncovering corruption while pursuing the Riddler, a serial killer who targets Gotham’s elite.\\n\\nPerhaps you have already seen it, or perhaps you’re like me and haven’t been able to find the time. Either way, the memes for this movie and the use of Nirvana’s Something in the Way have been incredible.', 0.912223756313324), ('From Adam West to Robert Pattinson: this is how Batman has changed over the years\\nBatman is one of the most recognizable superheroes in pop culture, starting with his first appearance in Detective Comics #27 in 1939. He has been listed as one of the most iconic characters in popular culture, and among the greatest comic book superheroes and fictional characters ever created. While Batman is sometimes paired with Superman,\\n\\nIsabel Cara\\n\\n\\n\\n\\n\\n00:08 / 00:20\\nBatman is one of the most recognizable superheroes in pop culture, starting with his first appearance in Detective Comics #27 in 1939. He has been listed as one of the most iconic characters in popular culture, and among the greatest comic book superheroes and fictional characters ever created.\\n\\nWhile Batman is sometimes paired with Superman, Wonder Woman, and others from the Justice League, his stories have so much potential that they have been made into movies, tv shows, videogames, toy lines, radio, even musical theatre.\\n\\nYou might find interesting: ‘The Batman’: Villains who would be exceptional candidates for the sequel\\n\\nADVERTISING\\n\\nSo, let’s talk about how Batman, in his live-action version, has changed through the years:\\n\\nThe Batman series (1966-1968), played by Adam West\\nV2qn2wliqvchxfxv6w56zqm6se - from adam west to robert pattinson: this is how batman has changed over the years\\nThis tv show (and a movie in 1966) portrays the character in a camp aesthetic, meaning that it could be appealing because of its bad taste and ironic value (like those “so bad it’s good” movies), but they camp things can also be described as “cheesy”.\\n\\nThis aesthetic was associated with Batman for years after the show ended, and comic creators worked hard to return the character to his darker roots in the decades that followed, culminating in The Dark Knight Returns (1986) by Frank Miller.\\n\\n\\nNevertheless, this Batman holds a special place in every fan because references to this show have appeared in almost every Batman movie made after.', 0.9525737762451172), ('Christopher Nolan’s work makes it one of the best superhero movies of all time.\\n\\nIt rebooted the Batman film series, giving it a darker and more realistic tone compared to previous films (especially Schumacher’s job). The film wanted to create an emotional connection with the audience and the Batman and Bruce Wayne identities.\\n\\nThe film became the 9th highest-grossing film of 2005 and was followed by The Dark Knight (2008), and The Dark Knight Rises (2012). Creating The Dark Knight Trilogy, and the reason many DC fans say that DC movies are better than Marvel Films.\\n\\nBatman v Superman: Dawn of Justice (2016), played by Ben Affleck\\nR6tzxansdngnra5ee5izdeocva - from adam west to robert pattinson: this is how batman has changed over the years\\nAffleck is the only actor (so far) to not get his solo movie, and the possibilities of it happening are uncertain, maybe even impossible.\\n\\nNevertheless, his role is different from the other Batmans, with him being older and jaded because of all the deaths and destruction he has seen but being hopeful in humanity among the member of the Justice League.\\n\\nHe feels like Batman and Bruce are the same guys, and it really is a shame we couldn’t spend more time with him.\\n\\nGotham (2014-2019), played by David Mazouz\\nQf7qau37anf75nknc5wwobmnkm - from adam west to robert pattinson: this is how batman has changed over the years\\nWait, who? Well… yeah.\\n\\nThe show started following James Gordon in his early days at the Gotham City Police Department following the tragic deaths of Bruce’s parents and started telling the origin stories of some of the most infamous Batman villains.\\n\\nDuring the fourth season, Bruce Wayne starts to fight crime as a masked vigilante, and in the fifth (and final) season it shows Bruce becoming Batman for the first time.\\n\\n\\nWhile not the most popular version of Batman (I didn’t even know the show had Batman in it until doing research for this article), it promises to give a good origin story, and a side of the character we haven’t seen before.\\n\\nThe Batman (2022), played by Robert Pattinson\\nWu23mtvdhzbspep3rpmkrwm3fm - from adam west to robert pattinson: this is how batman has changed over the years\\nThis film, directed by Matt Reeves, is considered a reboot of the Batman film franchise (after the studio didn’t know what to do with Ben Affleck’s version).\\n\\nYou might find interesting: Robert Pattinson’s must watch films from ‘Twilight’ to ‘The Batman’\\n\\nIt tells the story of a young Batman, who has only been fighting crime for two years and is uncovering corruption while pursuing the Riddler, a serial killer who targets Gotham’s elite.\\n\\nPerhaps you have already seen it, or perhaps you’re like me and haven’t been able to find the time.', 0.9679346084594727)]\n",
            "\n",
            "\n",
            "Response: The song associated with Robert Pattinson's Batman is Nirvana’s \"Something in the Way.\"\n"
          ]
        }
      ],
      "source": [
        "# Function to perform a vector search and then ask the LLM a question\n",
        "def search_and_chat(chat_prompt, k=3):\n",
        "  # Perform the vector search\n",
        "  search_results = vector_search(chat_prompt, k)\n",
        "  print(f\"Search results: {search_results}\\n\\n\")\n",
        "\n",
        "  prompt_with_context = f\"\"\"Context:{search_results}\\\n",
        "  Answer the question: {chat_prompt}\"\"\"\n",
        "\n",
        "  # Create a list of messages for the chat\n",
        "  messages = [\n",
        "      {\"role\": \"system\", \"content\": \"Please answer the questions provided by the user. Use only the context provided to you, if you don't know the answer say \\\"I don't know\\\".\"},\n",
        "      {\"role\": \"user\", \"content\": prompt_with_context},\n",
        "  ]\n",
        "\n",
        "  # Get the model's response\n",
        "  response = client.chat.completions.create(\n",
        "    model=MODEL,\n",
        "    messages=messages\n",
        "  )\n",
        "\n",
        "  # Print the assistant's reply\n",
        "  print(f\"Response: {response.choices[0].message.content}\")\n",
        "\n",
        "# Example search and chat\n",
        "search_and_chat(\"What song is associated with Robert Pattinson's Batman?\")"
      ]
    }
  ],
  "metadata": {
    "colab": {
      "provenance": []
    },
    "kernelspec": {
      "display_name": "Python 3",
      "name": "python3"
    },
    "language_info": {
      "codemirror_mode": {
        "name": "ipython",
        "version": 3
      },
      "file_extension": ".py",
      "mimetype": "text/x-python",
      "name": "python",
      "nbconvert_exporter": "python",
      "pygments_lexer": "ipython3",
      "version": "3.11.2"
    }
  },
  "nbformat": 4,
  "nbformat_minor": 0
}
