From 4597512adccaad176e244cbd189e6d177502559d Mon Sep 17 00:00:00 2001 From: Dmitry Paramonov Date: Tue, 29 Oct 2024 15:14:29 +0300 Subject: [PATCH] feat: Add MMR implementation --- agents-api/agents_api/models/docs/mmr.py | 106 +++++++++++++++++++++ agents-api/poetry.lock | 112 ++++++++++++++++++++++- agents-api/pyproject.toml | 1 + 3 files changed, 217 insertions(+), 2 deletions(-) create mode 100644 agents-api/agents_api/models/docs/mmr.py diff --git a/agents-api/agents_api/models/docs/mmr.py b/agents-api/agents_api/models/docs/mmr.py new file mode 100644 index 000000000..6e02f266b --- /dev/null +++ b/agents-api/agents_api/models/docs/mmr.py @@ -0,0 +1,106 @@ +from __future__ import annotations + +import logging +from typing import Union + +import numpy as np + +Matrix = Union[list[list[float]], list[np.ndarray], np.ndarray] + +logger = logging.getLogger(__name__) + + +def _cosine_similarity(x: Matrix, y: Matrix) -> np.ndarray: + """Row-wise cosine similarity between two equal-width matrices. + + Args: + x: A matrix of shape (n, m). + y: A matrix of shape (k, m). + + Returns: + A matrix of shape (n, k) where each element (i, j) is the cosine similarity + between the ith row of X and the jth row of Y. + + Raises: + ValueError: If the number of columns in X and Y are not the same. + ImportError: If numpy is not installed. + """ + + if len(x) == 0 or len(y) == 0: + return np.array([]) + + x = np.array(x) + y = np.array(y) + if x.shape[1] != y.shape[1]: + msg = ( + f"Number of columns in X and Y must be the same. X has shape {x.shape} " + f"and Y has shape {y.shape}." + ) + raise ValueError(msg) + try: + import simsimd as simd # type: ignore + + x = np.array(x, dtype=np.float32) + y = np.array(y, dtype=np.float32) + z = 1 - np.array(simd.cdist(x, y, metric="cosine")) + return z + except ImportError: + logger.debug( + "Unable to import simsimd, defaulting to NumPy implementation. If you want " + "to use simsimd please install with `pip install simsimd`." + ) + x_norm = np.linalg.norm(x, axis=1) + y_norm = np.linalg.norm(y, axis=1) + # Ignore divide by zero errors run time warnings as those are handled below. + with np.errstate(divide="ignore", invalid="ignore"): + similarity = np.dot(x, y.T) / np.outer(x_norm, y_norm) + similarity[np.isnan(similarity) | np.isinf(similarity)] = 0.0 + return similarity + + +def maximal_marginal_relevance( + query_embedding: np.ndarray, + embedding_list: list, + lambda_mult: float = 0.5, + k: int = 4, +) -> list[int]: + """Calculate maximal marginal relevance. + + Args: + query_embedding: The query embedding. + embedding_list: A list of embeddings. + lambda_mult: The lambda parameter for MMR. Default is 0.5. + k: The number of embeddings to return. Default is 4. + + Returns: + A list of indices of the embeddings to return. + + Raises: + ImportError: If numpy is not installed. + """ + + if min(k, len(embedding_list)) <= 0: + return [] + if query_embedding.ndim == 1: + query_embedding = np.expand_dims(query_embedding, axis=0) + similarity_to_query = _cosine_similarity(query_embedding, embedding_list)[0] + most_similar = int(np.argmax(similarity_to_query)) + idxs = [most_similar] + selected = np.array([embedding_list[most_similar]]) + while len(idxs) < min(k, len(embedding_list)): + best_score = -np.inf + idx_to_add = -1 + similarity_to_selected = _cosine_similarity(embedding_list, selected) + for i, query_score in enumerate(similarity_to_query): + if i in idxs: + continue + redundant_score = max(similarity_to_selected[i]) + equation_score = ( + lambda_mult * query_score - (1 - lambda_mult) * redundant_score + ) + if equation_score > best_score: + best_score = equation_score + idx_to_add = i + idxs.append(idx_to_add) + selected = np.append(selected, [embedding_list[idx_to_add]], axis=0) + return idxs diff --git a/agents-api/poetry.lock b/agents-api/poetry.lock index ca88522e3..16bd06fa2 100644 --- a/agents-api/poetry.lock +++ b/agents-api/poetry.lock @@ -1,4 +1,4 @@ -# This file is automatically @generated by Poetry 1.8.3 and should not be changed by hand. +# This file is automatically @generated by Poetry 1.8.2 and should not be changed by hand. [[package]] name = "aiohappyeyeballs" @@ -4754,6 +4754,114 @@ files = [ {file = "simpleeval-0.9.13.tar.gz", hash = "sha256:4a30f9cc01825fe4c719c785e3762623e350c4840d5e6855c2a8496baaa65fac"}, ] +[[package]] +name = "simsimd" +version = "5.9.4" +description = "Portable mixed-precision BLAS-like vector math library for x86 and ARM" +optional = false +python-versions = "*" +files = [ + {file = "simsimd-5.9.4-cp310-cp310-macosx_10_9_universal2.whl", hash = "sha256:9aa3bb197bea5bf92ff7cbb33d4b5eea10f37d5122599142555eb556714ee542"}, + {file = "simsimd-5.9.4-cp310-cp310-macosx_10_9_x86_64.whl", hash = "sha256:2e580b93b82fa60b6c54aabfe7cfac7a4e5bdee4556a99c77cf51f8a35849ad9"}, + {file = "simsimd-5.9.4-cp310-cp310-macosx_11_0_arm64.whl", hash = "sha256:604b3d2622b37713a7adcfd7e2d0d432968ba988ec7bcd9ed3f631eacfc9be0e"}, + {file = "simsimd-5.9.4-cp310-cp310-manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:fc20c854bba8c9b6f1bcae41f46c8ff81402d80bba4658226c45f254d97d393b"}, + {file = "simsimd-5.9.4-cp310-cp310-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:7d8c493ebbba65bd8305f2d5d7046b520bf39d020720700b23162eb8ba47b040"}, + {file = "simsimd-5.9.4-cp310-cp310-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:7ba24d583542bfea4d7b70eafdd528d774486df3667101f280b5d6c89e848a32"}, + {file = "simsimd-5.9.4-cp310-cp310-manylinux_2_28_aarch64.whl", hash = "sha256:e45e095fef614a73b66c24b96f7c93de33c8d62ce756d9b2dc0c181c8ee57ca7"}, + {file = "simsimd-5.9.4-cp310-cp310-manylinux_2_28_x86_64.whl", hash = "sha256:b6a68f3c549d7c9bad134c39dd0186ee43943ace80f20e1f433b4a0e85af6158"}, + {file = "simsimd-5.9.4-cp310-cp310-musllinux_1_2_aarch64.whl", hash = "sha256:6559e437f4351664d46e51ca9e692850c7102e301431e78a2580ffc1f5693c22"}, + {file = "simsimd-5.9.4-cp310-cp310-musllinux_1_2_armv7l.whl", hash = "sha256:070b50f3beee90ec842392b8fb888247987053235bebf046b160e2491c315699"}, + {file = "simsimd-5.9.4-cp310-cp310-musllinux_1_2_i686.whl", hash = "sha256:1d275e9ab98e652b5f9d50ef0a8191dd6a7cd15a900afc477ecd8d9267efa416"}, + {file = "simsimd-5.9.4-cp310-cp310-musllinux_1_2_ppc64le.whl", hash = "sha256:148a4a698d694aa5c27cdf48cc15bd7ed7c3fc62b85d1e69ccd5171955112cf5"}, + {file = "simsimd-5.9.4-cp310-cp310-musllinux_1_2_s390x.whl", hash = "sha256:8b6697b66144273203696c5b9f8af475da9a1967b048de931c8238426edb6d47"}, + {file = "simsimd-5.9.4-cp310-cp310-musllinux_1_2_x86_64.whl", hash = "sha256:9b0f1ff1cf35e84a52a506ab23d1ed3800dbfe9ceb4f3c2f9e88627abcbf01fe"}, + {file = "simsimd-5.9.4-cp310-cp310-win32.whl", hash = "sha256:5244a0409121d4caf13d1eb2dd017ae5106a92119368a7e67e5860c443faec23"}, + {file = "simsimd-5.9.4-cp310-cp310-win_amd64.whl", hash = "sha256:e57b292964db34521d3803d6eae8f51fca5e1c76d1c16bd28aa50102c0ce93aa"}, + {file = "simsimd-5.9.4-cp310-cp310-win_arm64.whl", hash = "sha256:f335d91cae89f633b44469128dfe7f4b2c7cdbe4f46538eecb59019dd538f067"}, + {file = "simsimd-5.9.4-cp311-cp311-macosx_10_9_universal2.whl", hash = "sha256:6d4cc3bdf78380ebd7eb4da45b83b80f5c5b5ae0538de36574f7fa36069466e5"}, + {file = "simsimd-5.9.4-cp311-cp311-macosx_10_9_x86_64.whl", hash = "sha256:fc707a98ea34c51c7982145b830548a4af3902efec7bb0b42a4fc650f3567d46"}, + {file = "simsimd-5.9.4-cp311-cp311-macosx_11_0_arm64.whl", hash = "sha256:f4a4a0c472fff6c631af0d8b43b1e99e5ec8c8b9e3bfb7ac7d0e4fada0efa25b"}, + {file = "simsimd-5.9.4-cp311-cp311-manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:088d06f8c4afb8cb7e7f174774253f8d970c68db92a06de6007f24ea7c98886e"}, + {file = "simsimd-5.9.4-cp311-cp311-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:689523f10440bb4f9c9c18618e5fa57516747b5c4b0786401c197604f9ae9e1e"}, + {file = "simsimd-5.9.4-cp311-cp311-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:3af1c689e5cc520d583648d796cbf839329b96e1d476bef2cbb9812c095fa6b1"}, + {file = "simsimd-5.9.4-cp311-cp311-manylinux_2_28_aarch64.whl", hash = "sha256:f155926c01c22684da74cf63290b72fa8b8e01d04ae07e95c080900b35c48896"}, + {file = "simsimd-5.9.4-cp311-cp311-manylinux_2_28_x86_64.whl", hash = "sha256:d292270207d564f8071b07301cce4c3b1c88c28141ac2839e30c415686ec66d6"}, + {file = "simsimd-5.9.4-cp311-cp311-musllinux_1_2_aarch64.whl", hash = "sha256:3f55a79f049a6d468540b313e6c5bf3e741e9b1de931aeb278372d2ff29f35ca"}, + {file = "simsimd-5.9.4-cp311-cp311-musllinux_1_2_armv7l.whl", hash = "sha256:6bef5a36743bf9d6f6976c0e7e889a6b44773d944d70b15223f69786ea5e2364"}, + {file = "simsimd-5.9.4-cp311-cp311-musllinux_1_2_i686.whl", hash = "sha256:702b18ee287d734c746bf8977040cd89873e19331dff31000e928c0409f93042"}, + {file = "simsimd-5.9.4-cp311-cp311-musllinux_1_2_ppc64le.whl", hash = "sha256:ae7139168667c3f8ca89fbba2af3df9250dc6f49ad40272c3bbb5924304b3d84"}, + {file = "simsimd-5.9.4-cp311-cp311-musllinux_1_2_s390x.whl", hash = "sha256:2d63f37571baaea25fce9fa4973ff307e88969c7ef04717361d99cb844308c98"}, + {file = "simsimd-5.9.4-cp311-cp311-musllinux_1_2_x86_64.whl", hash = "sha256:4dd2a95c7ffbc04e6cd0833985b80ac8fa8b040f3b619616b542e931b83313b3"}, + {file = "simsimd-5.9.4-cp311-cp311-win32.whl", hash = "sha256:5b89e5536cc357cc4fb08839467b5b63ab3671c564e52bca463e7615852cc0ad"}, + {file = "simsimd-5.9.4-cp311-cp311-win_amd64.whl", hash = "sha256:52cb4e52f248b84db641bd92d6a5f16fd1c085ab194e8f003a65a69d52905b5e"}, + {file = "simsimd-5.9.4-cp311-cp311-win_arm64.whl", hash = "sha256:e418f756a2eebcadf983c24dbf4f68b0c9200aafddad864022ed15c1b2feaf85"}, + {file = "simsimd-5.9.4-cp312-cp312-macosx_10_13_universal2.whl", hash = "sha256:20041c10750feb69d6d62ed6010e6357ccec7cb8e1eb97a8d2518c23965d1a1b"}, + {file = "simsimd-5.9.4-cp312-cp312-macosx_10_13_x86_64.whl", hash = "sha256:83813b3e325fcb69c81c2b2cdb08fc0e1b78479eea3b134b07e6cf216c9b954d"}, + {file = "simsimd-5.9.4-cp312-cp312-macosx_11_0_arm64.whl", hash = "sha256:704138b45d54ae95db6ec7b239b6fc410c93f28af9e0a1e31469225c26aa59a8"}, + {file = "simsimd-5.9.4-cp312-cp312-manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:b7be7482084d836d90384b818a37299591569811351548348b4d60c1d90cee4a"}, + {file = "simsimd-5.9.4-cp312-cp312-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:afef7ec944dfb27c997d26e6c4bf3f76b2d211f2e644765025fbaeb108cef609"}, + {file = "simsimd-5.9.4-cp312-cp312-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:cc0412d6b238bba6be3719361d04b22a3e98e9b7cd0e24d5e810f7643db79513"}, + {file = "simsimd-5.9.4-cp312-cp312-manylinux_2_28_aarch64.whl", hash = "sha256:94422a3c723303b79a0ab75cb64ab07e3d9d9f3e376b1eda7a0ffd9de75f32a7"}, + {file = "simsimd-5.9.4-cp312-cp312-manylinux_2_28_x86_64.whl", hash = "sha256:7072ba69894e212756f1ff2304d89972c2d49d7cb524426abdac6551c5d29a07"}, + {file = "simsimd-5.9.4-cp312-cp312-musllinux_1_2_aarch64.whl", hash = "sha256:1820794cf0070b67579a7868b63f209d3de6ad5e23beabe84f6f1d97d2eee9ff"}, + {file = "simsimd-5.9.4-cp312-cp312-musllinux_1_2_armv7l.whl", hash = "sha256:08820f1380696adb04709d6e59ab89dd1402419eb894f3d6742bf13f52c3d532"}, + {file = "simsimd-5.9.4-cp312-cp312-musllinux_1_2_i686.whl", hash = "sha256:c7894bb8d476cbe6bd216dac86be2d39b589a5f69306e4d30df1d49cc55da83e"}, + {file = "simsimd-5.9.4-cp312-cp312-musllinux_1_2_ppc64le.whl", hash = "sha256:7ab6ba0bb0616ac8103ff51f580aeece31967ecc481000ca3e4b119ce4981bdc"}, + {file = "simsimd-5.9.4-cp312-cp312-musllinux_1_2_s390x.whl", hash = "sha256:988b116ca7664615b8af80ef8c7d50e5aee8239792af84c7a0236cbfb506b8f0"}, + {file = "simsimd-5.9.4-cp312-cp312-musllinux_1_2_x86_64.whl", hash = "sha256:761c30ee3f250013ba6c0a98ae043c3df372593acefd9a88d205a50104613860"}, + {file = "simsimd-5.9.4-cp312-cp312-win32.whl", hash = "sha256:ebe8b0fe9fe68b95f7068cc533a00a6bace8390d6fa69757524b52ce3e94d3a8"}, + {file = "simsimd-5.9.4-cp312-cp312-win_amd64.whl", hash = "sha256:99fa8a36faa904382e23b4f5c92410809ea73cc6977bdab6db7aa263c03af45c"}, + {file = "simsimd-5.9.4-cp312-cp312-win_arm64.whl", hash = "sha256:e740219884f3a602726ecd88e58afcdc1a5d475e9eb5c5780d90e120a91599b2"}, + {file = "simsimd-5.9.4-cp37-cp37m-macosx_10_9_x86_64.whl", hash = "sha256:6ddb59bbd3060b2c266274a62279da8f49766e2e89a690d0b0f26b7dc384c171"}, + {file = "simsimd-5.9.4-cp37-cp37m-manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:cfbaeb368186628f3b028308f5e7e76a4508eb3ff6ec5dcd378f9502a0068a99"}, + {file = "simsimd-5.9.4-cp37-cp37m-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:1bba3e2740fe17117ea06314c8c8b2e0ce2802d24b9c3d609feaddbd18b45ea3"}, + {file = "simsimd-5.9.4-cp37-cp37m-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:e19db5973c8ab88462d366eba1a3355986963e154cf404cd997c5bfd61f545b7"}, + {file = "simsimd-5.9.4-cp37-cp37m-manylinux_2_28_aarch64.whl", hash = "sha256:0206b4a5941e9cf3fe6c13cdb368810bceecfbd925699a039cfaa0186bf880f0"}, + {file = "simsimd-5.9.4-cp37-cp37m-manylinux_2_28_x86_64.whl", hash = "sha256:8dccd6843294ed5af3b3b3f1e105af79913537caf13fb66bf0286c8edc37cabc"}, + {file = "simsimd-5.9.4-cp37-cp37m-musllinux_1_2_aarch64.whl", hash = "sha256:95da968cf47c28ede55c1117182227c3feaae14e69236a93f88ac4ebf0164dbb"}, + {file = "simsimd-5.9.4-cp37-cp37m-musllinux_1_2_armv7l.whl", hash = "sha256:dff91aedba35410c956c0f58bc7fac3dbb857c2de0da7fe7462922767f1f752d"}, + {file = "simsimd-5.9.4-cp37-cp37m-musllinux_1_2_i686.whl", hash = "sha256:eefba8563e819f9498cdb99d0955547d34c743404b9b6e77324f5996ba6fac69"}, + {file = "simsimd-5.9.4-cp37-cp37m-musllinux_1_2_ppc64le.whl", hash = "sha256:1854d7bd381cd784f0eba401d3c7a473f215907c69ceba37ff33d849c906c294"}, + {file = "simsimd-5.9.4-cp37-cp37m-musllinux_1_2_s390x.whl", hash = "sha256:77d00679f537127f3ae81a5be8cec59e2dd646b4f038962a5e51c6b5fc8ff638"}, + {file = "simsimd-5.9.4-cp37-cp37m-musllinux_1_2_x86_64.whl", hash = "sha256:2f891052a796b329a1b9524b291e46ed27d3c15263e28af1beb71709b3dcdbde"}, + {file = "simsimd-5.9.4-cp37-cp37m-win32.whl", hash = "sha256:bd576d41b4c34f982950d12e0e44cd1c3a036e68ef64a502bd77575f1e9cb133"}, + {file = "simsimd-5.9.4-cp37-cp37m-win_amd64.whl", hash = "sha256:b049767596826931f603f7dd7078deb4df6e5f5c72e781f120b9e39d29da1d7c"}, + {file = "simsimd-5.9.4-cp38-cp38-macosx_10_9_universal2.whl", hash = "sha256:e52a9ffca8d369d6896b17ef146510dd245bb75183d4cd9853c5b798bcc54cd6"}, + {file = "simsimd-5.9.4-cp38-cp38-macosx_10_9_x86_64.whl", hash = "sha256:0d072d0447ea391862e1f4b73fa252e05a50a5b521a054f038e5176ee226d6c9"}, + {file = "simsimd-5.9.4-cp38-cp38-macosx_11_0_arm64.whl", hash = "sha256:a60b8b082d395a33f2598689f9becd6d76a7c99ce6265cfdac9770e78074129d"}, + {file = "simsimd-5.9.4-cp38-cp38-manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:9f4c33ea0d63669d4f0274490fe3d8a1bfc38e63fffbdb2cc278413ec7cb2fa8"}, + {file = "simsimd-5.9.4-cp38-cp38-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:64babccde5c772cb70e1bc181350c7410a09a3b74d8d4c75a80c9b3c58f23fac"}, + {file = "simsimd-5.9.4-cp38-cp38-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:1bedd64a05d15f1484c51d301508036f8b273bf27853c3ab46bb48ab5c8866c0"}, + {file = "simsimd-5.9.4-cp38-cp38-manylinux_2_28_aarch64.whl", hash = "sha256:d0c544f904ee49c1b09ae57243eb5b65322cbcafd97f90d1387a701abb7992fe"}, + {file = "simsimd-5.9.4-cp38-cp38-manylinux_2_28_x86_64.whl", hash = "sha256:af30676f5e4fbbc019d01ffe81a2f13408fb06ac00093b609dfa290cbed2c49b"}, + {file = "simsimd-5.9.4-cp38-cp38-musllinux_1_2_aarch64.whl", hash = "sha256:ba40d83fc876f340a8e3dea63300c312e79969b708ac0821e97cdb32ada63fb1"}, + {file = "simsimd-5.9.4-cp38-cp38-musllinux_1_2_armv7l.whl", hash = "sha256:522451990de7c9882ff725ddd07e97908bcb1b9717b8cf4d91863d756538a9a0"}, + {file = "simsimd-5.9.4-cp38-cp38-musllinux_1_2_i686.whl", hash = "sha256:336005c695576a3d075a8d2850bb7aacdaabff972580c7a6a34bd99ea7c81328"}, + {file = "simsimd-5.9.4-cp38-cp38-musllinux_1_2_ppc64le.whl", hash = "sha256:ff2ab1cff5a830ec98400d39c6781e3897556702bf8b92ba10d58d292498103c"}, + {file = "simsimd-5.9.4-cp38-cp38-musllinux_1_2_s390x.whl", hash = "sha256:81ad083a65d6a4db620d8c0c70b40301d56338e49cc60ed76f3e13df1ce85a91"}, + {file = "simsimd-5.9.4-cp38-cp38-musllinux_1_2_x86_64.whl", hash = "sha256:1c2064e42534ad094cc22c0e052d4bac364e29937d52ff6fda0560b81db7ac9d"}, + {file = "simsimd-5.9.4-cp38-cp38-win32.whl", hash = "sha256:06f32e34440240a491abad5859f46a316811664d117364e71fa392151a17b7b5"}, + {file = "simsimd-5.9.4-cp38-cp38-win_amd64.whl", hash = "sha256:ecc47cb003fc59fb25806500b70555d5aafaee02f8b1f827e290b455eaed60f3"}, + {file = "simsimd-5.9.4-cp39-cp39-macosx_10_9_universal2.whl", hash = "sha256:19d3fb232401509b07a544fdb3d2e58f9d2f40ece682af75295f2ef2eaa9da83"}, + {file = "simsimd-5.9.4-cp39-cp39-macosx_10_9_x86_64.whl", hash = "sha256:02537903ba4a06e0bc5a918aaeb01cf482de3d2e3b56be594307e7b79db22e52"}, + {file = "simsimd-5.9.4-cp39-cp39-macosx_11_0_arm64.whl", hash = "sha256:4d243ad10f9a3785971953c0a1580fddd507150baa65efd9ccd794a3e4922792"}, + {file = "simsimd-5.9.4-cp39-cp39-manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:b2d737e8bbe39ffd56ba9628b84567c63dd8b659e66c397fd80e3f63222a150d"}, + {file = "simsimd-5.9.4-cp39-cp39-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:e64c5893b8ac5ca8ff3b109b7715f4e3653b5d3993281c3ceea3acb9e041011e"}, + {file = "simsimd-5.9.4-cp39-cp39-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:342affe60887f546edad4e2788d6fb9208b81f35f465f84045ab779846847731"}, + {file = "simsimd-5.9.4-cp39-cp39-manylinux_2_28_aarch64.whl", hash = "sha256:808df09687e2cb8844b74539ca807a7aa3e1475ed030e5214bf1038bdfabdc9d"}, + {file = "simsimd-5.9.4-cp39-cp39-manylinux_2_28_x86_64.whl", hash = "sha256:8abd16873080c0fade2057cf371d02aa73e04cc1d1f5c16169dcd8a9cdbdadbc"}, + {file = "simsimd-5.9.4-cp39-cp39-musllinux_1_2_aarch64.whl", hash = "sha256:a6b575b7d6a74cef9e87a3f3901fd7147891bdce130d655ff498eadb9b3d49bb"}, + {file = "simsimd-5.9.4-cp39-cp39-musllinux_1_2_armv7l.whl", hash = "sha256:d3fac32be9f6cb4b989a5c6ca79852f3731286a2ef2b65128350d7218cb84258"}, + {file = "simsimd-5.9.4-cp39-cp39-musllinux_1_2_i686.whl", hash = "sha256:ea76107e145e3317c7f72a906a80e4714b07ecaeb69f1b2e373e31db0c85be1e"}, + {file = "simsimd-5.9.4-cp39-cp39-musllinux_1_2_ppc64le.whl", hash = "sha256:0fa47f8b255f7c02ec2d22a58a1300026ae4e875791cd2696f1201ac3da00e93"}, + {file = "simsimd-5.9.4-cp39-cp39-musllinux_1_2_s390x.whl", hash = "sha256:e5e1961a04a2365b4d5cfdab8463729aa8765e49f3c59cd098fdffce8402c15e"}, + {file = "simsimd-5.9.4-cp39-cp39-musllinux_1_2_x86_64.whl", hash = "sha256:89fd6e3a4453b6068e6ca43801c407fc8d5320ef6eda654ca2b470986f423855"}, + {file = "simsimd-5.9.4-cp39-cp39-win32.whl", hash = "sha256:3c60915dfbf21a7c68e409dc159a29c3a74adbdecd1961d89206fc8d86ac9000"}, + {file = "simsimd-5.9.4-cp39-cp39-win_amd64.whl", hash = "sha256:32d484a86aef01aa17bbde89d690319fe204399eab0120b719b7aefaea1f7a45"}, + {file = "simsimd-5.9.4-cp39-cp39-win_arm64.whl", hash = "sha256:def1b28b4520dc304f29ab1dd8cd5d16dd6f7ee0aec1a15e3e9a3dca736cd7dd"}, + {file = "simsimd-5.9.4.tar.gz", hash = "sha256:f75115884854e4576130031636288294ff7045ec9812482d6a01f4f32702482b"}, +] + [[package]] name = "six" version = "1.16.0" @@ -6071,4 +6179,4 @@ type = ["pytest-mypy"] [metadata] lock-version = "2.0" python-versions = ">=3.12,<3.13" -content-hash = "c1c4a3cbec01bd43e2f94bd7bca281642839d06dd33b6203e10659a4b9b2128d" +content-hash = "6dc27fc07258f0d3ca7f08926e98428e56764dfd86decb02dfc4b413ab1520e5" diff --git a/agents-api/pyproject.toml b/agents-api/pyproject.toml index fdce646fb..0a3832937 100644 --- a/agents-api/pyproject.toml +++ b/agents-api/pyproject.toml @@ -48,6 +48,7 @@ msgpack = "^1.1.0" thefuzz = "^0.22.1" gunicorn = "^23.0.0" uvloop = "^0.21.0" +simsimd = "^5.9.4" [tool.poetry.group.dev.dependencies] ipython = "^8.26.0" ruff = "^0.5.5"