RedisDistanceMetric

org.llm4s.vectorstore.redis.RedisDistanceMetric
See theRedisDistanceMetric companion object
enum RedisDistanceMetric(val wireName: String)

The distance a Redis VECTOR field is indexed with, fixed when the index is created.

Redis reports a distance (lower is closer); RedisVectorStore turns it into a org.llm4s.vectorstore.ScoredRecord score in [0, 1], higher meaning closer: 1 - distance / 2 for RedisDistanceMetric.Cosine (the cosine distance lies in [0, 2], so this is (1 + cosine) / 2) and for RedisDistanceMetric.InnerProduct ((1 + dot) / 2, in [0, 1] for unit-length vectors), and 1 / (1 + distance) for RedisDistanceMetric.L2. Scores are clamped to [0, 1].

Value parameters

wireName

the value of the field's DISTANCE_METRIC attribute

Attributes

Companion
object
Graph
Supertypes
trait Enum
trait Serializable
trait Product
trait Equals
class Object
trait Matchable
class Any
Show all

Members list

Type members

Enum entries

Cosine distance, the default: no requirement on the vectors' length.

Cosine distance, the default: no requirement on the vectors' length.

Attributes

Inner product, for unit-length vectors.

Inner product, for unit-length vectors.

Attributes

case L2 extends RedisDistanceMetric

Euclidean (L2) distance.

Euclidean (L2) distance.

Attributes