Articles / How to create a movie recommendation engine using vector embeddings

Have you ever wondered how Netflix recommends TV shows and movies to watch? In this article, we're building a simple movie recommendation engine using vector embeddings.

Before we get our hands dirty writing code, what is a vector embedding and how does it work?

A vector embedding is a way of turning text or images into numerical values that act like an address in vector space. Similar things will be situated closer together and conversely less similar things will be situated further apart. And you will be able to query a vector database to return things based on that distance or likeness.

Okay, but what does it look like? Good question! Here's a vector embedding for the term "Romantic Comedy" using the "sentence-transformers/all-mpnet-base-v2" model and tokenizer from Huggingface:

[0.036442261189222336, 0.02655629627406597, 0.013741680420935154, -0.010808208957314491, 0.027987521141767502, 0.005814218893647194, -0.00976635329425335, 0.01607823185622692, 0.0017858031205832958, -0.0008231966057792306, 0.010687906295061111, -0.04777323454618454, 0.04025690257549286, 0.0768614336848259, -0.02202274650335312, -0.04268135502934456, -0.02581307850778103, 0.018305404111742973, 0.05087489262223244, -0.016269689425826073, -0.023038536310195923, -0.007935864850878716, 0.0023359425831586123, -0.005187167786061764, 0.01640891842544079, -0.03727433830499649, 0.008869176730513573, 0.026541993021965027, -0.0017149897757917643, 0.01765603758394718, 0.02395944483578205, -0.03587237372994423, -0.022312311455607414, 0.00887275766581297, 0.0000012758009688695893, -0.015373067930340767, 0.03440364450216293, -0.047551997005939484, 0.11466264724731445, -0.011087917722761631, -0.0165400430560112, 0.04325706511735916, -0.010081888176500797, -0.022641915827989578, 0.02299981750547886, 0.03637479245662689, 0.05055293068289757, -0.03223613277077675, 0.022519465535879135, 0.03476804122328758, 0.0012972408439964056, -0.030978025868535042, -0.040615592151880264, -0.05284408852458, -0.005752329248934984, 0.051850926131010056, -0.027547255158424377, -0.037076570093631744, 0.08352896571159363, 0.011106874793767929, -0.052806224673986435, -0.07941300421953201, -0.03344769403338432, -0.014679569751024246, 0.0320337750017643, 0.025552280247211456, -0.012655438855290413, 0.00043438374996185303, -0.04809384420514107, 0.026028737425804138, -0.024475909769535065, 0.03246675804257393, 0.011168668046593666, 0.07562322914600372, 0.021264754235744476, 0.0016600117087364197, -0.04164424538612366, 0.04922313243150711, -0.04137784242630005, -0.05012371391057968, 0.009408061392605305, 0.04182564467191696, 0.02165541611611843, 0.0694936066865921, 0.07993876934051514, -0.06204816326498985, 0.02772337943315506, 0.009942106902599335, 0.002339373342692852, -0.06383546441793442, 0.045478980988264084, -0.0030416001100093126, 0.03807401657104492, 0.04690585657954216, 0.08653368055820465, -0.027752768248319626, 0.0025883775670081377, 0.0560770146548748, -0.01705191098153591, -0.01622062362730503, 0.005502558778971434, 0.04725618660449982, -0.01660560816526413, 0.041198745369911194, 0.007223816588521004, 0.005394263658672571, 0.001577009679749608, -0.0338425487279892, 0.01113034412264824, 0.04539921134710312, 0.015317101962864399, -0.014780079945921898, 0.015996744856238365, 0.027844978496432304, 0.016256241127848625, -0.01828937791287899, 0.02954699471592903, 0.01880159042775631, 0.004976124502718449, 0.04095298796892166, 0.034249965101480484, -0.01992780715227127, -0.011226425878703594, 0.04122808948159218, -0.02642294391989708, 0.08752548694610596, -0.04130876809358597, -0.05043967440724373, 0.006151358596980572, -0.018828900530934334, -0.009433073922991753, -0.012010429985821247, 0.04172997549176216, 0.002654625568538904, 0.025526033714413643, 0.01642337068915367, -0.009871143847703934, -0.016767434775829315, -0.025098789483308792, -0.018052874132990837, -0.011182906106114388, -0.04452891647815704, -0.04480859637260437, -0.030415376648306847, 0.06294620037078857, -0.02030598744750023, -0.023343434557318687, -0.04669056832790375, 0.026159053668379784, -0.06507673859596252, 0.026234647259116173, -0.0023599122650921345, 0.028317036107182503, 0.02660701423883438, 0.015522351488471031, -0.0014362202491611242, -0.017258165404200554, -0.0036139667499810457, -0.01016274094581604, 0.006192976143211126, 0.002370598027482629, 0.02960623800754547, 0.03565876558423042, -0.014893927611410618, -0.019479744136333466, 0.03909391164779663, -0.04352724924683571, 0.01584969088435173, 0.005630140192806721, 0.04336985573172569, -0.007227471098303795, 0.03016243316233158, 0.015517896972596645, -0.035158880054950714, 0.0037805845495313406, 0.01972872205078602, 0.051866039633750916, 0.10091818124055862, 0.029068484902381897, 0.05831333249807358, -0.046836968511343, -0.042132336646318436, -0.0061485799960792065, 0.004305573180317879, -0.062478676438331604, -0.023208914324641228, -0.040933530777692795, -0.0037391297519207, -0.0034995281603187323, -0.015654083341360092, 0.032524224370718, 0.005359598435461521, -0.024141013622283936, -0.015238290652632713, 0.05377219617366791, 0.0023902759421616793, 0.02945009618997574, -0.025077901780605316, 0.025062892585992813, -0.007043348625302315, 0.019717790186405182, 0.02731393463909626, 0.04230453819036484, 0.044402386993169785, -0.06784199923276901, -0.00836195982992649, 0.008735429495573044, -0.017817452549934387, -0.005023421254009008, -0.04604455456137657, 0.02730061672627926, 0.0178334079682827, 0.08340073376893997, -0.0022204904817044735, 0.04619254171848297, 0.06135854870080948, 0.01061022374778986, 0.060289204120635986, -0.10210628807544708, 0.01239880919456482, -0.03743722289800644, 0.06573405116796494, -0.0052588386461138725, -0.009053938090801239, -0.04115620255470276, 0.029552625492215157, -0.025584444403648376, -0.006112127099186182, 0.027015548199415207, 0.040910013020038605, 0.021116070449352264, 0.0759691447019577, 0.05620269849896431, 0.014339140616357327, 0.0396452471613884, 0.07718710601329803, 0.07242144644260406, -0.011295396834611893, -0.024822022765874863, -0.05521741136908531, -0.0022290300112217665, -0.06379363685846329, -0.05335681512951851, 0.027730373665690422, 0.06323641538619995, -0.017820186913013458, -0.06243201345205307, 0.005904465913772583, -0.034585122019052505, 0.030873315408825874, -0.006252700928598642, 0.019786454737186432, -0.006433434318751097, -0.05801762640476227, 0.06902404129505157, -0.08868513256311417, 0.004102824721485376, 0.016838274896144867, -0.02433680184185505, -0.023859556764364243, 0.04834217205643654, -0.025989359244704247, 0.013924316503107548, 0.02728329226374626, 0.03378007933497429, 0.022457540035247803, -0.057258885353803635, -0.024344246834516525, -0.0067857434041798115, 0.016666054725646973, -0.002398313255980611, 0.020964261144399643, 0.018529728055000305, -0.018407534807920456, -0.05756703391671181, -0.007197727914899588, -0.02382631041109562, 0.005450543947517872, -0.07117640972137451, -0.003041803138330579, 0.06749776750802994, -0.00442195450887084, 0.029192304238677025, -0.003215531352907419, -0.013631720095872879, 0.004616143647581339, -0.009999834932386875, 0.04323996230959892, -0.014740295708179474, -0.04227197915315628, 0.01554639358073473, -0.022866053506731987, 0.004350776318460703, 0.012049049139022827, -0.008467935025691986, -0.015221935696899891, -0.06715168058872223, -0.0025599910877645016, -0.041035547852516174, -0.025062430649995804, 0.016688931733369827, 0.0177183598279953, 0.03375096246600151, -0.0055749122984707355, 0.04550996422767639, -0.03340144827961922, -0.009782850742340088, -0.029299352318048477, -0.053091078996658325, 0.027500450611114502, -0.06049226596951485, 0.040134284645318985, -0.00479472940787673, -0.003508626716211438, 0.017084967344999313, -0.008419947698712349, 0.038100358098745346, -0.011430184356868267, 0.017807725816965103, 0.04387327656149864, 0.010885646566748619, 0.014501159079372883, 0.056548237800598145, -0.019783509895205498, -0.012759664095938206, -0.01686694659292698, -0.008998967707157135, 0.000904784828890115, 0.013353443704545498, 0.004634046461433172, -0.010919797234237194, -0.056579913944005966, 0.039914585649967194, -0.04736517369747162, -0.059691574424505234, -0.02596028335392475, -0.01137872226536274, 0.07069887220859528, -0.03891529515385628, -0.011662570759654045, 0.022065334022045135, 0.036963097751140594, 0.029277583584189415, -0.01895724982023239, -0.06035372614860535, -0.04761434718966484, -0.04191035404801369, -0.008787835948169231, 0.008224541321396828, 0.04212070256471634, -0.08792801946401596, 0.02863250859081745, -0.004730670712888241, -0.03829953446984291, -0.012906135059893131, -0.009577712044119835, 0.01513784471899271, 0.01650158129632473, -0.0733923390507698, 0.010042119771242142, 0.024481220170855522, 0.020082658156752586, -0.0430707223713398, -0.01219018641859293, -0.005095611792057753, -0.040703993290662766, -0.025767210870981216, 0.009133548475801945, 0.0497535802423954, -0.01984918676316738, -0.08622321486473083, -0.034677065908908844, -0.05413319543004036, -0.001110997749492526, -0.012752948328852654, -0.025374796241521835, -0.03456847369670868, -0.03557528927922249, 0.0643051266670227, 0.0017320350743830204, 0.04818833991885185, -0.015767429023981094, 0.003207992995157838, 0.05655444413423538, -0.0052208853885531425, -0.012159773148596287, -0.055137619376182556, -0.05379100516438484, -0.01326168142259121, -0.034908369183540344, 0.06270615011453629, 0.020989224314689636, 0.022078311070799828, 0.010804490186274052, -0.032961226999759674, -0.025416309013962746, 0.004611814860254526, 0.01867855153977871, -0.0433075949549675, -0.03585492819547653, -0.029539991170167923, 0.07935035228729248, -0.014281211420893669, 0.08146923035383224, -0.0008647249196656048, -0.01497690286487341, -0.04908157140016556, 0.06075415387749672, -0.05780548229813576, 0.0001076741173164919, -0.02126968465745449, 0.05498533323407173, 0.005291635170578957, -0.015115013346076012, -0.024249864742159843, -0.04462413117289543, 0.005577852483838797, 0.007891625165939331, -0.004045205190777779, 0.035866979509592056, 0.009669470600783825, 0.04886017367243767, 0.013580359518527985, -0.03711031377315521, 0.018993040546774864, 0.005716409534215927, 0.039096299558877945, 0.014907588250935078, 0.02058475837111473, -0.03550107032060623, -0.02930528111755848, 0.0025574080646038055, -0.055506885051727295, -0.0019313779193907976, -0.03639949485659599, -0.056346211582422256, 0.01761394366621971, 0.06897637248039246, -0.008188455365598202, 0.02798455022275448, -0.01901460438966751, 0.004901091102510691, -0.0008241310133598745, -0.01971292495727539, -0.10134980827569962, -0.052069250494241714, -0.0012076310813426971, 0.01717057265341282, -0.006797209847718477, 0.07302635163068771, 0.030692698433995247, -0.05923525243997574, 0.01671445742249489, -0.07181250303983688, 0.010602074675261974, 0.006813281215727329, -0.03382008522748947, -0.003589964471757412, -0.016842689365148544, 0.021753085777163506, 0.06050438433885574, 0.024321233853697777, 0.006577846594154835, 0.0018908135825768113, 0.01056694146245718, -0.03095320612192154, -0.04326711222529411, 0.008641883730888367, 0.023793751373887062, -0.03773089870810509, 0.00871211290359497, -0.08985920995473862, -0.006071236915886402, -0.029821887612342834, -0.011647474020719528, -0.04842982813715935, -0.0036187516525387764, -0.025109916925430298, 0.0716521143913269, -0.011561574414372444, 0.010259953327476978, -0.005068229511380196, 0.006844064220786095, 0.06913137435913086, 0.019225062802433968, -0.06642559915781021, -0.01912241242825985, 0.019556250423192978, 0.0009052295354194939, -0.00790318287909031, -0.006408794317394495, 0.05346110090613365, 0.003572933143004775, -0.038973771035671234, -0.0023751757107675076, -0.07326299697160721, -0.061593685299158096, -0.08194863796234131, 0.07069262862205505, -0.05710121989250183, -0.008312243036925793, 0.0012649294221773744, -0.051121119409799576, 0.03543509542942047, -0.018389146775007248, 0.012749890796840191, -0.02776392549276352, 0.006053495686501265, 0.016450854018330574, -0.028144195675849915, -0.006734740454703569, 0.009014000184834003, 0.0041561066173017025, -0.06384996324777603, 0.03446439281105995, -0.026861567050218582, -0.015408436767756939, -0.09194016456604004, -0.022598201408982277, -0.003941816743463278, 0.009358498267829418, -0.054536446928977966, -0.020056940615177155, -0.005524057429283857, -0.05568678304553032, 0.019644860178232193, 0.029906507581472397, -0.010980012826621532, 0.06873441487550735, -0.0044633569195866585, -0.07387206703424454, 0.020966215059161186, 0.06793926656246185, -0.02387216128408909, -0.01707524247467518, 0.10433664172887802, -0.027154164388775826, -0.031247897073626518, -0.0060743666253983974, -0.006666278000921011, -0.0467715822160244, 0.01845000870525837, 0.038637883961200714, -0.05084261670708656, 0.016837267205119133, -0.02798326686024666, -0.0230838842689991, -0.029391299933195114, 0.020301738753914833, 0.044969215989112854, -0.06567791104316711, -0.007767520844936371, 0.010340150445699692, -0.013116184622049332, -0.023749159649014473, -5.671781548552646e-33, 0.016275033354759216, -0.038991257548332214, -0.05329058691859245, 0.030146153643727303, -0.013704849407076836, -0.035520173609256744, 0.006566604599356651, 0.002624393440783024, -0.01407796423882246, 0.016513682901859283, -0.005487653426826, 0.03833753243088722, 0.003613256849348545, 0.024424895644187927, -0.017141267657279968, 0.016573742032051086, -0.05237230286002159, 0.028942489996552467, 0.016879063099622726, -0.0005321849603205919, 0.05423947051167488, 0.08321350067853928, 0.007581222336739302, -0.008428607136011124, -0.06498314440250397, 0.04578240215778351, -0.017754191532731056, 0.02058424986898899, 0.03437700867652893, -0.0023536821827292442, 0.021321816369891167, 0.030985303223133087, -0.017204415053129196, 0.08602350950241089, 0.0040992810390889645, 0.012823125347495079, 0.023902742192149162, -0.02220134623348713, -0.08030024915933609, -0.0234114620834589, -0.02369617111980915, -0.05168331786990166, 0.00936540961265564, -0.02943653054535389, -0.02424382045865059, -0.03510522469878197, -0.005455021746456623, -0.012868931517004967, -0.02697642147541046, -0.012475987896323204, -0.03127024695277214, 0.02960166707634926, -0.005923256743699312, -0.012291928753256798, 0.013051334768533707, -0.04363797977566719, 0.007643621880561113, 0.03167212754487991, -0.01272461749613285, -0.036023061722517014, -0.06811138987541199, 0.04176856577396393, -0.007495424244552851, -0.04576004296541214, -0.02341081015765667, 0.019081316888332367, -0.017345353960990906, -0.007706374395638704, -0.01412633340805769, -0.0070688966661691666, -0.033846404403448105, 0.020393846556544304, 0.049016211181879044, -0.07367093861103058, -0.021592114120721817, -0.033508703112602234, -0.04569440335035324, -0.00046455967822112143, 0.08493953943252563, 0.026543350890278816, 0.022817052900791168, 0.008084030821919441, 0.028325211256742477, 0.011407596990466118, 0.02505071833729744, 0.0006252661114558578, -0.02545485645532608, -0.01588268019258976, -0.07258958369493484, 0.007098490372300148, 0.009527785703539848, -0.013541321270167828, 0.02630527876317501, 0.0014789106789976358, -0.022663505747914314, -0.008129771798849106, -0.006158470641821623, -0.01929202862083912, 0.004618153441697359, 0.02406185306608677, 0.07821197062730789, 0.008685638196766376, 0.012237777933478355, 0.023558611050248146, 0.05758215859532356, 0.003840685123577714, 0.02531849965453148, 0.020242581143975258, -0.04468843340873718, 0.006094788666814566, -0.015955312177538872, -0.03816819190979004, -0.007388485595583916, 0.0029762969352304935, -0.02452908083796501, 0.04162979871034622, 0.019280975684523582, 0.051709070801734924, -0.015208153985440731, 0.040471676737070084, 0.009910243563354015, 0.02651694416999817, 0.0077238730154931545, 0.05446041375398636, -0.04608815535902977, 0.06993360072374344, 0.010626847855746746, -0.08158179372549057, 0.019833879545331, -0.006089823320508003, 0.029195433482527733, -0.022691214457154274, 1.9685677443703753e-7, -0.03518441319465637, -0.03404460847377777, 0.05091012269258499, 0.023791559040546417, -0.0003235799667891115, 0.010606562718749046, 0.006148990243673325, 0.05181954801082611, 0.010936145670711994, -0.02360154502093792, -0.020112965255975723, -0.008088227361440659, 0.015922244638204575, -0.0029291592072695494, 0.03975234925746918, 0.06605211645364761, -0.04559656232595444, -0.04684652388095856, 0.00804166030138731, -0.05859235301613808, -0.012441752478480339, -0.013162302784621716, 0.018991677090525627, 0.0375971719622612, -0.043883949518203735, -0.007914775982499123, 0.02065809816122055, -0.02301965095102787, -0.007249011192470789, 0.014730923809111118, 0.03127685561776161, -0.045743752270936966, 0.012794043868780136, 0.07984641194343567, -0.020579466596245766, -0.025084026157855988, 0.02761147916316986, 0.04950505495071411, -0.08077524602413177, 0.023178037256002426, -0.006653002463281155, 0.021088840439915657, -0.07086198776960373, 0.044037144631147385, 0.008403483778238297, 0.0350993387401104, -0.014075495302677155, 0.03372731804847717, -0.04340163618326187, 0.04438329115509987, 0.03150109574198723, 0.015387041494250298, 0.002278835279867053, 0.10530731827020645, -0.004885054659098387, 0.044072654098272324, 0.08476439118385315, 0.0079899150878191, 0.011035840027034283, 0.02920183166861534, 0.02199658937752247, 0.042186323553323746, 0.04023762792348862, 0.05505729466676712, -0.028492877259850502, -0.0121268006041646, -0.02790105529129505, 1.3349751846840339e-34, 0.0762481614947319, -0.07666628807783127, 0.005924758967012167, -0.02382596768438816, 0.04331130161881447, -0.03121776320040226, 0.032515693455934525, 0.015373753383755684, 0.04532929137349129, 0.007859357632696629, -0.0033762261737138033]]

As you see, it can be very, very long. In fact, this vector embedding uses 768 dimensions. The more dimensions, the more complex and nuanced the data can become.

Okay. This is the plan. We'll create a list of movies - say, the title, the description and rating. We'll create a vector embedding of the description of the movie because it should be detailed enough to help us differentiate one movie from another. And we'll store these vector embeddings in a vector database for querying. Based on a user's preferences, say previous movies watched, we'll create an average of those movie embeddings and then query the database for similar movies. Simple, right?

Okay...let me unpack that a little. The key takeaway is that we can use Maths to reflect the user's movie tastes by creating a mean average vector embedding based on the individual vector embeddings of the movies the user has watched. Crazy, right?

Here is the code creating the average of the embeddings.

const getAverageEmbedding = (embeddings) => {
    if (!embeddings.length) return [];
    const sum = embeddings.reduce((acc, curr) => acc.map((val, idx) => val + curr[idx]), new Array(embeddings[0].length).fill(0));
    return sum.map(val => val / embeddings.length);
}

Here is the schema for the database. It's a slimmed down version for this article. The most important bits are that we're using the vector extension in PostgreSQL and we have an embeddings table with type VECTOR(768) matching the dimension size we need to use.


CREATE
EXTENSION vector;

CREATE TABLE users (
   id SERIAL PRIMARY KEY,
   username VARCHAR(255) NOT NULL,
   email VARCHAR(255) UNIQUE NOT NULL
);

CREATE TABLE products
(
    id SERIAL PRIMARY KEY,
    name VARCHAR(255) NOT NULL,
    description TEXT,
    rating DECIMAL(4,2) NOT NULL
);

CREATE TABLE orders (
    id SERIAL PRIMARY KEY,
    users_id INT,
    CONSTRAINT fk_orders_users FOREIGN KEY (users_id) REFERENCES users (id)
);

CREATE TABLE orders_items (
   id SERIAL PRIMARY KEY,
   orders_id INT,
   products_id INT,
   qty INT,
   CONSTRAINT fk_orders_items_orders FOREIGN KEY (orders_id) REFERENCES orders (id),
   CONSTRAINT fk_orders_items_products FOREIGN KEY (products_id) REFERENCES products (id)
);

CREATE TABLE embeddings
(
    id SERIAL PRIMARY KEY,
    products_id INT,
    description TEXT,
    embedding VECTOR(768),
    CONSTRAINT fk_products_id
        FOREIGN KEY (products_id)
            REFERENCES products (id)
);

Here is the SQL for the movies.

INSERT INTO products (name, description, rating) VALUES ('Inception', 'A mind-bending sci-fi action film about dream-sharing technology.', 4.5);
INSERT INTO products (name, description, rating) VALUES ('The Shawshank Redemption', 'A highly acclaimed drama about hope, redemption, and the power of the human spirit.', 5);
INSERT INTO products (name, description, rating) VALUES ('The Avengers', 'A superhero blockbuster that brings together iconic Marvel characters in an action-packed adventure.', 4.2);
INSERT INTO products (name, description, rating) VALUES ('The Silence of the Lambs', 'A psychological thriller about an FBI agent seeking the help of a serial killer to catch another.', 4.8);
INSERT INTO products (name, description, rating) VALUES ('Interstellar', 'A visually stunning sci-fi film that explores the possibilities of wormhole travel and the search for a new home for humanity.', 4.5);
INSERT INTO products (name, description, rating) VALUES ('Blade Runner', 'A classic sci-fi movie set in a dystopian future where synthetic beings are hunted by special police officers', 4.25);
INSERT INTO products (name, description, rating) VALUES ('The Matrix', 'A groundbreaking film that explores the idea of a simulated reality created by intelligent machines', 4.35);
INSERT INTO products (name, description, rating) VALUES ('Star Wars: Episode IV - A New Hope', 'A space opera that follows a group of rebels as they battle against an evil empire in a galaxy far, far away', 4.30);
INSERT INTO products (name, description, rating) VALUES ('Alien', 'A horror-sci-fi film about a crew of space explorers who are stalked and killed by a deadly extraterrestrial creature', 4.20);
INSERT INTO products (name, description, rating) VALUES ('E.T. the Extra-Terrestrial', 'A heartwarming story about a young boy who befriends an alien stranded on Earth', 4.20);
INSERT INTO products (name, description, rating) VALUES ('Back to the Future', 'A time-travel adventure film that follows a high school student as he travels back in time to the 1950s', 4.35);
INSERT INTO products (name, description, rating) VALUES ('The Terminator', 'A cyborg is sent back in time to kill the future leader of the human resistance, and a soldier is sent to protect her', 4.05);
INSERT INTO products (name, description, rating) VALUES ('Minority Report', 'A futuristic thriller set in a world where crimes can be predicted and prevented by special police officers known as ''Pre-Crime''', 3.95);
INSERT INTO products (name, description, rating) VALUES ('District 9', 'A thought-provoking film that explores the themes of xenophobia and segregation through the lens of an alien invasion', 4.05);
INSERT INTO products (name, description, rating) VALUES ('Arrival', 'A linguist is recruited by the military to communicate with aliens who have landed on Earth, and she must uncover their true intentions', 3.95);
INSERT INTO products (name, description, rating) VALUES ('When Harry Met Sally', 'Two friends try to keep their relationship platonic, but romance gets in the way.', 3.80);
INSERT INTO products (name, description, rating) VALUES ('The Proposal', 'A demanding boss forces her assistant to pretend to be her fiancé, but real feelings develop.', 3.40);
INSERT INTO products (name, description, rating) VALUES ('Crazy, Stupid, Love.', 'A man is recently divorced and learns how to navigate the dating world with the help of a smooth-talking bachelor.', 3.75);
INSERT INTO products (name, description, rating) VALUES ('10 Things I Hate About You', 'A modern retelling of Shakespeare''s The Taming of the Shrew set in a high school, where two students fall in love despite their initial dislike for each other.', 3.65);
INSERT INTO products (name, description, rating) VALUES ('Sleepless in Seattle', 'A widower''s son calls in to a radio talk show in an attempt to find his father a new partner, leading to a cross-country romance.', 3.55);
INSERT INTO products (name, description, rating) VALUES ('Love Actually', 'The interconnected love lives of multiple couples in the weeks leading up to Christmas.', 3.85);
INSERT INTO products (name, description, rating) VALUES ('My Best Friend''s Wedding', 'A woman realizes she is in love with her best friend, just as he is about to get married.', 3.45);
INSERT INTO products (name, description, rating) VALUES ('Notting Hill', 'The romance between a humble bookstore owner and a famous movie star.', 3.55);
INSERT INTO products (name, description, rating) VALUES ('Runaway Bride', 'A woman has a habit of leaving her fiances at the altar, until she meets her match.', 3.10);
INSERT INTO products (name, description, rating) VALUES ('You''ve Got Mail', 'Two business rivals unknowingly fall in love with each other online.', 3.50);
INSERT INTO products (name, description, rating) VALUES ('Saving Private Ryan', 'During WWII, a team of soldiers must find and rescue a paratrooper whose brothers have all been killed in action.', 4.30);
INSERT INTO products (name, description, rating) VALUES ('Platoon', 'A young soldier faces a moral crisis during the Vietnam War, as he is torn between his loyalty to his fellow soldiers and his horror at their brutal actions.', 4.05);
INSERT INTO products (name, description, rating) VALUES ('Full Metal Jacket', 'A group of Marine recruits undergo rigorous training under a demanding drill instructor, before being sent to fight in Vietnam.', 4.15);
INSERT INTO products (name, description, rating) VALUES ('Schindler''s List', 'During WWII, a German businessman saves the lives of thousands of Jews by employing them in his factory, while facing opposition from Nazi officials.', 4.50);
INSERT INTO products (name, description, rating) VALUES ('Apocalypse Now', 'An American officer is sent on a secret mission to assassinate a renegade colonel during the Vietnam War, and descends into madness in the process.', 4.25);
INSERT INTO products (name, description, rating) VALUES ('The Bridge on the River Kwai', 'British prisoners of war are forced to build a bridge for their Japanese captors, while their commander becomes obsessed with completing the task.', 4.05);
INSERT INTO products (name, description, rating) VALUES ('Glory', 'The first all-black regiment in the US Army fights bravely during the Civil War, despite facing prejudice and hostility from their own side.', 3.95);
INSERT INTO products (name, description, rating) VALUES ('Letters from Iwo Jima', 'Japanese soldiers defend their island against a US invasion during WWII, as seen through the eyes of a young soldier.', 4.00);
INSERT INTO products (name, description, rating) VALUES ('The Thin Red Line', 'A group of American soldiers face psychological and physical challenges as they fight to capture a strategic island during WWII.', 3.80);
INSERT INTO products (name, description, rating) VALUES ('Dunkirk', 'Allied soldiers are evacuated from the beaches of Dunkirk during WWII, as they face intense bombardment and attack from German forces.', 4.05);

Here is some example data for the embeddings. Unfortunately, it's too much to include in this article.

INSERT INTO embeddings (products_id, description, embedding) VALUES ((SELECT id FROM products WHERE name = ''Blade Runner''),(SELECT description FROM products WHERE name = ''Blade Runner''),ARRAY[-0.003444323781877756, -0.026471085846424103, 0.02470278926193714, -0.0628991648554802, 0.028019171208143234, -0.051577165722846985, 0.016056161373853683, 0.006616327911615372, 0.029275327920913696, 0.0034811825025826693, 0.026010045781731606, 0.01963225193321705, -0.02938656508922577, 0.059305232018232346, -0.027164539322257042, -0.00231950543820858, 0.01655345782637596, 0.033696919679641724, -0.034360554069280624, -0.020618878304958344, -0.008635166101157665, -0.022629398852586746, 0.053773462772369385, -0.0006674404139630497, -0.0331035777926445, -0.0231393463909626, 0.04909772798418999, -0.007680005859583616, -0.00308439158834517, -0.025070397183299065, 0.002819700865074992, -0.05029661953449249, 0.023335743695497513, 0.030308369547128677, 0.0000013531977174352505, -0.04671705141663551, -0.01845468580722809, -0.021935028955340385, 0.0018042349256575108, 0.03773689642548561, 0.006380816921591759, 0.026102710515260696, -0.02555643580853939, -0.0021733457688242197, 0.0015640220372006297, 0.020586898550391197, 0.053574614226818085, -0.10347854346036911, 0.018649203702807426, -0.008515148423612118, -0.007835631258785725, 0.025897812098264694, -0.016796551644802094, 0.004418008495122194, -0.0426475815474987, 0.04010993242263794, -0.04380115121603012, -0.036976899951696396, 0.09763149917125702, 0.06163483485579491, -0.00022092333529144526, -0.035543810576200485, -0.03881048783659935, -0.02638210542500019, 0.06362597644329071, 0.005669967271387577, 0.002144403988495469, -0.03672311082482338, -0.005458294879645109, 0.05964990332722664, -0.05075370520353317, -0.028448436409235, 0.015062062069773674, 0.044858820736408234, 0.003399295499548316, -0.07317173480987549, -0.038389623165130615, -0.004879351239651442, 0.0017499751411378384, -0.006944042164832354, 0.037586115300655365, 0.004300856031477451, 0.03377854451537132, -0.013542159460484982, 0.011425543576478958, -0.007701897993683815, 0.021279528737068176, -0.03683778643608093, -0.0395832397043705, -0.0813005194067955, -0.015917902812361717, 0.031343135982751846, 0.05580697953701019, -0.0018615119624882936, 0.0004098351637367159, -0.007520935498178005, -0.03505546227097511, -0.012982814572751522, -0.03107682429254055, -0.026107216253876686, -0.014980546198785305, -0.029819902032613754, 0.04141892120242119, 0.04224405437707901, 0.04016243293881416, 0.006476550363004208, 0.0011747516691684723, 0.01750662736594677, 0.042094115167856216, 0.002520316746085882, -0.0363263301551342, -0.0363810695707798, 0.02701539732515812, 0.032616518437862396, 0.0033296775072813034, -0.0351349376142025, 0.0832381397485733, 0.009739087894558907, -0.10465129464864731, -0.059694088995456696, -0.05717901512980461, 0.0257235299795866, -0.01357448659837246, 0.031766150146722794, 0.016452213749289513, -0.019702157005667686, 0.0041882991790771484, -0.059444528073072433, 0.012260017916560173, -0.07740011811256409, -0.024978961795568466, -0.04617641493678093, 0.004299295134842396, 0.028501782566308975, -0.026095878332853317, 0.006288221571594477, 0.02879760041832924, 0.03829439356923103, -0.004506339784711599, 0.040253590792417526, 0.08130798488855362, 0.007364803925156593, 0.02806094102561474, 0.03571467846632004, 0.015148740261793137, -0.03756481781601906, -0.003552858019247651, -0.0009023653110489249, 0.02303246222436428, -0.03449109569191933, 0.015845322981476784, 0.028420958667993546, -0.05130904167890549, 0.042060088366270065, -0.019339008256793022, -0.026117075234651566, 0.05640113353729248, -0.019927216693758965, -0.028486227616667747, -0.011937686242163181, 0.012880057096481323, 0.022980505600571632, 0.07943981885910034, -0.010340995155274868, -0.01958514004945755, 0.009161093272268772, -0.007698398549109697, 0.03774464130401611, -0.006866403389722109, 0.06908541172742844, 0.013973192311823368, 0.0032369482796639204, -0.006612555589526892, -0.035209376364946365, -0.022690847516059875, -0.002125747036188841, -0.019498661160469055, -0.027635499835014343, 0.030457763001322746, 0.09100447595119476, -0.08681043982505798, -0.03122493252158165, 0.020683253183960915, -0.01263758260756731, -0.06018483266234398, -0.0536409392952919, -0.05096425488591194, -0.02934763953089714, -0.015348394401371479, 0.05457000806927681, 0.03157097473740578, -0.0033352558966726065, -0.024362342432141304, -0.017799532040953636, 0.04972885549068451, -0.045171383768320084, -0.008567873388528824, -0.05260191112756729, -0.017834074795246124, 0.01672007143497467, 0.036699358373880386, -0.03418101370334625, 0.0275004543364048, 0.03893755003809929, 0.006006942130625248, -0.04596710205078125, -0.0027156034484505653, -0.055811431258916855, -0.05442174896597862, 0.02835957147181034, 0.005071056541055441, -0.029870908707380295, 0.006588875316083431, 0.019131017848849297, 0.042334459722042084, -0.002661505015566945, 0.007679046597331762, 0.04102035239338875, -0.09344083815813065, -0.025160465389490128, 0.004662679508328438, 0.043304506689310074, 0.0052140746265649796, 0.021347276866436005, -0.003969618584960699, -0.011893076822161674, -0.014613705687224865, -0.0441468209028244, 0.056483831256628036, 0.009311840869486332, 0.02093740552663803, 0.06470613181591034, 0.04215411841869354, -0.013232664205133915, 0.012695858255028725, 0.001140025444328785, 0.054604869335889816, -0.008343372493982315, -0.0009661316871643066, -0.026841986924409866, 0.0027682126965373755, 0.06258122622966766, -0.01930416375398636, 0.04056254029273987, 0.0055909245274960995, -0.05993680655956268, -0.03985926881432533, -0.005453231278806925, -0.006172612309455872, 0.03818950429558754, 0.05942189693450928, -0.02297884412109852, -0.049770012497901917, 0.021150240674614906, -0.0448821596801281, 0.029359551146626472, -0.0014185943873599172, 0.028969185426831245, 0.006003230810165405, 0.035030391067266464, 0.04726078733801842, 0.003934255801141262, 0.04346531629562378, 0.04914107546210289, 0.018477749079465866, 0.003376384498551488, 0.03380812704563141, 0.048663731664419174, 0.0014591675717383623, 0.029932677745819092, -0.01539415493607521, -0.03157488629221916, -0.042906638234853745, 0.05487829074263573, -0.06508281826972961, 0.011185139417648315, -0.06016935408115387, 0.005663443356752396, -0.05988246947526932, -0.01712751016020775, -0.003117845393717289, -0.027791064232587814, 0.03160681575536728, 0.009136800654232502, 0.0006736195646226406, 0.01648338884115219, -0.013935133814811707, 0.02980201691389084, -0.042918093502521515, 0.010984737426042557, 0.006218138616532087, 0.0152159184217453, 0.014239341020584106, 0.018044283613562584, 0.0008172391098923981, 0.030305415391921997, -0.031244998797774315, 0.09678979963064194, 0.015018909238278866, -0.003943648189306259, 0.06551022827625275, 0.0943526178598404, -0.047941528260707855, -0.018541930243372917, 0.028146015480160713, 0.01479361578822136, 0.023779528215527534, -0.025846950709819794, -0.01704726740717888, 0.021009646356105804, -0.005022399127483368, 0.01307751890271902, -0.014380975626409054, 0.01353677362203598, -0.017025435343384743, -0.022964945062994957, 0.020035425201058388, -0.05612787976861, -0.020253174006938934, 0.05267973989248276, -0.014594021253287792, 0.0032903936225920916, 0.02289963886141777, 0.0115572614595294, 0.004296890459954739, 0.03681814298033714, 0.007178615778684616, 0.03624529764056206, -0.019951106980443, 0.061464227735996246, 0.005687267519533634, -0.028155168518424034, 0.05154533311724663, 0.003284045495092869, 0.03652750328183174, -0.0452396459877491, -0.06618393212556839, -0.09170137345790863, -0.01697501540184021, 0.02193635143339634, 0.00898216012865305, -0.03733842819929123, -0.014883599244058132, 0.0005840631783939898, 0.06465562433004379, 0.018909679725766182, -0.014502058736979961, 0.004724449012428522, 0.007709541358053684, 0.004457560833543539, -0.0068323346786201, 0.04813248664140701, 0.003204525215551257, -0.002407429739832878, 0.007319597061723471, -0.024577490985393524, 0.06945891678333282, -0.05364304035902023, 0.05318151041865349, 0.0041933064348995686, 0.050605084747076035, 0.009615397080779076, -0.00811084359884262, -0.02470310404896736, -0.05208468437194824, -0.017056701704859734, -0.05602206662297249, 0.029485417529940605, 0.07258428633213043, -0.02101552113890648, -0.011643148958683014, 0.020940424874424934, -0.033106498420238495, -0.039576366543769836, 0.01428520493209362, 0.027917344123125076, 0.024552779272198677, -0.013916176743805408, -0.0492866225540638, 0.015079186297953129, 0.053152695298194885, 0.014036916196346283, 0.00796799547970295, -0.02669356018304825, 0.01773080974817276, -0.07684379816055298, -0.03947446495294571, -0.013839403167366982, -0.019808528944849968, 0.044586680829524994, 0.048880551010370255, -0.0022161821834743023, -0.03889312222599983, 0.008644678629934788, 0.015069253742694855, -0.03045516088604927, 0.020548060536384583, -0.024878954514861107, -0.017981214448809624, -0.02130267769098282, -0.011174054816365242, 0.002386725042015314, 0.025608791038393974, 0.060363128781318665, 0.048577938228845596, -0.015685532242059708, 0.08620861917734146, 0.024948621168732643, -0.035514842718839645, 0.027979765087366104, 0.060550715774297714, -0.055707283318042755, -0.015986701473593712, 0.005202457308769226, -0.05275169014930725, -0.07296434044837952, -0.018405236303806305, 0.001180006773211062, -0.010071461088955402, 0.020098868757486343, 0.04538736119866371, 0.02658151648938656, 0.07686913758516312, -0.02637401409447193, -0.0003180694184266031, -0.08864020556211472, -0.022224370390176773, -0.01024015061557293, 0.0646328330039978, 0.020658591762185097, -0.002463805489242077, -0.00006221988587640226, -0.04010506346821785, 0.022955454885959625, -0.059867892414331436, -0.018956905230879784, 0.01961643062531948, -0.06433454900979996, -0.06114577874541283, 0.0071553620509803295, -0.04061080515384674, -0.02769327349960804, -0.0230235792696476, 0.0261552594602108, -0.1093602105975151, -0.03764764219522476, -0.05858023092150688, -0.047582630068063736, 0.015565442852675915, 0.0636935606598854, 0.006174057722091675, 0.040674928575754166, -0.007875769399106503, -0.028051191940903664, 0.05529084429144859, 0.004455729853361845, 0.01914256438612938, 0.04988216236233711, -0.07910934835672379, 0.021041715517640114, 0.06524339318275452, 0.011631877161562443, -0.041511066257953644, -0.012324229814112186, 0.011038973927497864, 0.016788747161626816, 0.03647289425134659, 0.0004254914238117635, -0.021909542381763458, 0.033596716821193695, -0.005366540979593992, -0.03811988979578018, 0.02841281332075596, 0.0074903275817632675, -0.0012951081153005362, -0.006891860626637936, 0.023198777809739113, -0.045236263424158096, 0.010119049809873104, 0.07720021158456802, 0.026955893263220787, 0.01758904941380024, -0.018474355340003967, 0.056478679180145264, 0.04510725289583206, -0.06721939891576767, 0.009799635969102383, 0.03550298511981964, -0.04761958494782448, -0.014053715392947197, -0.02963472343981266, 0.012592094019055367, -0.026486506685614586, 0.058722276240587234, -0.03722565248608589, -0.0029311932157725096, 0.007427750620990992, -0.06379443407058716, 0.02002900466322899, 0.018693048506975174, -0.024219578132033348, -0.03644561767578125, -0.04520692303776741, 0.07688769698143005, -0.04291779547929764, 0.011871855705976486, 0.030382346361875534, -0.027618076652288437, -0.0011247270740568638, 0.03030485473573208, -0.000016513227819814347, 0.03352109342813492, -0.019256815314292908, -0.021961187943816185, 0.029856866225600243, 0.03978333622217178, 0.018710611388087273, -0.0014742715284228325, -0.026686524972319603, -0.0036108908243477345, 0.02101326547563076, -0.04415827989578247, 0.0016350114019587636, -0.011592373251914978, -0.028131332248449326, 0.03160208463668823, 0.02414504997432232, -0.023845180869102478, 0.07231870293617249, 0.02319779060781002, -0.004554981831461191, 0.05989319831132889, 0.05666891857981682, -0.027128569781780243, -0.0028408279176801443, 0.05749622732400894, -0.04682435840368271, -0.029186276718974113, 0.015823448076844215, 0.02701057493686676, -0.0470864400267601, 0.032255928963422775, -0.05580740422010422, 0.012705579400062561, 0.011111111380159855, -0.009288140572607517, -0.023546582087874413, -0.0012435708194971085, -0.06820231676101685, -0.034186951816082, 0.004638835322111845, 0.046935610473155975, 0.02787589840590954, -0.018715983256697655, -0.009610431268811226, -4.8751890672767065e-33, -0.03886224329471588, -0.0148899145424366, -0.055257827043533325, -0.03161194548010826, -0.06866002827882767, -0.048563260585069656, -0.012143254280090332, 0.015441046096384525, -0.036316510289907455, 0.016622884199023247, 0.011809486895799637, 0.02372799441218376, -0.008425163105130196, -0.04157770797610283, -0.015566814690828323, -0.002047523856163025, 0.029473895207047462, 0.019498279318213463, 0.08009562641382217, -0.0031370415817946196, 0.03769164904952049, 0.04373306781053543, -0.007393895648419857, 0.029409363865852356, -0.06276100873947144, 0.06194387003779411, -0.0017583789303898811, 0.011193297803401947, -0.0018352698534727097, 0.04557279124855995, 0.023315129801630974, 0.010615495033562183, -0.013895215466618538, -0.026799863204360008, -0.022085199132561684, 0.013394993729889393, 0.06358006596565247, 0.06650935858488083, -0.055913280695676804, -0.08937807381153107, 0.017553258687257767, -0.11030541360378265, -0.003502532374113798, -0.076187863945961, -0.022830935195088387, 0.04387032240629196, 0.0073469216004014015, -0.03734293580055237, -0.0352429635822773, -0.05322656407952309, -0.037706706672906876, -0.00844163354486227, -0.0072557381354272366, 0.026679344475269318, -0.032699596136808395, -0.01674048788845539, 0.001542132580652833, -0.0018763665575534105, 0.00792380515486002, -0.005562196020036936, -0.004838457331061363, -0.0013192510232329369, 0.039217885583639145, 0.011522026732563972, 0.0614129863679409, 0.026274148374795914, 0.01329351682215929, -0.029549922794103622, -0.01356449443846941, -0.041714876890182495, 0.01436277199536562, -0.013272966258227825, 0.02821672521531582, -0.029755109921097755, 0.03612205758690834, -0.030721567571163177, -0.053954631090164185, 0.014288416132330894, -0.014413715340197086, -0.01239828858524561, 0.009516755118966103, 0.047604385763406754, 0.043087754398584366, 0.027988916262984276, 0.04109764099121094, -0.009772575460374355, 0.01726001314818859, -0.023954952135682106, -0.06391701847314835, -0.02687438204884529, -0.01657523214817047, -0.00875173695385456, 0.03240891173481941, -0.028423426672816277, 0.11811476945877075, -0.07080983370542526, -0.0022755584213882685, -0.04935848340392113, -0.006998125463724136, 0.025150658562779427, 0.03361821919679642, -0.020476719364523888, 0.052428361028432846, -0.0360923707485199, 0.049109071493148804, 0.01787114143371582, -0.014071007259190083, -0.04444855451583862, 0.0354900099337101, 0.002381380181759596, -0.009923908859491348, -0.02162947505712509, -0.06850152462720871, -0.02903137356042862, 0.0026310000102967024, 0.008563940413296223, -0.0012574894353747368, -0.05516308173537254, -0.023346519097685814, 0.006287571508437395, 0.0014891448663547635, 0.05889715254306793, -0.004045530222356319, 0.07165750861167908, -0.04675598070025444, 0.030990319326519966, -0.03796004131436348, 0.02312927320599556, 0.033689938485622406, -0.06765171885490417, -0.006608595605939627, -0.020770668983459473, 2.0597332195393392e-7, -0.08544763922691345, -0.06511994451284409, 0.035938892513513565, -0.0006607809336856008, -0.04730972275137901, 0.017399990931153297, 0.07046516984701157, 0.030698291957378387, -0.06275304406881332, -0.06473670899868011, -0.014863639138638973, 0.026322629302740097, -0.039283692836761475, -0.021531347185373306, 0.04129347950220108, 0.0006557564483955503, 0.020861957222223282, -0.002874113852158189, -0.021766722202301025, 0.003911678679287434, -0.031110672280192375, 0.019473262131214142, 0.03345978260040283, 0.04395654797554016, -0.004917255137115717, 0.011997456662356853, 0.04831048473715782, 0.020693859085440636, -0.0316787026822567, -0.00482577458024025, 0.014121897518634796, 0.006916105281561613, -0.015417393296957016, 0.06541837751865387, 0.004507359582930803, -0.04030855745077133, 0.027468230575323105, 0.07387141138315201, -0.018875226378440857, -0.005184031091630459, 0.019669270142912865, 0.020037608221173286, -0.02914455346763134, 0.03919626399874687, -0.005018492694944143, 0.062445010989904404, -0.0065707978792488575, -0.03160180151462555, -0.015170259401202202, -0.002449147868901491, 0.029379231855273247, -0.043778445571660995, -0.021001523360610008, 0.04399503767490387, -0.016293061897158623, 0.023169664666056633, 0.049543559551239014, 0.0015421101124957204, 0.04752032086253166, 0.03609590232372284, -0.013642252422869205, -0.01060024555772543, 0.02340504713356495, 0.08527328819036484, 0.04242066666483879, 0.022035906091332436, 0.00550394831225276, 2.288826631827673e-34, 0.01631185971200466, 0.006396187469363213, 0.008778362534940243, -0.06379157304763794, 0.02655109204351902, 0.00860403012484312, -0.04085860773921013, 0.003869263455271721, 0.002269274787977338, -0.02300179935991764, -0.009715148247778416]::vector(768));
INSERT INTO embeddings (products_id, description, embedding) VALUES ((SELECT id FROM products WHERE name = ''The Matrix''),(SELECT description FROM products WHERE name = ''The Matrix''),ARRAY[0.004222186282277107, -0.0147852199152112, -0.01314715575426817, -0.03601556271314621, -0.010996290482580662, -0.014270812273025513, 0.00301735894754529, 0.012837874703109264, -0.020293869078159332, 0.031345658004283905, 0.03857377916574478, 0.02330600842833519, -0.02878100611269474, 0.050838593393564224, 0.03599768877029419, -0.04439923167228699, -0.0020094469655305147, -0.004791630897670984, -0.06468978524208069, -0.029028108343482018, -0.05130677670240402, -0.04162290319800377, -0.02734927274286747, -0.0065697915852069855, -0.039851944893598557, -0.002587720053270459, -0.013149353675544262, 0.03153752163052559, 0.006917333696037531, -0.019055044278502464, -0.010380519554018974, -0.03676409274339676, 0.05144471302628517, 0.048339005559682846, 0.0000011752051705116173, -0.04557278752326965, 0.006143731996417046, -0.026508277282118797, 0.016820861026644707, 0.01927795819938183, 0.038016680628061295, 0.05840466544032097, -0.016204986721277237, -0.017147481441497803, -0.04061231017112732, 0.031197410076856613, 0.027641698718070984, -0.07496952265501022, -0.00660681864246726, -0.011319694109261036, -0.02104990929365158, 0.009659304283559322, -0.02313433587551117, 0.03824314475059509, -0.03874031826853752, 0.05049687251448631, -0.008237050846219063, 0.03660055994987488, 0.10272044688463211, -0.026157237589359283, -0.001599600538611412, -0.007720739580690861, 0.0010263880249112844, 0.014263113029301167, 0.03933047130703926, 0.04232800006866455, 0.028491348028182983, -0.05529998615384102, 0.00213690847158432, 0.02195117063820362, -0.024697687476873398, -0.03431742638349533, 0.003946145065128803, 0.026860205456614494, 0.01154404692351818, -0.015742655843496323, -0.025798726826906204, 0.030185438692569733, 0.008093389682471752, 0.011774308048188686, -0.029784681275486946, 0.051345277577638626, 0.016599953174591064, -0.02395041286945343, 0.05541978403925896, -0.0096333809196949, 0.02136172540485859, -0.005864301696419716, -0.049467504024505615, -0.021049413830041885, 0.04576275125145912, -0.025874372571706772, -0.004269868601113558, -0.006619032006710768, 0.03494405373930931, -0.026895103976130486, -0.0321958065032959, 0.04911750182509422, -0.024733012542128563, -0.04717203602194786, 0.08846522122621536, 0.008362911641597748, 0.04791337996721268, 0.03032206930220127, 0.027466662228107452, 0.02525145374238491, -0.03954973444342613, 0.009212235920131207, -0.009713275358080864, 0.042997054755687714, -0.01309308409690857, 0.007359374780207872, 0.006508673075586557, 0.028045207262039185, -0.01332579180598259, -0.005227714776992798, 0.04529929533600807, 0.036588169634342194, -0.10163531452417374, -0.0013363807229325175, -0.09246470034122467, 0.04420796409249306, 0.020521745085716248, -0.01263941079378128, -0.05490577220916748, -0.03166615962982178, -0.032351333647966385, 0.01974274218082428, -0.021531591191887856, -0.04964296147227287, 0.002680744742974639, 0.03437421843409538, -0.017622943967580795, 0.04161982238292694, 0.010001366958022118, 0.05819649249315262, 0.025221608579158783, 0.05900660157203674, 0.006187292747199535, -0.008107793517410755, 0.10285025089979172, -0.005188242997974157, 0.03640838339924812, -0.0374540351331234, 0.04089488834142685, -0.07883407175540924, -0.011409449391067028, 0.028103968128561974, -0.00019611979951150715, -0.040208086371421814, -0.0012515238486230373, 0.07267959415912628, -0.03834301233291626, 0.038192447274923325, 0.01912391372025013, -0.012261235155165195, 0.01912856660783291, -0.008169598877429962, -0.04179486632347107, 0.0009153579012490809, 0.003795070108026266, 0.054126106202602386, 0.12038221955299377, 0.008127509616315365, -0.028134511783719063, 0.046115532517433167, -0.04407200217247009, -0.01358763501048088, -0.024292627349495888, 0.0827445536851883, -0.04809743911027908, -0.03796115517616272, -0.037642717361450195, 0.018860232084989548, 0.02505808137357235, -0.012879067100584507, -0.06659049540758133, 0.0059787495993077755, 0.08504050225019455, 0.0434274785220623, 0.0032901964150369167, -0.0014320105547085404, 0.016726123169064522, 0.03566489741206169, -0.01039252057671547, -0.00934560876339674, -0.02911660633981228, -0.0185776948928833, -0.03721943497657776, 0.0080636627972126, 0.06592956185340881, -0.025582265108823776, 0.012113748118281364, 0.0008436926291324198, -0.007051187567412853, -0.018299052491784096, -0.036754060536623, -0.06650067865848541, -0.006596352905035019, 0.037467408925294876, 0.017200054600834846, -0.04099896177649498, 0.022483548149466515, 0.056231897324323654, -0.0056408303789794445, -0.07373268157243729, 0.041403766721487045, -0.04630417004227638, 0.01596507616341114, 0.04313752055168152, 0.03560907021164894, -0.01676606386899948, -0.03754115849733353, 0.035068120807409286, 0.013822458684444427, -0.013555116951465607, 0.02281690016388893, 0.05391155928373337, -0.050942931324243546, -0.02047453448176384, -0.06680131703615189, 0.06251530349254608, -0.002179295988753438, 0.014150863513350487, -0.050033386796712875, -0.008405696600675583, -0.029240893200039864, -0.05749307572841644, 0.031023412942886353, 0.009898586198687553, -0.03785167634487152, 0.015532700344920158, 0.04942039027810097, 0.0046677677892148495, 0.006518885958939791, 0.03137556090950966, 0.016473792493343353, 0.086527518928051, 0.005114121828228235, -0.0761672705411911, 0.012728125788271427, 0.034178201109170914, 0.02295995131134987, 0.022960858419537544, -0.011981871910393238, 0.00495798047631979, -0.007396696135401726, -0.019223235547542572, 0.004339631646871567, 0.022934723645448685, 0.04423012584447861, -0.025231394916772842, -0.015255776233971119, -0.037198588252067566, 0.00986744835972786, 0.052589789032936096, -0.017362350597977638, 0.021443072706460953, -0.029374046251177788, 0.04034798964858055, 0.05276242271065712, -0.01700134202837944, 0.05318504199385643, 0.022345522418618202, 0.010281706228852272, -0.0065788100473582745, 0.020734351128339767, -0.024975720793008804, -0.042971037328243256, 0.008648596704006195, -0.035883571952581406, 0.007254012860357761, -0.06991735100746155, -0.0029935187194496393, -0.017072223126888275, 0.02996409870684147, 0.020990338176488876, 0.040796276181936264, -0.09082746505737305, 0.01966460980474949, -0.0005091972998343408, -0.027962330728769302, 0.03540974110364914, 0.004692436661571264, -0.007577086798846722, 0.018895555287599564, 0.07716073840856552, 0.061474382877349854, -0.06709019094705582, -0.05572944134473801, 0.009381735697388649, 0.009874881245195866, 0.031209208071231842, 0.01623958721756935, -0.020794562995433807, 0.0008229118539020419, -0.0335625484585762, 0.05780957266688347, -0.01546476036310196, 0.007117695640772581, 0.06381743401288986, 0.0464029461145401, 0.025059210136532784, -0.020517902448773384, -0.004995823837816715, 0.0027279560454189777, -0.012912590987980366, -0.07278264313936234, 0.020301930606365204, 0.006825647782534361, 0.010555620305240154, 0.04315066337585449, -0.027802230790257454, 0.07326729595661163, 0.006174994166940451, -0.03366575762629509, 0.057843901216983795, -0.029541511088609695, -0.040797341614961624, 0.06901507824659348, -0.017922617495059967, 0.04842444136738777, 0.03608925640583038, -0.012331364676356316, -0.006893589626997709, 0.04453563317656517, 0.02721879631280899, 0.06479927152395248, -0.030151378363370895, 0.04729478061199188, 0.024664796888828278, 0.04499620571732521, 0.07935816049575806, -0.029353780671954155, 0.0327971912920475, -0.007532899733632803, -0.03465161845088005, -0.0917244479060173, -0.06739861518144608, 0.005785477813333273, 0.019954044371843338, -0.020794367417693138, -0.02223380096256733, 0.010049402713775635, 0.01591101475059986, -0.008439070545136929, -0.011202429421246052, -0.010925248265266418, -0.024310678243637085, -0.015297964215278625, 0.011892023496329784, 0.095282644033432, 0.010697574354708195, -0.009855986572802067, -0.03526921942830086, -0.013189082965254784, 0.06453431397676468, 0.027222059667110443, -0.008329473435878754, 0.010417408309876919, 0.04380242899060249, 0.009229528717696667, -0.01126118004322052, 0.023620551452040672, -0.02753537893295288, 0.021686142310500145, -0.0344320647418499, 0.03429078683257103, 0.023949630558490753, 0.03804999589920044, -0.01220228523015976, 0.031915366649627686, -0.050750408321619034, -0.008245522156357765, 0.01003575325012207, -0.03765139356255531, -0.008975531905889511, -0.04854121059179306, -0.03267836198210716, 0.015182632952928543, 0.037703707814216614, -0.013041408732533455, 0.04457775503396988, -0.002037792932242155, 0.015230447985231876, -0.048916175961494446, -0.04208776354789734, 0.035882316529750824, -0.005363316275179386, 0.05138132721185684, -0.003010799875482917, -0.024480251595377922, -0.019151566550135612, 0.027220750227570534, -0.03403700888156891, -0.017656832933425903, -0.032849669456481934, 0.0005924674915149808, -0.004599920008331537, 0.003326353384181857, -0.011739924550056458, 0.03465753793716431, -0.0023012435995042324, 0.05811642110347748, 0.049374040216207504, 0.04345044493675232, 0.04759270325303078, 0.04161909595131874, -0.08100100606679916, -0.0001346939243376255, -0.040496472269296646, -0.006202156655490398, 0.02455546334385872, -0.023651007562875748, -0.030936408787965775, -0.03354135900735855, -0.0058448826894164085, 0.006228117737919092, -0.026195159181952477, 0.02964063733816147, 0.032620761543512344, 0.006165815517306328, 0.03919478878378868, -0.030674714595079422, 0.03941948339343071, -0.04020420461893082, -0.039847273379564285, -0.0009965088684111834, 0.008748909458518028, 0.0025311096105724573, -0.05251140519976616, -0.018339231610298157, -0.03555756434798241, -0.006626261863857508, 0.004643804859369993, -0.04304546117782593, -0.054859597235918045, -0.022842328995466232, 0.01823950558900833, -0.006839938461780548, -0.01831946149468422, -0.050297729671001434, 0.02761993184685707, 0.00380695890635252, -0.12225604802370071, 0.0030756115447729826, -0.040269240736961365, -0.11033717542886734, -0.048719219863414764, 0.03411189839243889, 0.00269524147734046, 0.026107145473361015, -0.015038290061056614, 0.0036025308072566986, -0.0632481724023819, 0.004803289193660021, -0.003588971449062228, 0.06112421303987503, -0.04675162583589554, 0.0592387318611145, 0.12378111481666565, 0.02679605595767498, 0.02907169610261917, 0.01743149198591709, 0.024532966315746307, 0.061928167939186096, -0.05373794957995415, -0.03962884843349457, 0.04405304789543152, 0.048168715089559555, -0.02356807328760624, -0.02957088313996792, 0.00369360507465899, -0.020612945780158043, -0.002211438026279211, -0.0186062790453434, -0.016185132786631584, -0.06208135932683945, -0.017880069091916084, 0.022591041401028633, -0.010587896220386028, -0.024205250665545464, -0.03427102789282799, 0.01548223290592432, 0.018538953736424446, -0.04597463458776474, -0.021515976637601852, -0.003071410348638892, -0.03549065813422203, -0.05904296040534973, -0.020602531731128693, 0.018380412831902504, 0.024411361664533615, 0.02289591357111931, -0.009612133726477623, -0.04228520020842552, 0.0594794936478138, -0.05407993495464325, -0.00013824881170876324, 0.029616428539156914, -0.02762063592672348, -0.01594085805118084, 0.004230366088449955, 0.10761075466871262, -0.06178895756602287, 0.01663077063858509, -0.0013335089897736907, 0.00000269636848315713, 0.022829100489616394, -0.007489746902137995, -0.026799263432621956, 0.037750083953142166, -0.013022473081946373, -0.07661851495504379, 0.00791420042514801, 0.1318715363740921, 0.07387833297252655, -0.020745588466525078, -0.03853246569633484, -0.01167996320873499, 0.024556603282690048, -0.010137591511011124, -0.05327228084206581, 0.000167507998412475, -0.018818171694874763, -0.04386723041534424, 0.04586903378367424, -0.010326486080884933, 0.0397428497672081, 0.015675920993089676, -0.003984672483056784, 0.01678910106420517, 0.01794484630227089, -0.0065938387997448444, -0.037646569311618805, 0.028202854096889496, 0.0025051054544746876, 0.004795788321644068, 0.010555604472756386, 0.012812342494726181, -0.022425377741456032, 0.007762291934341192, 0.03213842958211899, 0.05720243975520134, 0.05628547444939613, -0.047970496118068695, 0.02565980702638626, 0.007987670600414276, -0.034028541296720505, -0.002841999987140298, -0.0073632304556667805, -0.007448943331837654, -0.0018565190257504582, 0.017866043373942375, -0.008288878947496414, -4.9793327239717763e-33, -0.02422517165541649, -0.019713010638952255, 0.0021817462984472513, 0.003985005896538496, -0.06057506799697876, -0.03787031024694443, -0.03619127348065376, 0.01130687166005373, -0.03541797772049904, 0.005597281269729137, 0.001436022575944662, -0.01380542479455471, -0.01322485413402319, -0.02544887363910675, -0.014396287500858307, -0.010641343891620636, 0.028371943160891533, -0.021905718371272087, -0.002828779397532344, -0.0214553102850914, -0.043158818036317825, 0.021145688369870186, -0.03362515941262245, -0.0168903898447752, -0.010974214412271976, -0.0202801413834095, -0.009236509911715984, -0.020823165774345398, -0.0005931563209742308, 0.005569911561906338, -0.009019546210765839, 0.028290266171097755, -0.01284007541835308, -0.0837942510843277, 0.00683190580457449, -0.0019337873673066497, 0.010054051876068115, 0.00666408846154809, -0.040955573320388794, -0.02391471341252327, 0.0050154016353189945, -0.0364559106528759, -0.007767666596919298, -0.046124543994665146, -0.03621520847082138, 0.030645614489912987, 0.036666449159383774, -0.03257833421230316, -0.029272502288222313, 0.0075861443765461445, -0.05703170597553253, -0.01838890090584755, 0.011444172821938992, 0.020210642367601395, 0.056802116334438324, -0.02986357919871807, -0.010549203492701054, -0.04387916997075081, -0.02198757790029049, 0.05607335641980171, -0.03444661945104599, -0.029257306829094887, 0.010820967145264149, -0.036099374294281006, 0.09435424953699112, 0.034490641206502914, 0.07495034486055374, 0.006074267905205488, -0.06208486109972, -0.00873374193906784, -0.013075128197669983, -0.0029471267480403185, 0.07120384275913239, 0.042628150433301926, -0.03045348823070526, -0.033121880143880844, -0.01683942787349224, -0.010064760223031044, -0.03821006044745445, -0.022190889343619347, 0.05568133294582367, 0.01971484161913395, 0.020586613565683365, -0.006951636169105768, 0.05224110931158066, -0.00547315739095211, 0.01785808429121971, -0.02255118452012539, -0.03802230954170227, -0.002477178582921624, -0.003514254931360483, -0.005685581360012293, 0.01065421849489212, -0.05331449955701828, 0.057250406593084335, -0.02086731791496277, 0.03731026127934456, 0.0067147561348974705, -0.0026453330647200346, -0.015496022067964077, 0.0682944506406784, -0.03607815504074097, -0.031132297590374947, 0.010085132904350758, 0.051100265234708786, 0.030525384470820427, -0.05085272714495659, 0.00329823256470263, 0.021773163229227066, 0.025280877947807312, 0.03207642585039139, -0.01513864565640688, 0.0403033122420311, -0.04763511195778847, -0.010592003352940083, -0.0031214982736855745, 0.009330390952527523, -0.04758834466338158, 0.003925826400518417, -0.006233695428818464, 0.012579504400491714, -0.0039070043712854385, -0.09338448941707611, 0.09716683626174927, -0.05621958523988724, 0.03017318807542324, -0.09903053194284439, -0.03091268800199032, 0.03127112239599228, -0.047208454459905624, -0.02372000552713871, -0.020538778975605965, 2.0145995449638576e-7, -0.1191779226064682, -0.011830268427729607, 0.022120682522654533, -0.012811588123440742, -0.014220783486962318, 0.026283346116542816, 0.03226529061794281, 0.04919921234250069, 0.013175717554986477, -0.043290309607982635, 0.022601881995797157, 0.0495242103934288, -0.062240537256002426, -0.058265652507543564, -0.026752188801765442, -0.005368147045373917, 0.04045862331986427, 0.020787052810192108, -0.001968695782124996, 0.018820447847247124, 0.004957607481628656, -0.009455899707973003, 0.04693618416786194, 0.05153419449925423, 0.0034403165336698294, -0.024117469787597656, -0.03061387874186039, -0.0032457192428410053, 0.009450928308069706, -0.01474998239427805, 0.04862422123551369, -0.004003562033176422, 0.001327113714069128, 0.026367036625742912, -0.0006959037855267525, -0.04738664999604225, -0.00207902817055583, 0.04630666226148605, -0.03159097954630852, 0.03248409181833267, 0.009970814920961857, -0.019996315240859985, -0.01831483468413353, 0.005495579447597265, -0.005843787454068661, -0.01438324898481369, 0.007917601615190506, -0.03896813839673996, -0.03852283954620361, 0.02187107317149639, 0.00687446491792798, 0.000040706072468310595, 0.014255410991609097, 0.020519549027085304, -0.027342546731233597, 0.06565537303686142, 0.049787428230047226, 0.001402578898705542, 0.04542125016450882, 0.018802860751748085, -0.04364911839365959, 0.03411010652780533, 0.05163499340415001, -0.008310829289257526, 0.00143073417712003, -0.05527595803141594, -0.018121210858225822, 1.543508686080499e-34, 0.017264556139707565, 0.045693766325712204, 0.011460009030997753, -0.03521030396223068, -0.005849188659340143, 0.032558366656303406, 0.015928193926811218, 0.04276145249605179, 0.02572392113506794, 0.025875192135572433, -0.039587534964084625]::vector(768));
INSERT INTO embeddings (products_id, description, embedding) VALUES ((SELECT id FROM products WHERE name = ''Star Wars: Episode IV - A New Hope''),(SELECT description FROM products WHERE name = ''Star Wars: Episode IV - A New Hope''),ARRAY[-0.013804059475660324, 0.03898466378450394, 0.02029609866440296, -0.03684188425540924, 0.004196058958768845, -0.02089337259531021, -0.05188982933759689, 0.0024638529866933823, -0.0024917998816818, 0.029677266255021095, 0.00867346953600645, -0.10790611803531647, -0.024308806285262108, 0.05783790349960327, -0.02350941300392151, 0.007086984347552061, 0.014187246561050415, -0.01693638600409031, 0.03143571317195892, -0.034838516265153885, -0.019888028502464294, 0.0039743697270751, 0.008284234441816807, -0.009818846359848976, 0.010776464827358723, -0.007149055600166321, -0.03560488298535347, -0.03435540571808815, -0.010069909505546093, -0.059332020580768585, 0.07337436825037003, -0.02660195343196392, -0.00979932677000761, 0.13440679013729095, 0.0000011080693411713582, -0.0688747689127922, -0.03650832921266556, -0.014286603778600693, 0.07407014071941376, 0.06333974003791809, 0.041122905910015106, 0.08176872879266739, -0.05077941343188286, 0.0026010540314018726, 0.01096964068710804, -0.00527293561026454, 0.013008475303649902, -0.005941870156675577, 0.036722730845212936, 0.04995783418416977, -0.0009878423297777772, -0.05376821383833885, 0.020641257986426353, 0.005238192621618509, 0.009105827659368515, 0.005283346399664879, -0.0004972986062057316, -0.056224849075078964, 0.035620540380477905, -0.0014218856813386083, 0.012081797234714031, -0.0041031911969184875, -0.03895970433950424, 0.02732897363603115, 0.030442731454968452, -0.00385429710149765, -0.049439217895269394, 0.03314626216888428, -0.011427396908402443, 0.04335355386137962, 0.03310383856296539, -0.010013406164944172, 0.012836628593504429, 0.02566198632121086, 0.023980818688869476, -0.04907653108239174, -0.04147465154528618, -0.024597249925136566, 0.0065482608042657375, 0.007710567209869623, 0.02904452383518219, -0.01973501406610012, 0.012424832209944725, -0.042531710118055344, 0.02205563522875309, -0.021787481382489204, -0.024343376979231834, -0.05221199244260788, 0.029926402494311333, -0.07663622498512268, -0.05914260447025299, -0.02889786660671234, -0.01606244593858719, 0.015103640034794807, -0.04653414711356163, 0.04102900251746178, 0.040629591792821884, 0.009678767994046211, 0.0018570416141301394, -0.0528206042945385, 0.041586391627788544, 0.032288696616888046, 0.006503609474748373, 0.054506491869688034, -0.02117285318672657, -0.01311568170785904, 0.051563844084739685, -0.05967064946889877, 0.09140074998140335, 0.02654336765408516, 0.0033521170262247324, -0.034589625895023346, -0.024976273998618126, 0.000060360114730428904, -0.012328864075243473, -0.025760585442185402, 0.043306369334459305, -0.04487745463848114, -0.07999560981988907, 0.03730137646198273, 0.02077704668045044, 0.019897624850273132, 0.0031554591841995716, -0.03728942200541496, -0.06199273839592934, 0.07854155451059341, 0.0219415370374918, -0.05144243687391281, 0.02467522770166397, -0.03006831184029579, -0.0070409574545919895, -0.009598029777407646, -0.05325888469815254, 0.04830341786146164, 0.01232287660241127, 0.05823985114693642, -0.02066204324364662, -0.026327641680836678, -0.0018937751883640885, 0.054041001945734024, -0.007183178327977657, 0.006718464661389589, -0.02243621274828911, -0.03619909659028053, 0.012810488231480122, -0.03861606866121292, -0.0092031080275774, -0.044784899801015854, 0.03107399120926857, -0.002006116323173046, 0.025465520098805428, 0.007882366888225079, 0.015599789097905159, 0.04388730973005295, -0.013632534071803093, 0.030121074989438057, -0.047737255692481995, -0.011642963625490665, 0.026166798546910286, -0.002142525976523757, 0.019247014075517654, 0.028223011642694473, 0.027067752555012703, 0.04980519041419029, -0.022874142974615097, -0.0011685765348374844, -0.007845724932849407, 0.04133877903223038, -0.0007941208896227181, 0.053044188767671585, -0.05584124103188515, 0.0035409010015428066, 0.0006054225377738476, 0.03248118981719017, -0.023380553349852562, -0.02415945567190647, 0.03073340840637684, -0.05401018261909485, -0.028706438839435577, -0.04338089004158974, -0.034534942358732224, -0.05904499068856239, 0.06001491844654083, -0.005637419875711203, 0.04825592786073685, -0.008359386585652828, -0.02014056406915188, 0.03424990922212601, 0.044279903173446655, 0.0078050545416772366, 0.005290888249874115, -0.004804917145520449, -0.08417641371488571, 0.037659935653209686, 0.026067350059747696, -0.02474367991089821, -0.0060531217604875565, -0.058736249804496765, 0.10992265492677689, -0.012590703554451466, 0.056359972804784775, 0.016329370439052582, 0.07070314139127731, 0.025506991893053055, 0.03710205852985382, -0.09907863289117813, -0.013674372807145119, -0.025809308513998985, 0.013798750005662441, -0.023643245920538902, 0.049314968287944794, -0.05722685530781746, 0.012331156991422176, -0.015703584998846054, -0.004531636368483305, 0.02091457135975361, -0.02005903236567974, 0.05792611464858055, -0.04378339648246765, -0.07334247976541519, 0.0038995561189949512, 0.04728436842560768, -0.024952007457613945, -0.011764232069253922, -0.05507570505142212, -0.014670461416244507, 0.02257360890507698, -0.011027810163795948, 0.06054821237921715, 0.04354438930749893, -0.012254963628947735, 0.02670927159488201, -0.024661222472786903, 0.026101430878043175, 0.021278152242302895, -0.03507809713482857, 0.02577676810324192, 0.05408002436161041, -0.00497387396171689, -0.051910970360040665, -0.03552287444472313, 0.029768215492367744, 0.0034911250695586205, 0.03773404285311699, 0.04353000968694687, 0.004276962485164404, -0.07063492387533188, -0.012339790351688862, -0.01936851628124714, 0.0100895706564188, 0.048403918743133545, -0.02729535847902298, -0.023659683763980865, -0.02338770031929016, 0.05489060655236244, -0.021319778636097908, -0.0322921946644783, 0.010735533200204372, 0.030094517394900322, 0.011781756766140461, 0.07073548436164856, 0.044060468673706055, 0.014128404669463634, -0.008270286954939365, -0.013622927479445934, 0.018211010843515396, -0.02235654927790165, 0.005439660977572203, -0.00260500842705369, 0.010317709296941757, -0.009341507218778133, -0.001130029559135437, 0.03750772774219513, -0.026856305077672005, -0.020295612514019012, -0.015866894274950027, -0.03682767227292061, 0.049692265689373016, -0.08697932958602905, -0.0365801602602005, -0.01238846406340599, -0.05663279443979263, 0.028801994398236275, 0.02657507173717022, 0.007333304267376661, -0.022062083706259727, 0.01613319106400013, 0.08086530864238739, -0.022270381450653076, -0.050177473574876785, 0.014040680602192879, -0.006507993675768375, -0.01804780215024948, 0.030123678967356682, -0.0023293758276849985, -0.04064391553401947, -0.02028070017695427, 0.07296457141637802, -0.03830944746732712, 0.02672473154962063, 0.07573304325342178, -0.020996173843741417, 0.04969289153814316, -0.037303633987903595, -0.03766676038503647, -0.05661996081471443, -0.017990389838814735, -0.07336626946926117, 0.038836054503917694, 0.07414985448122025, 0.037313852459192276, 0.0046098679304122925, -0.0028097941540181637, -0.10220960527658463, -0.04321981593966484, 0.001147546572610736, 0.05483204126358032, -0.012260829098522663, -0.02516194060444832, 0.018809882923960686, 0.023997215554118156, 0.08486499637365341, 0.07376890629529953, -0.026281915605068207, 0.00019111615256406367, 0.03740815818309784, -0.008396230638027191, -0.04379076510667801, -0.018218854442238808, -0.0007764017791487277, 0.009326353669166565, 0.05280616506934166, -0.029024794697761536, -0.03131627291440964, 0.0024443529546260834, -0.0378994420170784, 0.006872108671814203, 0.0009391004568897188, -0.007251226808875799, -0.03610226511955261, -0.018060242757201195, 0.04758066684007645, 0.025881890207529068, -0.015944506973028183, 0.04588691517710686, -0.0047809649258852005, 0.029302263632416725, 0.011290793307125568, 0.03966691717505455, -0.018108583986759186, -0.0312967523932457, 0.05386420339345932, 0.015290403738617897, -0.012675740756094456, -0.03035733662545681, 0.06989280134439468, -0.0023389209527522326, -0.026609623804688454, 0.015847228467464447, -0.0556597076356411, 0.0111215366050601, -0.02885444089770317, -0.009566303342580795, 0.012166650965809822, 0.005000322125852108, 0.01571459323167801, 0.03074481524527073, 0.007940076291561127, 0.033157479017972946, -0.049396175891160965, 0.007409094832837582, -0.019267432391643524, 0.0018552488181740046, 0.04391096159815788, 0.00844760611653328, 0.012204290367662907, 0.03156903386116028, 0.00276673911139369, 0.09121163934469223, -0.008936874568462372, 0.012397429905831814, 0.028602512553334236, 0.03203456476330757, -0.005940027069300413, 0.062049053609371185, 0.012247784063220024, 0.001963335322216153, -0.013645549304783344, -0.013219793327152729, -0.017181601375341415, 0.03009066730737686, 0.010738851502537727, -0.0003093631530646235, -0.008422513492405415, 0.025509566068649292, -0.03678859397768974, -0.02989444136619568, 0.021276280283927917, 0.019199315458536148, -0.008252612315118313, 0.0028045636136084795, 0.09835086762905121, 0.005573119968175888, 0.061195723712444305, 0.010630086995661259, 0.05393396317958832, -0.009706174023449421, -0.03799901902675629, -0.016185684129595757, 0.037574075162410736, -0.015838760882616043, -0.039781831204891205, 0.0025197744835168123, 0.04481957107782364, -0.027691509574651718, -0.004091150593012571, 0.0004935733159072697, 0.049984823912382126, 0.0030562689062207937, -0.01031454000622034, 0.04378349706530571, 0.01930396445095539, -0.00045426233555190265, -0.0014230564702302217, 0.007161723915487528, 0.008108722046017647, -0.04312315210700035, 0.036370474845170975, 0.02965901605784893, -0.021289195865392685, 0.010332232341170311, 0.04610958322882652, -0.03357664868235588, -0.012397675774991512, -0.07226357609033585, 0.026358038187026978, 0.0563480518758297, 0.06204632669687271, -0.011486697942018509, 0.06548140197992325, -0.053308647125959396, -0.06021492928266525, -0.011651887558400631, 0.033925339579582214, 0.0018689362332224846, -0.05180169641971588, -0.015806930139660835, -0.016872450709342957, 0.032020315527915955, 0.006631059572100639, 0.008420648984611034, -0.039916470646858215, -0.0208068136125803, -0.061514854431152344, 0.030560459941625595, -0.0186053067445755, -0.0034416336566209793, -0.06389762461185455, -0.06151896342635155, -0.0014539625262841582, -0.02628539688885212, 0.0017172549851238728, -0.03376280888915062, 0.04583175107836723, -0.01985231228172779, 0.019756020978093147, -0.057285990566015244, -0.0362989641726017, 0.06341071426868439, -0.025708965957164764, -0.09096984565258026, -0.049415476620197296, 0.01553536020219326, -0.04372170567512512, 0.018805906176567078, 0.011469543911516666, -0.001886395737528801, -0.009760968387126923, -0.005339979659765959, -0.001415447797626257, -0.04322580620646477, 0.013660553842782974, -0.08970753848552704, -0.00842574704438448, 0.012222737073898315, -0.054762743413448334, 0.00033637211890891194, 0.001460874336771667, 0.005870910827070475, -0.011849958449602127, -0.021093223243951797, -0.012970414012670517, 0.024743998423218727, 0.0953013002872467, 0.03668951615691185, -0.04147592931985855, -0.022372761741280556, -0.009719661436975002, 0.05910149961709976, 0.025093402713537216, 0.013807549141347408, -0.03904775530099869, -0.0000029610484943987103, 0.018362633883953094, -0.053988367319107056, -0.023808518424630165, -0.01690264418721199, -0.04415145516395569, 0.022837063297629356, -0.031499773263931274, 0.013681081123650074, 0.04409076273441315, -0.05444983392953873, -0.0007560971425846219, 0.011648617684841156, 0.006557374261319637, 0.034757085144519806, -0.014641677029430866, 0.04681459069252014, -0.04017074406147003, -0.0015477349516004324, -0.00278112874366343, -0.05832314491271973, -0.06505297124385834, 0.031724877655506134, -0.041031863540410995, 0.039161961525678635, 0.023222845047712326, 0.13034485280513763, 0.0441228412091732, 0.02010461688041687, 0.037694621831178665, 0.0338321179151535, 0.03946688771247864, -0.014924861490726471, 0.035752952098846436, 0.0003725909919012338, 0.00247458228841424, -0.05796577408909798, 0.025363121181726456, -0.0009759360691532493, -0.000806354742962867, -0.012804845348000526, 0.0024037915281951427, 0.024007342755794525, -0.029195675626397133, 0.03174375370144844, -0.011526443995535374, -0.032206401228904724, 0.08983821421861649, -0.012575635686516762, 0.0015312049072235823, -0.0608772411942482, -0.03072040155529976, 0.02069142833352089, -4.8998244901340646e-33, -0.07243900746107101, -0.005098029505461454, -0.005409791134297848, -0.00500668678432703, -0.10354640334844589, -0.026269961148500443, -0.044656191021203995, -0.031186262145638466, -0.03150169551372528, 0.012391045689582825, 0.015673557296395302, 0.014644701033830643, -0.049924664199352264, -0.004347776994109154, 0.00883459486067295, 0.006648808252066374, -0.007106627803295851, -0.0008242742624133825, 0.02654191665351391, -0.00885491631925106, 0.042249929159879684, 0.037769950926303864, -0.05000601336359978, -0.04967797175049782, 0.019551895558834076, 0.06651871651411057, -0.023131195455789566, -0.004915367811918259, 0.012397394515573978, 0.020786534994840622, 0.00003372430364834145, 0.010305671021342278, -0.03720631077885628, -0.04100349545478821, -0.018236206844449043, -0.007341552060097456, 0.04803477227687836, 0.061807215213775635, -0.018062733113765717, 0.01423897035419941, 0.10132252424955368, -0.02628723531961441, -0.010526695288717747, -0.014907730743288994, -0.012692687101662159, -0.006238968577235937, -0.007809842936694622, -0.032148655503988266, -0.01409233920276165, 0.006747519131749868, -0.0237420704215765, -0.0014052973128855228, -0.05798136815428734, -0.023061182349920273, 0.004535723477602005, -0.03144508972764015, 0.003472620155662298, 0.08808264136314392, 0.06257440894842148, 0.03840477764606476, -0.0047366442158818245, 0.051800865679979324, 0.018174871802330017, 0.014776085503399372, 0.033421631902456284, 0.013477829284965992, -0.036737825721502304, -0.023468630388379097, 0.028836172074079514, 0.004770899657160044, -0.05903356149792671, -0.031923871487379074, 0.009980237111449242, -0.041929394006729126, -0.002784629352390766, -0.015474444255232811, -0.020499173551797867, -0.0380856990814209, -0.07957768440246582, -0.013528700917959213, 0.002982162171974778, 0.02096600830554962, 0.007227336522191763, 0.05607902631163597, 0.02521483227610588, -0.050970159471035004, 0.013868681155145168, -0.019474506378173828, -0.04190439730882645, 0.019270574674010277, 0.04524403437972069, -0.001937337452545762, -0.0027662275824695826, -0.011554977856576443, 0.07425779849290848, -0.037516940385103226, 0.009439336135983467, 0.06588540226221085, -0.02296147122979164, 0.022464364767074585, 0.04069533944129944, 0.04638361185789108, -0.015311263501644135, 0.0070095849223434925, 0.02747364342212677, -0.017461301758885384, -0.014674481004476547, -0.04912281408905983, -0.008453121408820152, 0.026261912658810616, 0.010190247558057308, -0.03588110953569412, -0.024034379050135612, 0.00010437398304929957, -0.021403975784778595, -0.0498499721288681, -0.003353958250954747, 0.08293276280164719, -0.002582029439508915, 0.008709498681128025, 0.027946986258029938, -0.030657244846224785, -0.02810560166835785, 0.018966875970363617, -0.05161723122000694, 0.039156436920166016, -0.0009578095050528646, 0.018141871318221092, 0.030346296727657318, -0.003714760299772024, -0.016651954501867294, -0.04674502834677696, 1.961497559932468e-7, -0.04812644422054291, -0.028941795229911804, 0.00012567148951347917, 0.08962228149175644, -0.01302421372383833, 0.02024025097489357, 0.008327416144311428, 0.0030588950030505657, -0.06729455292224884, -0.02476978860795498, 0.01924586296081543, 0.015890708193182945, -0.028302514925599098, 0.01562476996332407, 0.0016947932308539748, 0.0019040947081521153, -0.042781904339790344, -0.024247558787465096, -0.016512490808963776, 0.025407420471310616, 0.07807910442352295, -0.0015104785561561584, 0.04398012533783913, -0.002423324855044484, -0.01283898763358593, -0.0042922236025333405, 0.0026717388536781073, 0.03231419250369072, -0.017253786325454712, 0.014968437142670155, -0.05160750821232796, -0.05538301542401314, -0.02800077758729458, -0.015321601182222366, 0.026458319276571274, 0.028474805876612663, 0.010952411219477654, -0.00006250391015782952, 0.03508760407567024, -0.015583528205752373, 0.02168331854045391, 0.050569649785757065, -0.03164413571357727, -0.012561473995447159, 0.012916695326566696, 0.05818023905158043, -0.012691213749349117, 0.020960649475455284, 0.009591054171323776, -0.05985759198665619, 0.012757271528244019, 0.013789855875074863, 0.01126484852284193, -0.037266384810209274, -0.03462695702910423, 0.008398180827498436, 0.03682134300470352, 0.026508616283535957, 0.02389419451355934, 0.10106372088193893, 0.017043696716427803, 0.015064241364598274, 0.05029449239373207, 0.060765646398067474, -0.01964319311082363, 0.04998759925365448, -0.021691039204597473, 1.854176919734704e-34, 0.0172807015478611, -0.04977196082472801, -0.02607148140668869, 0.012715054675936699, -0.012562754563987255, -0.007950191386044025, -0.038840971887111664, 0.005976514890789986, 0.006957411766052246, -0.0010490483837202191, -0.021391162648797035]::vector(768));

Here is the code in which we loop over the user's liked products to get the average embedding.

const embeddings = [];
productsLiked.forEach((p) => {
  embeddings.push(JSON.parse(p.Embedding.embedding));
});

const embedding = getAverageEmbedding(embeddings);

And then immediately following this, we have an example of querying the vector database for the movies based on similarity above a threshold, ordered by most similar descending.


const threshold = 0.1;
const limit = 100;

const results = await db.sequelize.query(
  `SELECT id, products_id, description,
          1 - (embedding <=> ARRAY[${embedding.join(", ")}]::vector(768)) AS similarity
   FROM embeddings
   WHERE (1 - (embedding <=> ARRAY[${embedding.join(", ")}]::vector(768))) > ${threshold}
   ORDER BY similarity DESC
     LIMIT ${limit}`,
);

In this example I set a very low threshold because I wanted it to return as many as possible.

Okay...but what about comparing one user with another. That is, perhaps User A and User B have many similar things in common but User B has watched and liked movies that User A hasn't yet...

Hmm...we've not explored that yet but it should be do-able too.

For example, we could get a few details about each user and then get embeddings of those details just like we did for the movie descriptions. We could then persist those embeddings in a vector database and then query users with similar preferences to our user. And we could then look at their purchase history and recommend movies that our user hasn't yet watched.

We use cookies to give you the best possible browsing experience. By continuing to use this website, you agree to our use of cookies. You can view our Data Protection Policy, or by following the link at the bottom of any page on our site.