在大语言模型使用的过程中,发现有时候会一本正经的胡说八道。那么有没有什么办法,让它可以优化。这时候可以应用到向量数据库。
首先先解释向量嵌入,我们可以把文本、图像、视频编码成数值向量,简单来说这个高维向量为一个数字组成的数组,例如OpenAI的embeddings接口,可以把文本转为1536长度的向量。
[-0.009671681,-0.028155744,0.03398191,-0.025132963,-0.03936929,0.021756712,-0.041611996,0.005670762,-0.025620509,-0.01142075,0.0033366384,0.014406965,0.0041289,0.0061430717,0.007751971,-0.00023025091,0.024218816,-0.016552165,0.017588198,-0.029130835,0.012426312,-0.008007932,-0.016990956,-0.023511875,-0.0061887787,0.0190874,0.012993084,-0.00976919,-0.009720435,-0.01293214,0.036955938,0.0016454656,-0.019879662,-0.0047688033,-0.0070267473,-0.00803231,0.0016088997,0.013736591,0.006703749,0.0016028053,0.034225684,-0.0007907376,-0.0045250305,0.017393181,-0.027887594,-0.011676711,-0.011012431,-0.0041045225,-0.013748779,0.010086095,0.0047809915,0.012590859,-0.011256203,-0.0051832167,0.00165156,-0.015686773,-0.021269167,0.007812914,-0.042587087,-0.012456784,0.00026738815,0.024243193,-0.018685175,-0.0049303025,-0.018575478,0.023048706,-0.008245611,-0.008422346,0.012286143,-0.0008615841,-0.006764692,0.0109636765,0.0061887787,0.010415188,0.0228415,-0.00945838,-0.027668199,0.0026190327,-0.020635357,0.008379686,0.02783884,-0.031544186,-0.020415962,0.0101836035,0.008483289,0.048681404,-0.01658873,0.02954525,-0.020318452,-0.03139792,-0.002291463,0.019318985,0.010866167,0.0021360582,0.014346022,0.01890457,-0.041904524,0.014943265,0.0030898186,0.009860605,-0.0011990569,-0.023804402,-0.028765175,-0.00008184477,-0.0041441354,0.022171125,0.0070450306,-0.03471323,0.019209288,-0.01928242,-0.019782152,0.019063024,0.03320184,-0.02569364,-0.020708488,0.012554293,0.022768369,-0.023889722,-0.043050256,0.009970303,0.03407942,-0.0063502784,0.015991488,-0.030081548,0.026741862,-0.0007777872,-0.01990404,0.00070846436,0.024694173,-0.0005797219,0.0330312,0.0049699154,0.008282177,0.036102735,-0.021464184,0.020732867,-0.025376735,-0.012676179,-0.022378331,-0.019075213,0.00013626512,0.027960727,0.0042599277,-0.0060821283,0.014065684,0.0014801573,0.030715358,0.0036474487,0.003085248,-0.009409625,-0.0014900605,-0.020781621,0.027911972,0.024170062,-0.0034859492,0.0060303267,-0.034128174,-0.0013262758,0.014553229,0.0024681983,-0.0044275215,0.0298134,0.03961306,-0.021805467,-0.02810699,0.03344561,0.011048997,0.0062162033,0.011408562,-0.00006818017,0.0069718985,0.022536784,-0.0061796373,0.0017764934,0.0010939299,0.014614172,0.0064843534,-0.0041258526,-0.013468441,-0.01588179,-0.059821814,-0.01284682,0.012438501,0.009964208,-0.015430811,-0.010640677,-0.016186506,-0.019063024,-0.0003189994,-0.020891318,0.012590859,0.017758839,0.008001838,-0.01480919,-0.60806656,0.0011289723,-0.008007932,0.008550326,0.00559763,0.021281354,-0.0018252479,0.0265956,-0.0057225637,-0.043415915,-0.0029069893,0.028765175,0.0072522373,-0.015394244,0.0009613785,-0.01909959,-0.016564354,0.004631681,-0.0018968561,-0.003979589,0.00821514,0.01685688,0.0038394197,-0.005420895,0.034640096,-0.005366046,-0.012481161,-0.013602516,-0.03025219,0.0062954295,-0.020684112,0.011944861,-0.008983023,0.029325854,0.0590905,-0.019294608,-0.012919952,0.033226214,-0.0037937122,0.00045821647,0.003997872,-0.02676624,0.02382878,-0.0010939299,0.004211173,-0.0014999638,0.0014230231,-0.008111536,0.017125031,0.00003751814,0.004275163,-0.0034371947,-0.021902975,-0.010975865,0.0030547765,-0.010591923,0.021378864,-0.035127643,-0.030666603,0.00075036276,0.007343652,-0.009312117,-0.022463653,-0.012724934,0.015430811,0.019672455,-0.026034921,-0.0026784523,-0.0048358403,0.014931076,0.0046499637,-0.006862201,0.0073375576,-0.0010908827,0.02703439,0.013517195,0.021963919,0.020476906,-0.018417027,-0.00669156,-0.00025615175,-0.009933737,0.017149407,-0.01463855,0.028155744,-0.023926288,-0.013419686,0.0056250547,0.03622462,-0.022719614,0.0069170496,0.023402177,0.01578428,0.0060638455,-0.015528319,0.010610206,-0.018526724,-0.01945306,0.024377268,-0.023938477,0.006673277,0.00072293833,0.038784232,0.02559613,-0.008489383,0.0060059493,-0.0070998794,0.011268392,0.012895575,-0.018356083,0.024340702,-0.016028054,0.016393712,-0.0074716327,-0.0076057077,-0.019294608,0.0099276425,0.030081548,0.02998404,-0.008745345,-0.0007442685,-0.0033579688,0.0341038,-0.01686907,0.018612044,0.034420703,-0.035030134,-0.005500121,-0.011591391,0.0050674244,0.0015258646,0.0025459009,0.017259106,-0.041124452,0.014163192,-0.009263362,-0.0037998066,-0.022061428,0.02320716,0.0060089966,-0.0041228053,0.008769722,0.013882854,0.0011853446,0.010421282,0.008867231,0.0053020557,-0.01650341,-0.020013737,0.020403773,0.015516131,-0.010598017,0.015101718,0.013614704,0.01928242,0.0014382588,-0.005262443,-0.018002613,-0.012316614,-0.006569674,0.011621863,0.0016820314,-0.0069109555,-0.01302965,-0.003092866,-0.0122251995,0.023780026,0.0055610645,-0.0010581258,-0.006002902,0.008391875,-0.010329868,-0.028935816,-0.0072400486,-0.024828248,-0.011890013,0.0034463364,-0.024182249,-0.0085625155,-0.015674584,0.010226264,-0.0022579446,-0.023438742,0.001202104,0.015235793,0.0197334,-0.004500653,0.033860024,-0.020147812,0.0059937607,-0.018002613,-0.0064355987,-0.009086627,0.010549263,0.014845756,0.0025900847,0.019867474,0.017856348,0.011950956,0.022902444,0.011835163,0.012993084,0.018928949,-0.007745877,0.017746652,-0.018039178,-0.010786941,0.003208658,0.034591343,0.00856861,-0.0036047886,-0.014955454,-0.0024758163,-0.0048145102,-0.013687836,0.011024619,-0.00035099458,0.023524063,0.008995212,0.020050302,0.0058810157,-0.0003595647,-0.009062249,-0.018161064,-0.05255739,-0.00964121,0.007514293,0.024657607,0.0079348,-0.0066245226,-0.04041751,-0.008690496,0.0036291657,0.01658873,-0.02017219,-0.028350763,0.0071973884,-0.018026989,0.009171947,0.0030684886,-0.010402999,0.022256445,0.005957195,-0.019233664,0.023219347,0.028960194,0.031982977,0.021183847,-0.0068561067,0.044122856,-0.012219106,0.01757601,-0.020099057,-0.024267571,0.0026373158,-0.016966578,-0.010360339,0.014163192,0.01856329,0.0036230714,0.010933205,0.021707958,-0.0062771463,-0.0079348,0.020294076,0.010835696,0.0085625155,-0.03824793,-0.009580267,-0.0032696011,0.0039155986,0.018782685,0.002564184,0.006825635,0.025303604,-0.016125564,-0.0001611185,-0.0020446433,0.024157872,0.0066976543,-0.022768369,-0.030349698,-0.0042385976,0.020720677,0.017990423,-0.035395794,0.0032909312,0.017417558,-0.014297267,0.01578428,0.0064112213,0.0033518744,-0.010853979,-0.0037723822,-0.00976919,0.020135622,0.025913035,-0.01571115,-0.008209045,0.008269988,0.017844161,0.0012531439,0.009549795,-0.02837514,0.017831972,-0.005116179,-0.012980895,-0.010634583,0.013809722,-0.054215044,-0.012590859,-0.002785103,-0.026912503,-0.031178527,-0.021074148,0.015638018,-0.0037419107,-0.016966578,0.027473181,-0.018928949,-0.020903507,-0.010957582,-0.041782636,-0.015686773,0.0381748,0.023597196,-0.012316614,-0.013249045,-0.01605243,-0.014053495,-0.023658138,-0.030398453,-0.00852595,0.0035286096,0.009982491,-0.0059358645,-0.011713278,0.009293834,-0.016271826,0.015455188,0.0010657437,-0.023621572,0.013309988,0.0037754294,-0.010244546,0.03130041,0.02480387,0.01606462,-0.007550859,0.020550037,0.006459976,0.027083145,0.014467908,-0.022110183,0.014675115,0.017771028,-0.012822443,-0.008410158,-0.019233664,0.018538913,-0.004116711,0.026814995,0.003092866,0.014772625,0.057335336,0.051338527,0.0029892626,-0.014528852,0.00586578,-0.008391875,0.01945306,0.014918888,0.0039095045,0.003248271,0.018575478,0.016308391,-0.032446142,-0.008848948,0.0013856953,0.0053142444,-0.03266554,-0.024596663,0.021366674,0.015382056,-0.008635648,-0.024060363,0.007636179,-0.03963744,0.016734995,-0.043659687,-0.006307618,-0.023329046,-0.025718018,-0.0063929386,0.021781089,-0.011926578,0.013309988,-0.024486966,0.02532798,0.0142363245,0.016734995,0.009665587,-0.01970902,0.028765175,0.0019136155,-0.008891609,0.018794874,-0.018368272,-0.039954342,0.0249867,-0.021196034,-0.000495925,-0.0015212939,-0.0016165175,0.04504919,0.015723338,0.006752503,-0.0064355987,-0.013943797,0.000028329052,-0.03293369,0.006307618,-0.023767836,0.006264958,0.0062405807,-0.032811802,-0.012054559,-0.008964741,-0.008727062,0.01953838,0.019148344,0.02854578,-0.018758308,-0.0029725032,0.0330312,-0.031105394,0.00555497,-0.007441161,0.019794341,0.038418576,-0.0018663845,0.04068566,-0.0057012336,-0.018026989,0.0032970256,-0.039052382,0.040368754,0.010561451,-0.031105394,0.0015829988,-0.015162661,-0.010750375,-0.0050643776,0.02881393,-0.0008433011,0.005518404,0.0060150907,-0.015028586,-0.038662348,-0.001542624,-0.010073906,0.013943797,0.010159226,0.0055793473,-0.015516131,0.0019837,0.0027333011,0.0074106893,0.030300943,-0.04175826,0.016198695,-0.004534172,0.0021284402,0.026668731,0.00289023,-0.008477195,-0.021707958,0.0005206832,0.016491221,-0.05738409,-0.012505539,-0.021988295,-0.012072842,0.0069718985,0.017612576,-0.00642341,-0.0054909796,-0.0014550182,0.0014009312,0.009440097,-0.017600387,-0.0074350666,-0.023621572,0.031812336,0.028838309,0.015052963,-0.016479034,0.02525485,-0.009336494,0.0029679323,0.01579647,-0.012468972,-0.015455188,-0.028570158,0.006594051,-0.021890787,-0.01022017,-0.005164934,0.012036276,-0.015820846,-0.0010977389,0.007459444,0.0037022976,-0.007398501,-0.007264426,-0.03988121,0.00075912336,-0.022622105,0.031909842,-0.019258041,-0.010134849,0.014979831,0.021793278,0.035444546,0.01445572,0.028570158,0.021549504,-0.015321113,-0.023889722,0.009696058,-0.0117742205,-0.010671149,0.003479855,-0.004266022,-0.006709843,-0.015942734,-0.004765756,-0.025059832,-0.007398501,-0.0023691657,-0.03488387,-0.0022350908,0.015260169,0.00012102933,-0.03276305,0.0228415,0.02730254,-0.0038698914,0.03919865,0.025620509,-0.017551633,-0.011652334,-0.051777318,0.0031995163,-0.010658961,0.013090593,0.030715358,0.007282709,-0.023182781,0.00012902812,0.017125031,-0.010342056,-0.016966578,0.01936774,0.013444063,-0.016308391,0.001969988,-0.00045174125,0.006185732,0.009208513,-0.0026205564,-0.017612576,-0.02542549,-0.009817945,0.0029450788,-0.014845756,-0.0265956,0.028521404,0.014553229,-0.013943797,0.0039308346,-0.027058767,0.00811763,0.030983508,0.01846578,0.01480919,0.0009103386,-0.012054559,0.00073169894,0.020220945,-0.02480387,-0.0134562515,-0.013163725,0.03739473,-0.00053706166,0.007751971,0.006520919,-0.0034158647,0.02649809,0.036005225,0.007166917,-0.0059236763,-0.010738187,-0.0011739178,0.014955454,0.0011457315,-0.026351826,0.0019684643,-0.015735526,-0.01970902,-0.010701621,0.0037022976,-0.0049729627,-0.0026860703,-0.03973495,-0.028448272,-0.0042599277,0.014894511,-0.0027454898,0.008989117,0.0049363966,0.0056646676,-0.012200823,0.009074438,0.007886047,0.0014070254,-0.012450689,0.028399518,0.006173543,-0.010019057,0.0034829022,-0.015321113,-0.015321113,-0.021098526,0.0073741237,-0.010055623,-0.0027409191,-0.0032452238,0.038930498,0.0035865055,0.008172479,0.000047516627,-0.01998936,0.001346844,-0.020001547,0.0013529384,-0.00834312,-0.0154064335,0.008178573,0.0055092624,0.0137853455,-0.00003751814,-0.012798065,-0.03914989,-0.022780556,-0.008513761,0.007264426,-0.01249335,-0.023268102,-0.0047048125,-0.011786409,0.020391585,-0.015747715,0.007575236,0.03166607,0.01365127,-0.006862201,-0.0064112213,0.020708488,-0.01643028,-0.002204619,-0.016930012,-0.022731801,-0.008379686,-0.0156014515,0.016734995,0.014528852,-0.029862152,-0.015723338,0.008440629,-0.0032208464,-0.01953838,0.0020339782,0.022012673,0.008891609,-0.002701306,-0.031129772,-0.010019057,0.020550037,0.00053287187,-0.00927555,-0.015442999,-0.0005534402,-0.013602516,0.0009179565,-0.0031385731,-0.015187038,-0.005210641,-0.0027576785,-0.003939976,0.009775285,0.013895043,-0.009775285,-0.0053538573,-0.010713809,-0.01935555,-0.015308924,0.015564886,0.0012478114,-0.014687304,-0.025888659,-0.0053020557,0.00041327087,-0.021208223,0.0058474974,0.013054027,-0.003961306,0.009214607,-0.008404063,-0.025449868,-0.019465249,-0.010177509,-0.018880194,-0.018807063,0.012542104,0.020281887,-0.02525485,0.018246384,-0.012206917,-0.0046438696,-0.008251705,-0.00013169438,0.0053416686,-0.005807884,0.015442999,0.0018313422,0.0063746558,-0.007075502,-0.0013011367,0.0057073277,-0.012798065,-0.016893446,0.023962853,0.0061186943,-0.013102782,-0.00031404776,0.008129819,-0.005884063,-0.017783217,-0.014748247,0.034761984,-0.018124498,-0.009111004,0.010171415,0.0044671344,-0.024828248,0.013895043,0.009610738,0.017368803,0.0043726726,0.30383825,0.0012790448,0.004323918,0.016479034,-0.0054117534,0.013505006,0.01293214,0.00470786,0.006886578,-0.008574704,-0.0013262758,0.0015510037,0.004339154,0.011097752,-0.0042172675,-0.043659687,-0.026083676,-0.0020766384,-0.012280049,-0.036517147,-0.006557485,-0.010457848,-0.009330399,-0.03300682,0.018063556,0.0058871103,-0.03344561,-0.024755115,0.005960242,0.0037419107,-0.015089529,-0.00042317415,0.022963386,0.0010451754,0.00042812576,-0.004512842,0.010360339,-0.00024434403,0.009842322,0.0077946316,0.008976929,-0.031519808,-0.0121947285,-0.0037419107,-0.03256803,-0.006319807,0.0032574125,-0.01613775,-0.0073314635,0.034128174,-0.014346022,-0.032982443,0.03953993,0.029130835,0.0018328659,0.0030075454,0.02195173,-0.009427909,-0.008714873,0.00078083435,0.029642757,0.009720435,-0.00008379686,0.029033326,-0.026034921,0.013858477,-0.03210486,0.026790617,0.004695671,-0.0027241597,-0.002582467,0.016539976,0.011274487,-0.0047200485,-0.02586428,-0.005725611,0.030837243,0.021659203,0.014504475,0.011798598,-0.011432938,0.022865877,0.004689577,-0.00063571346,-0.0052167354,-0.011201355,-0.010701621,-0.020781621,-0.0066367113,-0.008617364,-0.006283241,-0.006575768,0.0069536157,0.0197334,-0.010677244,0.009897171,-0.011938767,0.02265867,0.01588179,0.019696832,-0.010427376,-0.008318743,0.00999468,0.033518743,-0.022024862,-0.004302588,-0.028789554,-0.0030943893,0.009860605,-0.019672455,-0.020708488,-0.037443485,0.010366433,0.008635648,-0.002582467,0.0067159375,0.0026875937,-0.014041306,-0.01008,-0.0041593714,0.023499686,-0.023950666,-0.0036779202,0.04068566,0.0031507618,-0.010463942,0.000041517535,-0.00798965,0.010299396,-0.03963744,0.0217689,-0.019245854,0.026912503,-0.022902444,-0.00660624,-0.0016591778,0.028399518,-0.010494414,-0.016259639,-0.0028734705,0.017636953,-0.018356083,-0.009111004,-0.009111004,0.035639565,-0.021671392,0.015686773,0.0024438212,0.03780914,-0.013419686,-0.027643822,-0.031909842,0.013139348,0.0012340992,0.02025751,-0.020379396,-0.025547376,-0.0054818382,-0.010658961,0.013760968,0.0014656832,-0.00042850667,0.036078356,-0.034518212,0.009507135,0.022427086,-0.1494814,0.021183847,0.018794874,-0.03739473,0.019940605,0.011975333,0.00646607,-0.012072842,-0.008276083,0.03659028,0.028618913,-0.00669156,-0.008879419,0.007502104,-0.017393181,0.0059175817,-0.0095376065,-0.027131898,0.023694705,0.01110994,0.01605243,-0.009330399,-0.024231004,0.016759371,0.015040774,0.03317746,-0.0030791536,0.029642757,-0.008038404,0.0069292383,-0.00040184404,0.0013247521,-0.006109553,0.0039704475,0.013334366,0.012298332,0.0045433133,-0.0023432649,0.0002904323,0.0040070135,0.013407498,0.034908246,0.0025946554,0.017722273,-0.005359952,0.00095528417,0.02265867,0.0011373519,0.014029117,-0.0165156,-0.0024560099,-0.042318936,0.03595647,-0.0077702543,0.006612334,0.02515734,0.0024499155,0.03364063,0.011164789,-0.0018267715,-0.009708247,-0.01998936,-0.003540798,0.012438501,-0.022804935,-0.012188634,0.0059145344,0.006789069,-0.018222008,0.02347531,0.005198452,-0.0322755,0.0317392,-0.0019029505,-0.006213156,0.017600387,-0.0051893108,0.02686375,0.007264426,0.016661862,-0.008873326,0.035737075,-0.017198162,0.013578138,0.00022472793,0.019379929,0.008050593,-0.0075691417,-0.011140412,-0.02559613,0.009452285,-0.019562757,-0.0046073035,-0.0082578,-0.0028475695,0.005207594,-0.010098283,-0.00089738815,-0.008976929,0.0030974366,0.012859009,-0.03256803,-0.00070084643,0.0077214995,0.011640145,-0.011652334,0.008087158,0.00923289,0.01695439,-0.010329868,-0.0392474,-0.001980653,0.021573883,0.026644355,0.019404305,0.028180122,-0.012109408,-0.022024862,0.024182249,0.0033610158,-0.0095680775,-0.0036230714,0.0023280291,0.015747715,-0.012298332,-0.008989117,-0.035761453,-0.0056220074,0.020355018,0.017246917,0.004464087,0.029667135,0.009610738,0.0014976783,-0.010719904,0.002759202,-0.013748779,-0.012377557,-0.015016397,0.007502104,-0.022463653,-0.042343315,-0.009287739,-0.018234197,-0.024109118,0.024694173,0.00865393,-0.023036519,0.028862685,0.001553289,0.0019684643,0.016259639,-0.021842033,0.034859493,0.017722273,0.026814995,0.006289335,-0.03203173,-0.008001838,-0.0070450306,-0.028740799,-0.011268392,-0.054751344,-0.0052807257,0.015321113,-0.030276567,-0.0045646434,0.015564886,0.014090061,-0.041855767,-0.014309457,-0.005073519,-0.021330109,0.023877533,0.006703749,-0.017356616,-0.012871197,-0.0029846916,-0.01365127,-0.008946457,0.033884402,-0.009214607,0.029740267,0.032519277,-0.014772625,-0.019696832,-0.00753867,-0.0055732527,-0.0011487787,0.011908296,0.010500508,0.01156092,-0.0133953085,-0.002922225,0.028399518,-0.018770495,-0.020757243,0.026936881,-0.0056646676,-0.016527787,-0.038223557,-0.005975478,-0.0031446675,0.0046987184,0.013370931,-0.038954873,0.0024422975,-0.0070023704,0.0014900605,-0.020099057,-0.0111526,-0.010488319,-0.006801258,-0.01891676,-0.0056829504,-0.0049912455,-0.048413254,0.020732867,0.01257867,-0.025230473,-0.012255671,-0.022414898,-0.022195503,0.016832504,0.025815526,-0.014650738,0.031081017,-0.02285369,-0.06986525,0.03200735,0.008629553,-0.020964451,0.0076057077,-0.0116096735,0.013517195,-0.01757601,-0.0067159375,-0.0050826604,-0.0054330835,0.0013277993,0.0050095287,0.0013986457,-0.012822443,-0.026376205,0.020537848,0.005558017,0.034055043,0.02193954,-0.017125031,-0.009153664,-0.01749069,0.011000242,-0.008538138,0.017125031,-0.02579115,0.01685688,-0.010500508,0.016990956,0.035615187,-0.05284992,0.008349215,0.007398501,0.0060486095,-0.032787424,0.028960194,0.021025393,0.0056829504,0.017356616,0.0016850786,-0.019843096,0.037224088,-0.0011906772,-0.010067811,0.022890255,-0.020647546,0.013955986,0.05231362,-0.022378331,0.021305732,0.009580267,-0.01311497,-0.019123966,-0.017076276,-0.021902975,0.015930545,-0.012919952,-0.0041807014,-0.0067707864,0.022268634,0.017368803,0.0035499397,0.008836759,0.04495168,-0.00061362155,0.028862685,0.0035773641,0.019757776,-0.017478501,-0.013687836,-0.0063990327,0.01935555,-0.0062314393,-0.0142363245,0.014797002,0.010500508,-0.0059663365,-0.023987232,0.026205564,0.008647836,-0.007422878,0.005731705,-0.008391875,0.012060653,0.025474245,-0.01945306,0.0058535915,-0.01499202,0.014857945,-0.016003676,0.0033610158,0.00004937349,-0.0033305443,0.0055244984,0.028862685,-0.0025809433,-0.011944861,-0.011213543,0.021671392,-0.005402612,-0.0041867956,-0.014211947,-0.034835115,-0.011097752,0.02596179,-0.027156277,-0.027497558,-0.03897925,0.02944774,0.016259639,-0.010256736,-0.0034737608,0.01749069,0.00861127,-0.036809675,0.017332237,-0.019050835,-0.024608852,0.027131898,0.0014702539,0.01571115,0.008434535,-0.024389457,0.0387111,-0.01173156,0.0037449577,-0.011676711,0.0196237,0.013639081,-0.0142363245,-0.016296204,-0.01463855,-0.03212924,-0.008623458,-0.0013773156,-0.016759371,0.029642757,-0.007898235,0.005366046,0.0032025636,-0.02649809,0.014577606,0.04987589,0.013602516,0.0029176543,0.002462104,-0.035347037,0.00064752117,0.0029526965,-0.030495962,0.016296204,-0.009427909,-0.011055091,-0.014662927,0.00053287187,-0.003805901,-0.015564886,-0.009939831,0.022317389,0.008617364,0.006575768,0.008751439,-0.017076276,0.015808659,0.017246917,0.009720435,0.0024940993,0.004016155,0.023511875,-0.015772093,-0.037175335,-0.014492285,0.031276036,0.006246675,0.002625127,-0.007575236,0.033689383,0.037175335,-0.004905925,0.003208658,-0.012481161,0.00291156,0.033323724,-0.009933737,-0.0004764994,0.008001838,-0.004208126]
这时我们可以应用向量数据库,把向量存储到向量数据库中,当我们搜索文本时,可以把文本转为向量数据,再去向量数据库中搜索,查找到相似度高的向量。
下面我们就来介绍下如何本地搭建向量数据库。
这里我们使用docker的方式,搭建本地向量数据库。
下载链接:https://docs.docker.com/desktop/install/windows-install/
安装完成后,开始菜单可以看到docker。
下载 YAML文件
wget https://github.com/milvus-io/milvus/releases/download/v2.3.0/milvus-standalone-docker-compose.yml -O docker-compose.yml
启动Milvus
docker compose up -d
docker compose ps
下载链接:https://github.com/zilliztech/attu/releases/tag/v2.2.8
安装完成后,启动Attu链接数据库。
无需输入密码,直接点解链接
如下图,我自己程序上建立了几个集合。
这样我们的本地数据库Milvus就搭建好了。下面我们来看看如何程序来链接数据库,并结合ChatGPT来使用向量数据库。关注公众号:科技探幽,回复milvus,查看更多文章。