Enum Class DistanceFunction

java.lang.Object
java.lang.Enum<DistanceFunction>
dev.langchain4j.store.embedding.hibernate.DistanceFunction
All Implemented Interfaces:
Serializable, Comparable<DistanceFunction>, Constable

public enum DistanceFunction extends Enum<DistanceFunction>
Distance function
  • COSINE: The COSINE distance function
  • EUCLIDEAN: The EUCLIDEAN or L2 distance function
  • EUCLIDEAN_SQUARED: The squared EUCLIDEAN distance function
  • MANHATTAN: The MANHATTAN, TAXICAB or L1 distance function
  • INNER_PRODUCT: The INNER_PRODUCT distance function
  • NEGATIVE_INNER_PRODUCT: The NEGATIVE_INNER_PRODUCT distance function
  • HAMMING: The HAMMING distance function
  • JACCARD: The JACCARD distance function

Default value: COSINE

  • Enum Constant Details

    • COSINE

      public static final DistanceFunction COSINE
      The COSINE distance function
    • EUCLIDEAN

      public static final DistanceFunction EUCLIDEAN
      The EUCLIDEAN or L2 distance function
    • EUCLIDEAN_SQUARED

      public static final DistanceFunction EUCLIDEAN_SQUARED
      The squared EUCLIDEAN distance function
    • MANHATTAN

      public static final DistanceFunction MANHATTAN
      The MANHATTAN, TAXICAB or L1 distance function
    • INNER_PRODUCT

      public static final DistanceFunction INNER_PRODUCT
      The INNER_PRODUCT distance function
    • NEGATIVE_INNER_PRODUCT

      public static final DistanceFunction NEGATIVE_INNER_PRODUCT
      The NEGATIVE_INNER_PRODUCT distance function
    • HAMMING

      public static final DistanceFunction HAMMING
      The HAMMING distance function
    • JACCARD

      public static final DistanceFunction JACCARD
      The JACCARD distance function
  • Method Details

    • values

      public static DistanceFunction[] values()
      Returns an array containing the constants of this enum class, in the order they are declared.
      Returns:
      an array containing the constants of this enum class, in the order they are declared
    • valueOf

      public static DistanceFunction valueOf(String name)
      Returns the enum constant of this class with the specified name. The string must match exactly an identifier used to declare an enum constant in this class. (Extraneous whitespace characters are not permitted.)
      Parameters:
      name - the name of the enum constant to be returned.
      Returns:
      the enum constant with the specified name
      Throws:
      IllegalArgumentException - if this enum class has no constant with the specified name
      NullPointerException - if the argument is null