Skip to content

Add the tanuki_bot model

Dmitry Gruzd requested to merge add-tanuki-bot-model into master

Background

This is part of a series of MRs and should be reviewed and merged in this order

MR status
Add support for the embedding database (!118156 - merged) (db setup) merged
Add the tanuki_bot model (!118195 - merged) (migration) merged
Create initial Tanuki bot api endpoint (!117695 - merged) (api) in review

What does this MR do and why?

Related: https://gitlab.com/gitlab-org/enablement-section/tanuki-bot/-/issues/2

  • Adds database migration for tanuki_bot_mvc table
  • Adds model for new table
  • Add new gem neighbor to allow ActiveRecord to interact with pgvector data structures
  • Setup pgvector and support for embedding database in CI

Context

We need the pgvector extension installed and enabled for this new database. It is needed for AI experimentation features that require storing and searching embeddings. We don't want to make it a dependency for the main DB on GitLab.com and for self-managed customers.

Gemfile changes

Legal and compliance issue: https://gitlab.com/gitlab-com/legal-and-compliance/-/issues/1479+

gem: https://github.com/ankane/neighbor

From the guidelines

  • They have an active developer community. At the minimum a maintainer should still be active to merge change requests in case of emergencies.
  • There are no issues open that we know may impact the availability or performance of GitLab.
  • The project is tested using some form of test automation. The test suite must be passing using the Ruby version currently used by GitLab. - pipeline: https://github.com/ankane/neighbor/actions/runs/4585609385
  • CI builds for all supported platforms must succeed using the new dependency. For more information, see how to build a package for testing.
  • [-] If the project uses a C extension, consider requesting an additional review from a C or MRI domain expert. C extensions can greatly impact GitLab stability and performance.

Database

Migrations

The database testing pipeline does not support the new embedding database yet.

Up

 be rails db:migrate:up:embedding VERSION=20230420103900 RAILS_ENV=development
embedding: == [advisory_lock_connection] object_id: 273720, pg_backend_pid: 83667
embedding: == 20230420103900 CreateTanukiBotMvc: migrating ===============================
embedding: -- create_table(:tanuki_bot_mvc)
embedding: -- quote_column_name(:url)
embedding:    -> 0.0000s
embedding: -- quote_column_name(:content)
embedding:    -> 0.0000s
embedding: -- quote_column_name(:chroma_id)
embedding:    -> 0.0000s
embedding:    -> 0.0416s
embedding: == 20230420103900 CreateTanukiBotMvc: migrated (0.0423s) ======================

embedding: == [advisory_lock_connection] object_id: 273720, pg_backend_pid: 83667

Down

 be rails db:migrate:down:embedding VERSION=20230420103900 RAILS_ENV=development
embedding: == [advisory_lock_connection] object_id: 273760, pg_backend_pid: 82686
embedding: == 20230420103900 CreateTanukiBotMvc: reverting ===============================
embedding: -- drop_table(:tanuki_bot_mvc)
embedding:    -> 0.0065s
embedding: == 20230420103900 CreateTanukiBotMvc: reverted (0.0072s) ======================

embedding: == [advisory_lock_connection] object_id: 273760, pg_backend_pid: 82686

Query plan

This is a plan from the local database, which uses the dataset we're going to use in production for this MVC. We've experimented with indexing, but it is only an approximation and we had very inaccurate results. So currently we need to use sequential scans. The database node will be quite powerful with a lot of cache to handle these sequential reads.

gitlabhq_development_embedding=# SELECT COUNT(*) FROM tanuki_bot_mvc;                                                                                                             count                                                                                                                                                                                                                                        -------
 12742
(1 row)

This is the nearest neighbor search we're going to use:

Click to expand
EXPLAIN (ANALYZE) SELECT "tanuki_bot_mvc"."id" FROM "tanuki_bot_mvc" WHERE "tanuki_bot_mvc"."embedding" IS NOT NULL ORDER BY "tanuki_bot_mvc"."embedding" <#> '[-0.010012891, 0.007275803, -0.0071718628, -0.029491255, -0.033787444, 0.02913093, -0.03581081, -0.03181951, -0.035034724, -0.020746432, 0.020386107, 0.013269679, -0.020289097, -0.007691563, -0.000622341, -0.0044105225, 0.03913689, -0.027038269, 0.011038433, -0.005314801, -0.021882843, -0.000371
8022, 0.02974071, -0.016186928, -0.0023507774, 0.0028531542, 0.004455563, -0.023545884, -0.014579323, -0.016616547, 0.0166997, 0.015951332, -0.02306083, -0.034979288, -0.02683039, 0.024571426, 0.0030021349, -0.0017756424, 0.031376034, -0.008924985, 0.026858106, -0.0039427923, -0.0068219313, -0.019457577, -0.009444685, -0.008827974, -0.006045846, -0.03129288, 0.0029016596, 0.03298364, 0.01743421, 0.010941422, -0.0225342, -0.0018553297, -0.005138103, -0.0047881715, -0.0152861
16, 0.038360804, 0.008918055, 0.02160567, -0.011918458, -0.0021758114, -0.021730399, 0.005602368, 0.026428487, -0.004122955, -0.032373857, -0.0027145674, -0.02098203, -0.014115058, 0.01263218, 0.02734316, -0.016339375, -0.001831077, 0.009978244, -0.0059938757, -0.006752638, 0.0033589958, 0.00038457816, 0.0050688093, 0.009534767, -0.014787204, -0.008578518, -0.004791636, -0.0013910643, 0.020330673, 0.01169672, 0.01106615, -0.028881473, 0.0050757388, 0.0067664967, 0.01847361,
 0.047368944, 0.025430664, -0.031902663, -0.0035252997, -0.00039237365, 0.014011118, -0.007324308, -0.014551606, -0.008176616, 0.0029969378, -0.013983401, -0.0072203684, -0.012535169, 0.008183546, -0.013401336, 0.0054395287, 0.008211263, -0.0062190793, -0.009216017, 0.025375228, 0.02003964, -0.029463537, -0.0063611306, -0.021550236, -0.009708, -0.01377552, -0.014690192, -0.040217865, 0.024460556, -0.0014490974, 0.018224154, -0.010782047, 0.007975666, 0.0054672463, -0.025389
088, -0.011093867, -0.00803803, -0.029823862, 0.03486842, 0.028008377, 0.015050518, 0.028160822, -0.027800497, 0.020524694, -0.01900024, 0.0071787923, -0.033676572, -0.030128753, 0.012140197, 0.03181951, -0.011412617, -0.013623075, -0.012188702, 0.005436064, 0.01868149, 0.0025794455, 0.01054645, 0.013034081, 0.004185319, 0.0011312141, 0.011059221, 0.008100394, 0.010560309, 0.009112077, -0.00061281316, -0.008211263, -0.02775892, -0.01679671, -0.011308677, -0.013318184, 0.036
61461, -0.016159212, 0.014870355, 0.029075494, 0.005990411, 0.010324711, -0.02232632, -0.024488274, -0.04041189, 0.0037245182, -0.008204334, 0.009534767, -0.016062202, -0.00542567, 0.020399965, -0.0093823215, -0.016339375, 0.00022282147, 0.009063572, -0.022589635, 0.0014395696, 0.019707032, -0.022354038, -0.005682056, 0.0077469978, -0.013158809, -0.0023715652, -0.024599144, 0.010193054, 0.033759724, -0.002354242, -0.0009692409, -0.6559032, -0.032401577, 0.00097270554, -0.02
9602123, 0.03445266, 0.015812745, 0.012659897, 0.011828377, -0.012708402, -0.00043005194, -0.012348077, 0.013713156, -0.018958664, 0.025347512, 0.011876882, -0.025541533, 0.027828215, -0.015743451, 0.03181951, 0.009347674, -0.024488274, 0.011571991, 0.0032065504, 0.0010342035, -0.0023057365, -0.0017773748, 0.005332124, -0.03672548, -0.005436064, -0.005751349, -0.022825234, 0.035339613, 0.0097565055, 0.005138103, 0.04393199, -0.011558132, 0.006354201, 0.017060025, -0.0035720
728, 0.027481748, -0.020025782, -0.021730399, 0.01189767, -0.025749413, -0.0011623962, 0.01064346, 0.013505276, -0.0011935781, 0.0177391, -0.014288291, 0.00041142933, 0.012147127, -0.01356764, -0.002044154, 0.01919426, -0.0012689347, 0.023019254, -0.0076984926, 0.003220409, 0.007975666, 0.0046287966, 0.01836274, -0.037834175, -0.015992908, -0.016159212, 0.005127709, -0.0038145995, 0.005501893, 0.020095075, -0.022645071, 0.025901858, 0.003116469, -0.004632261, 0.016976874, 0
.005415276, -0.008024171, 0.027634192, 0.02118991, -0.01200161, -0.0070713875, 0.008114252, -0.0011909796, -0.0029207151, 0.00652397, 0.020219803, 0.0028098458, -0.036780916, -0.020053498, 0.028521148, 0.01650568, 0.0075391177, 0.009805011, -0.0034508095, -0.015577148, -0.0151059525, 0.011114655, 0.020122793, 0.008952702, 0.00981887, -0.014856497, -0.023185559, -0.020524694, 0.011883811, 0.004413987, 0.0040640556, 0.0028981948, 0.009888163, 0.0016621745, 0.030877123, -0.011
253241, -0.0077955034, 0.0045387154, -0.009479332, -0.010407863, -0.02066328, -0.023573602, -0.017309481, -0.009943597, -0.0007704556, -0.018293448, 0.026664086, -0.009313027, -0.0015668961, -0.020053498, 0.012188702, -0.0003479826, 0.001420514, -0.0070402054, -0.03472983, -0.015355409, 0.0032793083, -0.022367897, -0.0021047858, -0.0052004666, 0.02077415, 0.00928531, -0.007064458, 0.0053286594, -0.0030107966, -0.02902006, -0.0112809595, -0.00034040364, 0.0147456275, -0.0089
66561, -0.020788008, 0.00053485815, -0.0143437255, 0.008031101, -0.046481986, -0.006828861, -0.021619529, 0.0038527108, -0.0204554, 0.044846665, -0.01596519, -0.009694141, 0.0036933362, -0.019374425, -0.01743421, 0.00018092063, 0.010324711, 0.014038835, -0.008329062, -0.002567319, -0.0020199015, -0.010442509, -0.034979288, 0.027065987, -0.019471435, -0.02965756, 0.007525259, -0.01179373, -0.015826603, 0.04456949, -0.0001568845, 0.008419143, -0.014523889, -0.022464909, 0.004
4728867, -3.9356462e-05, 0.015604865, 0.014676334, -0.0077262097, 0.0022017965, -0.006198291, 0.011994681, 0.0018484005, 0.011086938, -0.007158004, 0.012285713, 0.0040432676, 0.019332848, 0.004375876, 0.0075737643, -0.017586656, -0.0058830064, -0.0007249818, 0.024751589, 0.0107474, 0.014856497, 0.025125774, -0.0037626296, 0.023185559, -0.009728788, 0.0077192807, -0.016519537, -0.0047743125, -0.021688823, 0.039441783, 0.00066608243, -0.0056196917, -0.04143743, 0.0067041325,
0.013297396, 0.017364915, 0.025749413, -0.014898073, 0.0045075333, -0.016588831, 0.0076569165, 0.01367158, -0.007504471, 0.003449077, -0.025818706, -0.01649182, 0.021813551, 0.018944805, 0.033316247, -0.0042511476, -0.015535572, 0.00406752, 0.009423898, -0.0058934004, 0.019027958, 0.034480378, 0.02087116, 0.017988557, 0.00072931265, 0.018820077, -0.023532026, -0.012722261, 0.02726001, 0.022284744, 0.012264925, 0.021855127, 0.0044728867, 0.04687003, 0.021425508, 0.0025361371
, 0.013921036, -0.023504307, -0.0150228, 0.012923212, 0.02222931, 0.01534155, 0.007109499, 0.004341229, -0.0027440172, 0.0012472805, 0.009680282, -0.0044001285, 0.0008666001, 0.008058818, 0.0030142611, 0.009507049, 0.006839255, 0.004216501, -0.0076153404, 0.02307469, -0.0033104904, -0.006295302, -0.010844411, 0.024585284, -0.03509016, 0.031265166, 0.0002613659, -0.007809362, -0.007158004, 0.0049128993, -0.002354242, -0.027592616, -0.045484163, 0.04332221, 0.005623156, -0.01
671356, -0.021868985, 0.010324711, -0.013740874, -0.029158646, 0.023573602, -0.00073321036, 0.008128111, -0.005051486, -0.02838256, 0.001296652, -0.008848762, 0.021938277, 0.005910724, -0.004673837, 0.013179597, 0.0109275635, -0.0029259122, 0.00960406, -0.023005396, 0.033260815, 7.297457e-05, -0.0132003855, -0.020330673, -0.007379743, -0.013796308, -0.014260574, -0.00542567, -0.010671178, -0.004791636, 0.006641769, 0.0073658843, 0.0011078276, 0.011814518, 0.03037821, 0.0139
76471, 0.0073312377, -0.02349045, 0.012590604, 0.015286116, 0.05981403, 0.003977439, -0.0025292076, -0.0039705094, -0.02882604, 0.001296652, -0.049614046, 0.025347512, 0.010719683, 0.0030852868, -0.011745225, 0.0076984926, 0.018529044, -0.01722633, -0.0027717345, 0.014565465, -0.006856578, -0.01534155, -0.022007572, -0.016852146, -0.0016240631, 0.01263218, 0.012299572, 0.012403511, 0.012202561, -0.004947546, 0.014759486, -0.034979288, -0.00678382, -0.017683666, -0.006045846
, 0.025666261, 2.517298e-05, -0.014177422, 0.012202561, 0.02568012, -0.004864394, -0.009174441, 0.008571588, 0.0064650704, 0.02755104, 0.019707032, 0.016200788, -0.009964385, 0.0069986293, -0.023920069, -0.0059349765, 0.016630407, 0.006596728, -0.013124162, -0.012244137, -0.0049614045, -0.033676572, 0.017323341, -0.00020214173, 0.015701875, -0.01679671, 0.009250664, -0.0076777046, -0.04978035, -0.0151059525, 0.0010549914, 0.015812745, 0.0020701392, -0.0054429937, -0.0408276
47, 0.0033676573, -0.01826573, 0.00292418, 0.025139632, 0.009610989, -0.016879862, -0.020524694, -0.014496171, 0.020801866, 0.0063888477, 0.009306098, 0.00459415, -0.0038804282, 0.021120617, 0.0023784947, -0.024446698, 0.004829747, -0.0045144623, -0.0010619208, -0.016228504, 0.009292239, -0.0072480855, 0.009846587, 0.032512445, -0.01900024, 0.0042719357, 0.0069882353, 0.0038665696, 0.004136814, -0.005127709, 0.023629036, 0.031597774, 0.0004885182, -0.023850774, -0.004413987
, -0.022672787, -0.011059221, -0.004611473, -0.0008787264, 0.0128262015, 0.011731366, -0.007234227, 0.008918055, -0.032318424, -0.006711062, -0.007462895, -0.004718878, 0.0006929336, 0.026608652, 0.014024977, 0.019776326, 0.029463537, -0.012008539, 0.014128916, 0.002671259, -0.03079397, 0.005990411, 0.01596519, -0.012084763, 0.009853516, 0.00039280675, -0.009534767, 0.003592861, 0.00015233712, -0.037446134, -0.0007544315, -0.024238817, -0.010172266, -0.02222931, 0.003967045
, -0.0049025053, 0.028964626, -0.017461928, -0.026262185, -0.0020250985, -0.024252677, -0.020095075, -0.011177019, 0.01378245, -0.029408103, 0.004372411, -0.014121987, -0.004195713, 0.03569994, -0.024987185, -0.0033174197, -0.018958664, -0.03475755, -0.01335976, -0.019956488, 0.00059159205, 0.0038873577, 0.013456771, 0.025818706, 0.0029986703, -0.002702441, 0.011835306, 0.021231486, -0.00046643094, 0.001592015, -0.007670775, 0.015729593, -0.0013927965, 0.016741276, 0.035339
613, -0.02390621, -0.0011693254, -0.019817902, 0.025236642, 0.01586818, -0.0009666424, -0.012749978, -0.03079397, -0.03048908, -0.00279079, 0.0035339615, 0.017254047, -0.0030904838, -0.033870596, -0.02441898, 0.015327691, 0.035866246, -0.003428289, 0.0019228908, 0.02441898, -0.0055157514, 0.018224154, 0.019332848, 0.01451003, -0.01617307, 0.006323019, -0.01304794, -0.015882038, 0.024211101, 1.4941381e-05, 0.0112671, 0.013380548, 0.011073079, 0.006354201, 0.0040328735, -0.00
9895092, -0.0043793404, 0.010768188, -0.011717508, 0.008308274, -0.029241798, -0.044486336, 0.011759084, 0.017933123, -0.0006808073, -0.0030974133, 0.02192442, -0.006021593, -0.0018484005, -0.0010359357, 0.0014759486, 0.011440334, 0.003469865, 0.007941019, 0.029269516, 0.011842236, 0.009555555, -0.008807186, -0.004226895, 8.5737e-06, 0.027606476, 0.02379534, -0.014232856, -0.028230116, -0.0008479775, 0.0078024324, -0.012368865, -0.030849405, 0.02118991, 0.013013293, 0.01358
14985, 0.0029085889, -0.031708643, -0.006700668, 0.024640718, -0.013207315, 0.018764643, 0.014073482, 0.015618724, 0.016062202, 0.02921408, -0.031874947, 0.01754508, -0.012909353, -0.009333815, -0.011412617, -0.016394809, 0.02882604, 0.00605624, -0.00012093857, 0.016741276, -0.0025447987, -0.00328797, 0.028659735, 0.026677944, -0.008266698, 0.016644266, 0.014052694, 0.026317619, -0.012015468, -0.01868149, -0.0044209165, 0.0049232934, -0.003423092, 0.0054845694, -0.013498347
, 0.012223349, -0.0052766893, 0.0074074604, 0.035007007, 0.003423092, -0.015854321, -0.006534364, -0.0033486017, 0.01409427, -0.004729272, 0.014939649, 0.013844813, -0.029602123, -0.025971152, 0.003059302, 0.014170492, 0.023809198, -0.0017877687, -0.0016344571, 0.013422124, 0.021328496, -0.031653207, -0.0085508, 0.012327289, 0.01012376, -0.0027266939, 0.030655382, 0.0035270322, -0.026497781, 0.019873336, -0.011766013, -0.021993713, -0.014579323, -0.006385383, -0.008918055,
-0.0017557206, -0.008162758, -0.024141807, 0.00014140176, -0.0023369186, 0.019513011, -0.0062675844, 0.007317379, -0.0127984835, 0.01940214, 0.024654578, -0.006343807, 0.020732574, 0.002846225, -0.0003542623, 0.010276206, -0.045290142, -0.010255418, -0.011565062, 0.035949394, 0.0053286594, -0.008952702, -0.024294253, 0.003459471, -0.009112077, 0.014911931, 0.016477961, 0.0054880343, -0.008322133, -0.009777294, -0.024183383, 0.0173372, -0.02809153, -0.011093867, -0.009306098
, -0.0105395205, -0.014274432, -0.010920634, -0.035783093, 0.03037821, 0.017420352, -0.025735555, -0.04185319, 0.0030714283, -0.026054304, 0.00187785, -0.0035356937, 0.015175246, 0.01200161, 0.011634355, -0.013283538, 0.018016273, -0.00089994754, -0.0041125612, -0.0069778417, 0.004770848, -0.02326871, 0.006769961, 0.00026677945, -0.0036448308, -0.031182013, -0.0011121584, 0.007421319, -0.025416804, 0.010740471, 0.014967366, -0.013893319, 0.0011398759, 0.007975666, 0.0078925
14, 0.0025136166, 0.015688017, 0.016768994, -0.03373201, 0.017060025, 0.021813551, -0.0004828881, 0.00067127944, 0.02921408, 0.00876561, -0.016921438, -0.0034144304, 0.007213439, -0.032706466, -0.008148899, 0.00037938115, -0.0048366766, 0.016145354, 0.0022295138, 0.012590604, 0.021425508, -0.0076638456, -0.005314801, -0.014634758, -0.019360565, -0.014814921, 0.010996857, -0.01753122, 0.006513576, -0.03872113, 0.0025638544, 0.012119409, 0.0025707837, -0.01807171, 0.008259769
, -0.019804042, 0.011343324, 0.0029761498, -0.010615743, -0.0052351137, 0.012202561, -0.0038284583, -0.010456368, -0.006139392, -0.0011632623, 0.006274514, 0.016311657, 0.007587623, -0.0036275075, -0.03181951, 0.043155905, 0.0017314679, -0.010768188, 0.019138826, 0.23415613, -0.0010636532, -0.0049232934, 0.01805785, 0.0020753362, 0.024127949, -0.008779469, 0.0078301495, -0.0043273703, -0.005990411, 0.01754508, -0.0070436704, -0.009119007, 0.009195229, -0.013089516, -0.02285
295, -0.01920812, -0.014232856, -0.008114252, -0.039746672, 0.016256223, 0.040217865, -0.002955362, 0.0004216068, 0.019554587, 0.0036794776, 0.01065039, -0.0022745547, -0.0072272974, -0.008003383, -0.005869148, -0.019485293, -0.0014906734, 0.02681653, -0.0008358512, 0.0077262097, -0.0016483158, 0.000596356, -0.013526064, 0.027689626, -0.004216501, 0.016879862, 0.00908436, -0.0040640556, 0.007421319, -0.036559176, -0.004937152, -0.011599708, 0.015202964, 0.011821448, -0.0331
22227, 0.00040103533, -0.0015045321, 0.037418414, -0.0014646885, 0.0044902097, -0.008412214, 0.0035616788, -0.0020666744, 0.0019350171, -0.005623156, 0.0116620725, -0.0036448308, 0.036559176, 0.017267905, 0.029602123, -0.0059037944, 0.0011424742, 0.014385302, 0.010601885, 0.02473773, -0.020552412, -0.009617918, -0.012611392, -0.02159181, -0.019069534, 0.03661461, 0.018750783, 0.021730399, 0.020095075, -0.017960839, -0.015313833, -0.010324711, -0.025347512, -0.0050930623, -0
.027149139, 0.006620981, -0.01628394, -0.0051831435, -0.002785593, -0.005865683, 0.012077833, -0.021383932, -0.004393199, 0.023199417, 0.03309451, 0.03320538, 0.015882038, -0.018487468, 0.006347272, -0.0016691039, 0.06569011, -0.00030662311, 0.02077415, -0.021425508, 0.004909435, -0.016256223, 0.0017946981, 0.01650568, -0.017586656, 0.010040608, -0.02037225, 0.013179597, -0.030599948, -0.0227698, 0.01962388, -0.0044209165, -0.014939649, -0.004521392, -0.0031251307, -0.01500
8942, -0.0105048735, 0.013706227, 0.019152686, -0.01272919, -0.01033164, -0.016990732, 0.0019072997, -0.011239383, -0.021564094, 0.008938843, -0.01577117, -0.0032030856, -0.00024295985, -0.007400531, -0.0038145995, -0.020649422, -0.005332124, -0.008675529, 0.012978647, 0.029574407, 0.021910561, -0.0048158886, 0.01273612, 0.005148497, -0.013366689, -0.006035452, 0.0075945524, -0.035117876, -0.0024408586, -0.011010715, -0.00782322, 0.0019904517, -0.015563289, 0.015895898, -0.
008543871, -0.02285295, 0.007546047, 0.021120617, 0.005148497, -0.026705662, 0.016020626, 0.028521148, -0.012652968, -0.01116316, -0.013366689, -0.17983013, 0.011980822, 0.026968976, -0.03154234, -0.0017825718, 0.013034081, 0.0053182654, -0.004365482, -0.015826603, 0.030932557, 0.0030974133, -0.01919426, -0.030849405, -0.0043897345, 0.0042130365, 7.578961e-05, 0.02139779, 0.030267341, -0.0010870396, 0.0054429937, 0.027315443, 0.00033477356, 0.00657594, -0.004812424, 0.00350
45117, -0.020524694, -0.009146724, -0.0032637173, -0.004029409, -0.026151314, 0.019263554, 0.009493191, 0.005145032, 0.008335992, -0.020718714, -0.025001045, 0.00044520985, -0.027689626, -0.025042621, -0.0046495846, 0.038832, 0.012770766, 0.04445862, 0.01754508, -0.00720651, 0.016949156, 0.04049504, -0.0058726124, 0.0043897345, -0.0018501327, 0.025416804, -0.016089918, 0.009139794, -0.010303923, 0.03747385, 0.016574971, 0.02472387, -0.019083392, 0.0011970429, -0.025181208,
0.0026210214, -0.0062710494, -0.01784997, -0.009340745, -0.0105256615, -0.0068115373, -0.0017176092, 0.02921408, -0.004854, 0.016117636, -0.005228184, 0.016394809, 0.003256788, 0.0028392954, 0.013332043, 0.01158585, -0.016866004, 0.0024200706, -0.016727418, 0.00981194, -0.036060266, 0.035422765, -0.0012905889, 0.020108933, 0.0097495755, 0.014108129, 0.0016292601, 0.012590604, -0.008744822, 0.0012126338, 0.0048470707, -0.013283538, -0.013720086, 1.2918069e-05, 0.009943597, 0
.031570055, 0.0030471755, 0.019249696, -0.00950012, -0.010497944, 0.024294253, -0.00053225964, -0.025971152, -0.0019731284, 0.013477559, -0.00673185, 0.0008635685, 0.01794698, 0.024349688, -0.013442912, -0.03766787, 0.0101445485, 0.010941422, 0.0029207151, -0.0016301264, 0.037529286, 0.0069570537, -0.034618963, 0.0021169123, -0.010359357, 0.044403184, -0.0030800898, -0.012167914, 0.0035131734, 0.013636934, -0.00082285865, -0.09451614, -0.027842073, 0.0173372, 0.0054949634,
-0.0135814985, 0.025278218, 0.016062202, -0.0023507774, -0.037972763, 0.034979288, 0.0015989443, -0.021744257, -0.011876882, -0.021993713, 0.007996454, 0.0029380384, -0.022118442, -0.022063006, -0.0069917003, 0.015438561, -0.00048202195, -0.014454595, -0.0043793404, -0.010262347, -0.0054395287, -0.022686647, -0.021896701, 0.009486261, 0.031015709, -0.0013564175, -0.019277412, -0.017628232, -0.022257028, -0.02974071, 0.004590685, -0.012722261, -0.0018293448, 0.018459752, 0.0
075114, -0.019596163, 0.017032309, -0.009361533, -0.0042754, -0.026802672, -0.012673756, 0.0054533877, 0.00020809662, 0.023116264, 0.0035755374, -0.03453581, -0.008897267, -0.0038873577, -0.039912976, -0.0024980258, 0.0048366766, -0.009001208, 0.011246312, -0.009784223, -0.02326871, 0.030239623, -0.012583675, 0.004653049, -0.03714124, -0.0014309079, 0.0042719357, 0.016588831, -0.0031909593, -0.0070298114, 0.019817902, -0.0012801948, -0.010345499, 0.00814197, -0.012375794, 0
.021065181, -0.025181208, 0.005169285, -0.018626055, -0.016242364, -0.0024495204, 0.007885585, -0.0132003855, -0.0059661586, -0.005921118, -0.0154939955, -0.009728788, -0.008530012, 0.0052247196, -0.027398596, 0.020995889, -0.06003577, 0.01262525, 0.026109738, 0.010061396, 0.0027370877, -0.011433405, 0.0074975416, 0.0029415032, -0.03226299, 0.02996245, 0.010442509, -0.013657722, -0.017170895, -0.0818216, 0.0012637377, 0.01681057, -0.015161388, -0.010588026, -0.03874885, 0.0
11987751, -0.023199417, -0.0010359357, 0.027010553, -0.025888, 0.02807767, 0.0031649743, -0.015535572, -0.006430424, 0.007296591, 0.008426073, -0.008821045, 0.022049148, 0.0032845053, -0.0004950145, -0.009049713, 0.0022901455, 0.012777695, 0.016297799, -0.0005513153, -0.027301585, -0.013352831, -0.023130124, -0.0038284583, 0.029269516, -0.0074975416, -0.012500523, 0.040883083, -0.014537747, 0.004147208, 0.0020129723, 0.021176051, -0.008724034, 0.0023525096, 0.0010827088, -0
.041908626, 0.019693173, 0.0014742162, -0.0021290386, -0.012493593, -0.00049977837, 0.0042615416, 0.003454274, -0.019651597, 0.030101037, 0.013235032, 0.0017453266, -0.04664829, -0.004798565, -0.010102972, 0.0067145266, -0.0062502613, 0.0063888477, -0.0017002858, 0.030516796, 0.01973475, 0.025735555, -0.0001405356, 0.0040536616, -0.014177422, -0.020704856, 0.004476351, 0.017032309, -0.020815726, 0.0001672785, -0.011766013, 0.01919426, 0.0093546035, 0.017586656, -0.012445088
, 0.0032481262, -0.0023213276, -0.022395615, 0.0151336705, 0.024363546, -0.0011095599, -0.019429859, 0.032207556, 0.027329301, -0.00047336027, -0.035838526, 0.012368865, -0.036171135, 0.006513576, -0.008585447, 0.0204554, -0.014870355, -0.011786801, -0.013733944, -0.014440737, 0.0010749133, -0.0151059525, 0.022631211, 0.014704051, -0.0032585203, 0.006551687, 0.008876479, -0.0025534604, -0.030101037, 0.026470063, -0.003319152, -0.018764643, 0.01534155, 0.034314074, 0.0257355
55, -0.009451615, -0.0007639593, 0.017988557, -0.024169525, 0.029158646, -0.0062467963, -0.0340369, -0.029075494, 0.008315204, -0.00981887, -0.0052247196, 0.023130124, -0.0012897227, -0.009673353, 0.004206107, 0.0147456275, -0.033371683, 0.02077415, -0.006877366, -0.016741276, -0.015424702, 0.0010194785, -0.0031805653, -0.027190715, -0.010858269, 0.009098219, -0.0058345012, -0.021564094, 0.07394987, 0.028521148, 0.0061948267, 0.012389653, -0.01743421, 0.02681653, 0.01322117
4, -0.0029570942, -0.016103778, -0.015216822, 0.007462895, 0.0022243168, 0.019263554, -0.0060700984, 0.012791554, -0.0052316487, -0.009444685, -0.0039635804, 0.0028756745, -0.010955281, 0.015882038, 0.006222544, 0.016228504, -0.013422124, -0.017157037, -0.0026487387, 0.005248972, -0.008405285, 0.012188702, -0.013789379, 0.02096817, 0.0077747153, -0.02473773, -0.009451615, -0.009527837, -0.0042823297, -0.0045976145, -0.0063403426, 0.012611392, 0.017046167, 0.027772779, 0.029
463537, -0.025707837, -0.01994263, -0.034508094, -0.0089873485, -0.00049198285, -0.016034484, -0.0024304646]' LIMIT 7;
Limit  (cost=3427.84..3427.86 rows=7 width=16) (actual time=40.273..40.275 rows=7 loops=1)
   ->  Sort  (cost=3427.84..3459.70 rows=12742 width=16) (actual time=40.272..40.272 rows=7 loops=1)
         Sort Key: ((embedding <#> '[-0.010012891,0.007275803,-0.0071718628,-0.029491255,-0.033787444,0.02913093,-0.03581081,-0.03181951,-0.035034724,-0.020746432,0.020386107,0.013269679,-0.020289097,-0.007691563,-0.000622341,-0.0044105225,0.03913689,-0.027038269,0.011038433,-0.005314801,-0.021882843,-0.0003718022,0.02974071,-0.016186928,-0.0023507774,0.0028531542,0.004455563,-0.023545884,-0.014579323,-0.016616547,0.0166997,0.015951332,-0.02306083,-0.034979288,-0.02683039,0.024571426,0.0030021349,-0.0017756424,0.031376034,-0.008924985,0.026858106,-0.0039427923,-0.0068219313,-0.019457577,-0.009444685,-0.008827974,-0.006045846,-0.03129288,0.0029016596,0.03298364,0.01743421,0.010941422,-0.0225342,-0.0018553297,-0.005138103,-0.0047881715,-0.015286116,0.038360804,0.008918055,0.02160567,-0.011918458,-0.0021758114,-0.021730399,0.005602368,0.026428487,-0.004122955,-0.032373857,-0.0027145674,-0.02098203,-0.014115058,0.01263218,0.02734316,-0.016339375,-0.001831077,0.009978244,-0.0059938757,-0.006752638,0.0033589958,0.00038457816,0.0050688093,0.009534767,-0.014787204,-0.008578518,-0.004791636,-0.0013910643,0.020330673,0.01169672,0.01106615,-0.028881473,0.0050757388,0.0067664967,0.01847361,0.047368944,0.025430664,-0.031902663,-0.0035252997,-0.00039237365,0.014011118,-0.007324308,-0.014551606,-0.008176616,0.0029969378,-0.013983401,-0.0072203684,-0.012535169,0.008183546,-0.013401336,0.0054395287,0.008211263,-0.0062190793,-0.009216017,0.025375228,0.02003964,-0.029463537,-0.0063611306,-0.021550236,-0.009708,-0.01377552,-0.014690192,-0.040217865,0.024460556,-0.0014490974,0.018224154,-0.010782047,0.007975666,0.0054672463,-0.025389088,-0.011093867,-0.00803803,-0.029823862,0.03486842,0.028008377,0.015050518,0.028160822,-0.027800497,0.020524694,-0.01900024,0.0071787923,-0.033676572,-0.030128753,0.012140197,0.03181951,-0.011412617,-0.013623075,-0.012188702,0.005436064,0.01868149,0.0025794455,0.01054645,0.013034081,0.004185319,0.0011312141,0.011059221,0.008100394,0.010560309,0.009112077,-0.00061281316,-0.008211263,-0.02775892,-0.01679671,-0.011308677,-0.013318184,0.03661461,-0.016159212,0.014870355,0.029075494,0.005990411,0.010324711,-0.02232632,-0.024488274,-0.04041189,0.0037245182,-0.008204334,0.009534767,-0.016062202,-0.00542567,0.020399965,-0.0093823215,-0.016339375,0.00022282147,0.009063572,-0.022589635,0.0014395696,0.019707032,-0.022354038,-0.005682056,0.0077469978,-0.013158809,-0.0023715652,-0.024599144,0.010193054,0.033759724,-0.002354242,-0.0009692409,-0.6559032,-0.032401577,0.00097270554,-0.029602123,0.03445266,0.015812745,0.012659897,0.011828377,-0.012708402,-0.00043005194,-0.012348077,0.013713156,-0.018958664,0.025347512,0.011876882,-0.025541533,0.027828215,-0.015743451,0.03181951,0.009347674,-0.024488274,0.011571991,0.0032065504,0.0010342035,-0.0023057365,-0.0017773748,0.005332124,-0.03672548,-0.005436064,-0.005751349,-0.022825234,0.035339613,0.0097565055,0.005138103,0.04393199,-0.011558132,0.006354201,0.017060025,-0.0035720728,0.027481748,-0.020025782,-0.021730399,0.01189767,-0.025749413,-0.0011623962,0.01064346,0.013505276,-0.0011935781,0.0177391,-0.014288291,0.00041142933,0.012147127,-0.01356764,-0.002044154,0.01919426,-0.0012689347,0.023019254,-0.0076984926,0.003220409,0.007975666,0.0046287966,0.01836274,-0.037834175,-0.015992908,-0.016159212,0.005127709,-0.0038145995,0.005501893,0.020095075,-0.022645071,0.025901858,0.003116469,-0.004632261,0.016976874,0.005415276,-0.008024171,0.027634192,0.02118991,-0.01200161,-0.0070713875,0.008114252,-0.0011909796,-0.0029207151,0.00652397,0.020219803,0.0028098458,-0.036780916,-0.020053498,0.028521148,0.01650568,0.0075391177,0.009805011,-0.0034508095,-0.015577148,-0.0151059525,0.011114655,0.020122793,0.008952702,0.00981887,-0.014856497,-0.023185559,-0.020524694,0.011883811,0.004413987,0.0040640556,0.0028981948,0.009888163,0.0016621745,0.030877123,-0.011253241,-0.0077955034,0.0045387154,-0.009479332,-0.010407863,-0.02066328,-0.023573602,-0.017309481,-0.009943597,-0.0007704556,-0.018293448,0.026664086,-0.009313027,-0.0015668961,-0.020053498,0.012188702,-0.0003479826,0.001420514,-0.0070402054,-0.03472983,-0.015355409,0.0032793083,-0.022367897,-0.0021047858,-0.0052004666,0.02077415,0.00928531,-0.007064458,0.0053286594,-0.0030107966,-0.02902006,-0.0112809595,-0.00034040364,0.0147456275,-0.008966561,-0.020788008,0.00053485815,-0.0143437255,0.008031101,-0.046481986,-0.006828861,-0.021619529,0.0038527108,-0.0204554,0.044846665,-0.01596519,-0.009694141,0.0036933362,-0.019374425,-0.01743421,0.00018092063,0.010324711,0.014038835,-0.008329062,-0.002567319,-0.0020199015,-0.010442509,-0.034979288,0.027065987,-0.019471435,-0.02965756,0.007525259,-0.01179373,-0.015826603,0.04456949,-0.0001568845,0.008419143,-0.014523889,-0.022464909,0.0044728867,-3.9356462e-05,0.015604865,0.014676334,-0.0077262097,0.0022017965,-0.006198291,0.011994681,0.0018484005,0.011086938,-0.007158004,0.012285713,0.0040432676,0.019332848,0.004375876,0.0075737643,-0.017586656,-0.0058830064,-0.0007249818,0.024751589,0.0107474,0.014856497,0.025125774,-0.0037626296,0.023185559,-0.009728788,0.0077192807,-0.016519537,-0.0047743125,-0.021688823,0.039441783,0.00066608243,-0.0056196917,-0.04143743,0.0067041325,0.013297396,0.017364915,0.025749413,-0.014898073,0.0045075333,-0.016588831,0.0076569165,0.01367158,-0.007504471,0.003449077,-0.025818706,-0.01649182,0.021813551,0.018944805,0.033316247,-0.0042511476,-0.015535572,0.00406752,0.009423898,-0.0058934004,0.019027958,0.034480378,0.02087116,0.017988557,0.00072931265,0.018820077,-0.023532026,-0.012722261,0.02726001,0.022284744,0.012264925,0.021855127,0.0044728867,0.04687003,0.021425508,0.0025361371,0.013921036,-0.023504307,-0.0150228,0.012923212,0.02222931,0.01534155,0.007109499,0.004341229,-0.0027440172,0.0012472805,0.009680282,-0.0044001285,0.0008666001,0.008058818,0.0030142611,0.009507049,0.006839255,0.004216501,-0.0076153404,0.02307469,-0.0033104904,-0.006295302,-0.010844411,0.024585284,-0.03509016,0.031265166,0.0002613659,-0.007809362,-0.007158004,0.0049128993,-0.002354242,-0.027592616,-0.045484163,0.04332221,0.005623156,-0.01671356,-0.021868985,0.010324711,-0.013740874,-0.029158646,0.023573602,-0.00073321036,0.008128111,-0.005051486,-0.02838256,0.001296652,-0.008848762,0.021938277,0.005910724,-0.004673837,0.013179597,0.0109275635,-0.0029259122,0.00960406,-0.023005396,0.033260815,7.297457e-05,-0.0132003855,-0.020330673,-0.007379743,-0.013796308,-0.014260574,-0.00542567,-0.010671178,-0.004791636,0.006641769,0.0073658843,0.0011078276,0.011814518,0.03037821,0.013976471,0.0073312377,-0.02349045,0.012590604,0.015286116,0.05981403,0.003977439,-0.0025292076,-0.0039705094,-0.02882604,0.001296652,-0.049614046,0.025347512,0.010719683,0.0030852868,-0.011745225,0.0076984926,0.018529044,-0.01722633,-0.0027717345,0.014565465,-0.006856578,-0.01534155,-0.022007572,-0.016852146,-0.0016240631,0.01263218,0.012299572,0.012403511,0.012202561,-0.004947546,0.014759486,-0.034979288,-0.00678382,-0.017683666,-0.006045846,0.025666261,2.517298e-05,-0.014177422,0.012202561,0.02568012,-0.004864394,-0.009174441,0.008571588,0.0064650704,0.02755104,0.019707032,0.016200788,-0.009964385,0.0069986293,-0.023920069,-0.0059349765,0.016630407,0.006596728,-0.013124162,-0.012244137,-0.0049614045,-0.033676572,0.017323341,-0.00020214173,0.015701875,-0.01679671,0.009250664,-0.0076777046,-0.04978035,-0.0151059525,0.0010549914,0.015812745,0.0020701392,-0.0054429937,-0.040827647,0.0033676573,-0.01826573,0.00292418,0.025139632,0.009610989,-0.016879862,-0.020524694,-0.014496171,0.020801866,0.0063888477,0.009306098,0.00459415,-0.0038804282,0.021120617,0.0023784947,-0.024446698,0.004829747,-0.0045144623,-0.0010619208,-0.016228504,0.009292239,-0.0072480855,0.009846587,0.032512445,-0.01900024,0.0042719357,0.0069882353,0.0038665696,0.004136814,-0.005127709,0.023629036,0.031597774,0.0004885182,-0.023850774,-0.004413987,-0.022672787,-0.011059221,-0.004611473,-0.0008787264,0.0128262015,0.011731366,-0.007234227,0.008918055,-0.032318424,-0.006711062,-0.007462895,-0.004718878,0.0006929336,0.026608652,0.014024977,0.019776326,0.029463537,-0.012008539,0.014128916,0.002671259,-0.03079397,0.005990411,0.01596519,-0.012084763,0.009853516,0.00039280675,-0.009534767,0.003592861,0.00015233712,-0.037446134,-0.0007544315,-0.024238817,-0.010172266,-0.02222931,0.003967045,-0.0049025053,0.028964626,-0.017461928,-0.026262185,-0.0020250985,-0.024252677,-0.020095075,-0.011177019,0.01378245,-0.029408103,0.004372411,-0.014121987,-0.004195713,0.03569994,-0.024987185,-0.0033174197,-0.018958664,-0.03475755,-0.01335976,-0.019956488,0.00059159205,0.0038873577,0.013456771,0.025818706,0.0029986703,-0.002702441,0.011835306,0.021231486,-0.00046643094,0.001592015,-0.007670775,0.015729593,-0.0013927965,0.016741276,0.035339613,-0.02390621,-0.0011693254,-0.019817902,0.025236642,0.01586818,-0.0009666424,-0.012749978,-0.03079397,-0.03048908,-0.00279079,0.0035339615,0.017254047,-0.0030904838,-0.033870596,-0.02441898,0.015327691,0.035866246,-0.003428289,0.0019228908,0.02441898,-0.0055157514,0.018224154,0.019332848,0.01451003,-0.01617307,0.006323019,-0.01304794,-0.015882038,0.024211101,1.4941381e-05,0.0112671,0.013380548,0.011073079,0.006354201,0.0040328735,-0.009895092,-0.0043793404,0.010768188,-0.011717508,0.008308274,-0.029241798,-0.044486336,0.011759084,0.017933123,-0.0006808073,-0.0030974133,0.02192442,-0.006021593,-0.0018484005,-0.0010359357,0.0014759486,0.011440334,0.003469865,0.007941019,0.029269516,0.011842236,0.009555555,-0.008807186,-0.004226895,8.5737e-06,0.027606476,0.02379534,-0.014232856,-0.028230116,-0.0008479775,0.0078024324,-0.012368865,-0.030849405,0.02118991,0.013013293,0.0135814985,0.0029085889,-0.031708643,-0.006700668,0.024640718,-0.013207315,0.018764643,0.014073482,0.015618724,0.016062202,0.02921408,-0.031874947,0.01754508,-0.012909353,-0.009333815,-0.011412617,-0.016394809,0.02882604,0.00605624,-0.00012093857,0.016741276,-0.0025447987,-0.00328797,0.028659735,0.026677944,-0.008266698,0.016644266,0.014052694,0.026317619,-0.012015468,-0.01868149,-0.0044209165,0.0049232934,-0.003423092,0.0054845694,-0.013498347,0.012223349,-0.0052766893,0.0074074604,0.035007007,0.003423092,-0.015854321,-0.006534364,-0.0033486017,0.01409427,-0.004729272,0.014939649,0.013844813,-0.029602123,-0.025971152,0.003059302,0.014170492,0.023809198,-0.0017877687,-0.0016344571,0.013422124,0.021328496,-0.031653207,-0.0085508,0.012327289,0.01012376,-0.0027266939,0.030655382,0.0035270322,-0.026497781,0.019873336,-0.011766013,-0.021993713,-0.014579323,-0.006385383,-0.008918055,-0.0017557206,-0.008162758,-0.024141807,0.00014140176,-0.0023369186,0.019513011,-0.0062675844,0.007317379,-0.0127984835,0.01940214,0.024654578,-0.006343807,0.020732574,0.002846225,-0.0003542623,0.010276206,-0.045290142,-0.010255418,-0.011565062,0.035949394,0.0053286594,-0.008952702,-0.024294253,0.003459471,-0.009112077,0.014911931,0.016477961,0.0054880343,-0.008322133,-0.009777294,-0.024183383,0.0173372,-0.02809153,-0.011093867,-0.009306098,-0.0105395205,-0.014274432,-0.010920634,-0.035783093,0.03037821,0.017420352,-0.025735555,-0.04185319,0.0030714283,-0.026054304,0.00187785,-0.0035356937,0.015175246,0.01200161,0.011634355,-0.013283538,0.018016273,-0.00089994754,-0.0041125612,-0.0069778417,0.004770848,-0.02326871,0.006769961,0.00026677945,-0.0036448308,-0.031182013,-0.0011121584,0.007421319,-0.025416804,0.010740471,0.014967366,-0.013893319,0.0011398759,0.007975666,0.007892514,0.0025136166,0.015688017,0.016768994,-0.03373201,0.017060025,0.021813551,-0.0004828881,0.00067127944,0.02921408,0.00876561,-0.016921438,-0.0034144304,0.007213439,-0.032706466,-0.008148899,0.00037938115,-0.0048366766,0.016145354,0.0022295138,0.012590604,0.021425508,-0.0076638456,-0.005314801,-0.014634758,-0.019360565,-0.014814921,0.010996857,-0.01753122,0.006513576,-0.03872113,0.0025638544,0.012119409,0.0025707837,-0.01807171,0.008259769,-0.019804042,0.011343324,0.0029761498,-0.010615743,-0.0052351137,0.012202561,-0.0038284583,-0.010456368,-0.006139392,-0.0011632623,0.006274514,0.016311657,0.007587623,-0.0036275075,-0.03181951,0.043155905,0.0017314679,-0.010768188,0.019138826,0.23415613,-0.0010636532,-0.0049232934,0.01805785,0.0020753362,0.024127949,-0.008779469,0.0078301495,-0.0043273703,-0.005990411,0.01754508,-0.0070436704,-0.009119007,0.009195229,-0.013089516,-0.02285295,-0.01920812,-0.014232856,-0.008114252,-0.039746672,0.016256223,0.040217865,-0.002955362,0.0004216068,0.019554587,0.0036794776,0.01065039,-0.0022745547,-0.0072272974,-0.008003383,-0.005869148,-0.019485293,-0.0014906734,0.02681653,-0.0008358512,0.0077262097,-0.0016483158,0.000596356,-0.013526064,0.027689626,-0.004216501,0.016879862,0.00908436,-0.0040640556,0.007421319,-0.036559176,-0.004937152,-0.011599708,0.015202964,0.011821448,-0.033122227,0.00040103533,-0.0015045321,0.037418414,-0.0014646885,0.0044902097,-0.008412214,0.0035616788,-0.0020666744,0.0019350171,-0.005623156,0.0116620725,-0.0036448308,0.036559176,0.017267905,0.029602123,-0.0059037944,0.0011424742,0.014385302,0.010601885,0.02473773,-0.020552412,-0.009617918,-0.012611392,-0.02159181,-0.019069534,0.03661461,0.018750783,0.021730399,0.020095075,-0.017960839,-0.015313833,-0.010324711,-0.025347512,-0.0050930623,-0.027149139,0.006620981,-0.01628394,-0.0051831435,-0.002785593,-0.005865683,0.012077833,-0.021383932,-0.004393199,0.023199417,0.03309451,0.03320538,0.015882038,-0.018487468,0.006347272,-0.0016691039,0.06569011,-0.00030662311,0.02077415,-0.021425508,0.004909435,-0.016256223,0.0017946981,0.01650568,-0.017586656,0.010040608,-0.02037225,0.013179597,-0.030599948,-0.0227698,0.01962388,-0.0044209165,-0.014939649,-0.004521392,-0.0031251307,-0.015008942,-0.0105048735,0.013706227,0.019152686,-0.01272919,-0.01033164,-0.016990732,0.0019072997,-0.011239383,-0.021564094,0.008938843,-0.01577117,-0.0032030856,-0.00024295985,-0.007400531,-0.0038145995,-0.020649422,-0.005332124,-0.008675529,0.012978647,0.029574407,0.021910561,-0.0048158886,0.01273612,0.005148497,-0.013366689,-0.006035452,0.0075945524,-0.035117876,-0.0024408586,-0.011010715,-0.00782322,0.0019904517,-0.015563289,0.015895898,-0.008543871,-0.02285295,0.007546047,0.021120617,0.005148497,-0.026705662,0.016020626,0.028521148,-0.012652968,-0.01116316,-0.013366689,-0.17983013,0.011980822,0.026968976,-0.03154234,-0.0017825718,0.013034081,0.0053182654,-0.004365482,-0.015826603,0.030932557,0.0030974133,-0.01919426,-0.030849405,-0.0043897345,0.0042130365,7.578961e-05,0.02139779,0.030267341,-0.0010870396,0.0054429937,0.027315443,0.00033477356,0.00657594,-0.004812424,0.0035045117,-0.020524694,-0.009146724,-0.0032637173,-0.004029409,-0.026151314,0.019263554,0.009493191,0.005145032,0.008335992,-0.020718714,-0.025001045,0.00044520985,-0.027689626,-0.025042621,-0.0046495846,0.038832,0.012770766,0.04445862,0.01754508,-0.00720651,0.016949156,0.04049504,-0.0058726124,0.0043897345,-0.0018501327,0.025416804,-0.016089918,0.009139794,-0.010303923,0.03747385,0.016574971,0.02472387,-0.019083392,0.0011970429,-0.025181208,0.0026210214,-0.0062710494,-0.01784997,-0.009340745,-0.0105256615,-0.0068115373,-0.0017176092,0.02921408,-0.004854,0.016117636,-0.005228184,0.016394809,0.003256788,0.0028392954,0.013332043,0.01158585,-0.016866004,0.0024200706,-0.016727418,0.00981194,-0.036060266,0.035422765,-0.0012905889,0.020108933,0.0097495755,0.014108129,0.0016292601,0.012590604,-0.008744822,0.0012126338,0.0048470707,-0.013283538,-0.013720086,1.2918069e-05,0.009943597,0.031570055,0.0030471755,0.019249696,-0.00950012,-0.010497944,0.024294253,-0.00053225964,-0.025971152,-0.0019731284,0.013477559,-0.00673185,0.0008635685,0.01794698,0.024349688,-0.013442912,-0.03766787,0.0101445485,0.010941422,0.0029207151,-0.0016301264,0.037529286,0.0069570537,-0.034618963,0.0021169123,-0.010359357,0.044403184,-0.0030800898,-0.012167914,0.0035131734,0.013636934,-0.00082285865,-0.09451614,-0.027842073,0.0173372,0.0054949634,-0.0135814985,0.025278218,0.016062202,-0.0023507774,-0.037972763,0.034979288,0.0015989443,-0.021744257,-0.011876882,-0.021993713,0.007996454,0.0029380384,-0.022118442,-0.022063006,-0.0069917003,0.015438561,-0.00048202195,-0.014454595,-0.0043793404,-0.010262347,-0.0054395287,-0.022686647,-0.021896701,0.009486261,0.031015709,-0.0013564175,-0.019277412,-0.017628232,-0.022257028,-0.02974071,0.004590685,-0.012722261,-0.0018293448,0.018459752,0.0075114,-0.019596163,0.017032309,-0.009361533,-0.0042754,-0.026802672,-0.012673756,0.0054533877,0.00020809662,0.023116264,0.0035755374,-0.03453581,-0.008897267,-0.0038873577,-0.039912976,-0.0024980258,0.0048366766,-0.009001208,0.011246312,-0.009784223,-0.02326871,0.030239623,-0.012583675,0.004653049,-0.03714124,-0.0014309079,0.0042719357,0.016588831,-0.0031909593,-0.0070298114,0.019817902,-0.0012801948,-0.010345499,0.00814197,-0.012375794,0.021065181,-0.025181208,0.005169285,-0.018626055,-0.016242364,-0.0024495204,0.007885585,-0.0132003855,-0.0059661586,-0.005921118,-0.0154939955,-0.009728788,-0.008530012,0.0052247196,-0.027398596,0.020995889,-0.06003577,0.01262525,0.026109738,0.010061396,0.0027370877,-0.011433405,0.0074975416,0.0029415032,-0.03226299,0.02996245,0.010442509,-0.013657722,-0.017170895,-0.0818216,0.0012637377,0.01681057,-0.015161388,-0.010588026,-0.03874885,0.011987751,-0.023199417,-0.0010359357,0.027010553,-0.025888,0.02807767,0.0031649743,-0.015535572,-0.006430424,0.007296591,0.008426073,-0.008821045,0.022049148,0.0032845053,-0.0004950145,-0.009049713,0.0022901455,0.012777695,0.016297799,-0.0005513153,-0.027301585,-0.013352831,-0.023130124,-0.0038284583,0.029269516,-0.0074975416,-0.012500523,0.040883083,-0.014537747,0.004147208,0.0020129723,0.021176051,-0.008724034,0.0023525096,0.0010827088,-0.041908626,0.019693173,0.0014742162,-0.0021290386,-0.012493593,-0.00049977837,0.0042615416,0.003454274,-0.019651597,0.030101037,0.013235032,0.0017453266,-0.04664829,-0.004798565,-0.010102972,0.0067145266,-0.0062502613,0.0063888477,-0.0017002858,0.030516796,0.01973475,0.025735555,-0.0001405356,0.0040536616,-0.014177422,-0.020704856,0.004476351,0.017032309,-0.020815726,0.0001672785,-0.011766013,0.01919426,0.0093546035,0.017586656,-0.012445088,0.0032481262,-0.0023213276,-0.022395615,0.0151336705,0.024363546,-0.0011095599,-0.019429859,0.032207556,0.027329301,-0.00047336027,-0.035838526,0.012368865,-0.036171135,0.006513576,-0.008585447,0.0204554,-0.014870355,-0.011786801,-0.013733944,-0.014440737,0.0010749133,-0.0151059525,0.022631211,0.014704051,-0.0032585203,0.006551687,0.008876479,-0.0025534604,-0.030101037,0.026470063,-0.003319152,-0.018764643,0.01534155,0.034314074,0.025735555,-0.009451615,-0.0007639593,0.017988557,-0.024169525,0.029158646,-0.0062467963,-0.0340369,-0.029075494,0.008315204,-0.00981887,-0.0052247196,0.023130124,-0.0012897227,-0.009673353,0.004206107,0.0147456275,-0.033371683,0.02077415,-0.006877366,-0.016741276,-0.015424702,0.0010194785,-0.0031805653,-0.027190715,-0.010858269,0.009098219,-0.0058345012,-0.021564094,0.07394987,0.028521148,0.0061948267,0.012389653,-0.01743421,0.02681653,0.013221174,-0.0029570942,-0.016103778,-0.015216822,0.007462895,0.0022243168,0.019263554,-0.0060700984,0.012791554,-0.0052316487,-0.009444685,-0.0039635804,0.0028756745,-0.010955281,0.015882038,0.006222544,0.016228504,-0.013422124,-0.017157037,-0.0026487387,0.005248972,-0.008405285,0.012188702,-0.013789379,0.02096817,0.0077747153,-0.02473773,-0.009451615,-0.009527837,-0.0042823297,-0.0045976145,-0.0063403426,0.012611392,0.017046167,0.027772779,0.029463537,-0.025707837,-0.01994263,-0.034508094,-0.0089873485,-0.00049198285,-0.016034484,-0.0024304646]'::vector))
         Sort Method: top-N heapsort  Memory: 25kB
         ->  Seq Scan on tanuki_bot_mvc  (cost=0.00..3185.28 rows=12742 width=16) (actual time=0.053..39.415 rows=12742 loops=1)
               Filter: (embedding IS NOT NULL)
 Planning Time: 0.138 ms
 Execution Time: 40.307 ms

Also, see thread

How to set up and validate locally

  1. Follow instructions for settings up the MR dependency: Add support for the embedding database (!118156 - merged)
  2. Run the migration:
    rails db:migrate
  3. Clone the tanuki-bot repository
  4. cd into the pgvector folder
  5. use asdf to install python (should be python 3.11.3)
    asdf install python
  6. install pip
  7. install requirements
    pip install -r requirements.txt
  8. run the command to copy the chroma db to the gdk postgres database
    PG_USER=<Your user> PG_HOST=<Your gdk install directory>/postgresql python chroma_to_pg.py
  9. open rails console
  10. run the following to do a query using the new model
  11. you must have an OPENAI API key to do this test
    ::Gitlab::CurrentSettings.update!(openai_api_key: '<YOUR_OPENAI_KEY>')
    
    current_user = User.first; client = ::Gitlab::Llm::OpenAi::Client.new(current_user); question = 'What is Advanced Search?'
    
    embeddings_result = client.embeddings(input: question); question_embedding = embeddings_result['data'].first['embedding']; nil
    
    File.open('tmp/question.txt', 'w+'){|f| f.write question_embedding.join(',') }
    
    Embedding::TanukiBot.neighbor_for(question_embedding).limit(5).pluck(:id)

MR acceptance checklist

This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.

Edited by Dmitry Gruzd

Merge request reports