Package genlayer_embeddings#
- class genlayer_embeddings.ChebyshevDistance[source]#
Bases:
DistanceL-infinity (max-coordinate) distance. A true metric, safe for pruning.
- __call__(l, r)[source]#
Compute the distance between two vectors.
- Parameters:
l – left-hand vector
r – right-hand vector
- Returns:
distance between
landr
- __gl_allow_storage__ = True#
- __init__(*args, **kwargs)#
- class genlayer_embeddings.Distance[source]#
Bases:
ProtocolProtocol for distance functions used by
VecDB.Implementations must be a true metric (non-negative, symmetric, zero iff equal, and satisfying the triangle inequality); otherwise the cover-tree pruning in
VecDB.knn()may skip the true nearest neighbor.- __call__(l, r) Any[source]#
Compute the distance between two vectors.
- Parameters:
l – left-hand vector
r – right-hand vector
- Returns:
distance between
landr- Return type:
- __init__(*args, **kwargs)#
- class genlayer_embeddings.EuclideanDistance[source]#
Bases:
Distance- __call__(l, r)[source]#
Compute the distance between two vectors.
- Parameters:
l – left-hand vector
r – right-hand vector
- Returns:
distance between
landr
- __gl_allow_storage__ = True#
- __init__(*args, **kwargs)#
- class genlayer_embeddings.ManhattanDistance[source]#
Bases:
DistanceL1 (taxicab) distance. A true metric, safe for cover-tree pruning.
- __call__(l, r)[source]#
Compute the distance between two vectors.
- Parameters:
l – left-hand vector
r – right-hand vector
- Returns:
distance between
landr
- __gl_allow_storage__ = True#
- __init__(*args, **kwargs)#
- class genlayer_embeddings.VecDB[source]#
Bases:
GenericData structure that supports storing and querying vector data using Cover Trees
Cover trees provide logarithmic time nearest neighbor search with theoretical guarantees.
There are two entities that can act as a key:
vector (can have duplicates)
id (int alias, can’t have duplicates)
- Element = Element#
Shorthand to prevent global namespace pollution
- __gl_allow_storage__ = True#