swarmauri.core.vector_stores.ISimilarity module

class swarmauri.core.vector_stores.ISimilarity.ISimilarity[source]

Bases: ABC

Interface to define operations for computing similarity and distance between vectors. This interface is crucial for systems that need to perform similarity searches, clustering, or any operations where vector similarity plays a key role.

abstract similarity(vector_a, vector_b)[source]

Compute the similarity between two vectors. The definition of similarity (e.g., cosine similarity) should be implemented in concrete classes.

Parameters:
  • vector_a (IVector) – The first vector.

  • vector_b (IVector) – The second vector to compare with the first vector.

Returns:

A similarity score between vector_a and vector_b.

Return type:

float