Skip to content

Instantly share code, notes, and snippets.

@aShevc

aShevc/ebr.rb Secret

Created November 14, 2023 17:20
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save aShevc/086fee0f927ab013d2a90f2973ce53b0 to your computer and use it in GitHub Desktop.
Save aShevc/086fee0f927ab013d2a90f2973ce53b0 to your computer and use it in GitHub Desktop.
v1 = [0.26846325,-0.23716052,0.12526867,0.32631156,0.00271839,-0.15222456,0.0994423,0.029955126,-0.122345164,0.1471219,-0.21663578,0.026418457,-0.3318971,-0.22675303,-0.31663033,0.17021269,-0.055501137,-0.39970714,-0.43330708,0.45532298,-0.33721516,0.38136917,0.35704952,-0.2272793,0.47840014,-0.41730675,-0.18318379,0.13899536,-0.048481084,-0.045316998,-0.428223,0.18878391,-0.11361246,-0.45341256,-0.3368711,0.054998204,-0.3113023,0.27800632,-0.09334432,-0.15471956,0.3510938,0.056814115,0.09321978,0.4440934,0.20632029,-0.37737522,0.053021237,-0.07549514,-0.12274457,0.23113023,0.20638718,0.28597355,-0.062226374,0.08098808,0.44468316,0.53276044,0.07326027,-0.11226646,0.405268,-0.014123329,0.047007527,0.15027393,-0.271591,-0.057938274,-0.012191469,-0.026369505,0.31744948,-0.34761363,0.349972,-0.30041802,-0.136215,-0.4288606,-0.6118515,0.110463955,0.11154631,0.018595466,-0.19540755,0.2054163,-0.09800551,0.43624032,0.16442421,-0.13759008,-0.32345447,-0.26609316,0.15164512,-0.20274676,-0.2576618,-0.03917401,-0.25884524,-0.48677438,0.53917086,0.11610418,-0.26126203,-0.21721894,0.23150682,-0.48364523,-0.31772682,0.07292499,0.49642467,-0.06990445,-0.4968539,0.14183876,-0.40574464,0.06248121,0.17508844,-0.51380163,0.12363218,0.0715515,0.4051006,0.23154104,-0.030636296,-0.36557698,-0.050146695,0.3819547,0.35548905,0.05102839,0.11953654,0.15800071,-0.23894227,0.15069021,-0.47655827,-0.057067487,-0.1984521,0.30401093,0.10492782,0.14599472,0.013837918,-0.16802932]
v2 = [0.02729954, 0.4920699, 0.39735934, -0.030032553, 0.33280537, -0.030500537, 0.2600108, 0.4202363, 0.1162437, 0.33410984, -0.13712789, 0.01663655, 0.4153163, -0.0863514, -0.48513836, 0.45374906, 0.40023443, 0.3406557, 0.15820831, 0.085451946, 0.44479698, -0.42135584, -0.23760676, -0.5317733, -0.22462006, -0.25745666, 0.24264388, 0.40654767, -0.24210525, 0.23207167, -0.0014247937, 0.16664676, -0.12793233, 0.057245564, 0.021972913, -0.4967533, 0.46308348, -0.20089808, -0.4832336, -0.13684377, -0.10957926, -0.13849513, 0.23854005, -0.24528132, 0.1018577, -0.23900226, -0.12721972, -0.27887708, 0.3411021, 0.42860267, -0.18073758, 0.30686632, -0.20133598, -0.028531894, 0.6193341, 0.37950245, 0.4683688, 0.17792943, -0.46000984, 0.11805655, -0.066814974, -0.44594696, 0.03767481, 0.35794535, 0.37636992, -0.17890064, -0.40507856, -0.04045399, -0.532499, -0.105851024, 0.42335275, 0.34107277, -0.429887, -0.14864697, 0.35540286, -0.31778288, -0.22353357, -0.13723417, -0.5102281, 0.18624726, 0.02698095, 0.17480785, 0.5194625, 0.41283894, 0.47295654, -0.33340228, 0.39837524, 0.1732546, 0.46253726, -0.09486043, -0.14248595, 0.040985562, -0.102146804, -0.17326222, -0.6267438, 0.55732703, 0.06907865, 0.015252524, -0.019229412, -0.09725291, -0.019937458, -0.045835074, 0.39931357, -0.16949525, 0.22184028, -0.46782994, 0.0371291, 0.09310634, 0.22738272, 0.056191053, 0.19920729, -0.033651795, -0.047182802, -0.27166304, 0.1423818, 0.18438713, -0.02693489, -0.065496884, -0.0919235, -0.35218963, -0.119422786, -0.055005297, -0.20590462, 0.13364843, -0.08970503, -0.47115028, -0.39958468, -0.3230931]
v3 = [0.16675642, -0.07439751, -0.258972, 0.16803269, -0.29610443, 0.7118957, 0.089182004, -0.2077378, 0.17497598, -0.49227223, 0.4622489, -0.082572736, -0.3227909, 0.06959673, -0.047012895, -0.061055027, 0.24793029, -0.49564576, 0.14242455, -0.80790764, -0.3772759, -0.11475036, -0.20415099, 0.13953172, 0.72753066, -0.023482641, -0.28046525, -0.7503463, 0.38331163, -0.73558223, 0.67170393, 0.39274687, -0.0063743843, -0.66825724, -1.0377686, 0.33159223, 0.60195, 1.1862017, 0.70943713, -0.33667362, -0.051182058, 0.0654883, -0.8334009, -0.5532833, 0.08608871, 0.13301149, -0.4851133, -0.6919858, -0.5783589, 0.80866367, 0.5178979, 0.13806704, 1.2693965, 0.6119067, -0.71036327, -0.41202703, 0.5397026, 0.00018171727, -0.15021479, -1.44301, -0.16209464, 0.096999235, -0.21967374, -0.05009619, 0.84503716, 0.39418715, -0.3582063, 1.103194, 0.3928557, 0.26236334, -0.23816021, -0.87766385, 0.1203384, -0.8190929, 0.653378, 0.18099067, -0.4462128, 0.018376967, -0.90035814, 0.22197062, 0.75591487, -0.034259297, -0.40281013, -0.35376245, 0.8914759, -0.14535229, 0.8020755, -0.28953162, -0.8507391, 0.082828596, 0.6393382, 1.0195938, -0.44912955, -0.021908728, 0.83712894, -0.58500654, 0.4770937, 0.498802, -0.045156665, -0.29521137, -0.33918214, -0.48539332, -0.30808628, 0.20683815, 0.15156564, 0.47036648, 0.23586713, -0.19175501, -0.46180475, 0.21652533, -0.1734289, -0.5600839, -0.20330313, -0.14262542, 0.4701752, -0.24011196, -0.3083368, -0.5012069, 0.4521012, -0.05752907, 0.12892845, 0.020632425, 0.18099311, 0.73558027, 0.01884728, 0.20723514, 0.31202522, 0.15153769]
config = EBR::API::Config.new(pinecone_weight_map: proc {{ doc_type0: 100 }}, pinecone_api_key:
"<key>", pinecone_testing_mode: proc { false }, environment: "development",
dogstatsd: CustomMetric.instance.dogstatsd)
client = EBRR::API::InteractionDocumentEmbedding.new(config)
ctx =client.new_query_context
ctx.add_query("1", v1, 0, 1, limit: 50, metadata: ["word_document_id", "categories"])
ctx.add_query("2", v2, 0, 1, limit: 50, metadata: ["word_document_id", "categories"])
ctx.add_query("3", v3, 0, 1, limit: 50, metadata: ["word_document_id", "categories"])
ctx.execute
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment