This pull request updates the distance calculation logic to support both Cosine Similarity and Euclidean Distance based on the specified method from the SMSS file. Previously, the code defaulted to Euclidean Distance.
Key changes include:
Distance Method Selection: The distanceMethod variable now determines whether to use Cosine Similarity or Euclidean Distance for querying embeddings.
Cosine Similarity Implementation: When the method is set to "Cosine Similarity," the query utilizes the <=> operator to calculate similarity based on vector angles.
Euclidean Distance Default: If the method is not Cosine Similarity, the code defaults to using squared Euclidean Distance with the <-> operator, leveraging the POWER function to avoid the computational cost of square roots and ensure non-negative distance values.
This pull request updates the distance calculation logic to support both Cosine Similarity and Euclidean Distance based on the specified method from the SMSS file. Previously, the code defaulted to Euclidean Distance.
Key changes include: