searching in a django models of vectors with a custom function
RDBMS is not for storing the vectors, you need to use either elastic search or opensearch to store the vectors and perform the similarity checks.
im using django for a face recogntion app and i need to save face descriptor in djangomodel and then retreive them and compare with the vectors of a new image and get the model in the database that have the nearest distance with the new vectore.
so in short

i have a model of persons
each model have a textfield that represent a vector
i have a function compare(vec1,vec2) that take two vectors as
strings and return the distance between them
i have a new vector (not in the database)
i need to apply the compare  function on the model and retrieve the
person that his vector field have the minimum distance with the new
vector