FusionStrategy

org.llm4s.vectorstore.FusionStrategy
See theFusionStrategy companion trait

Attributes

Companion
trait
Graph
Supertypes
trait Sum
trait Mirror
class Object
trait Matchable
class Any
Self type

Members list

Type members

Classlikes

case object KeywordOnly extends FusionStrategy

Keyword-only search (no vector fusion).

Keyword-only search (no vector fusion).

Attributes

Supertypes
trait Singleton
trait Product
trait Mirror
trait Serializable
trait Product
trait Equals
class Object
trait Matchable
class Any
Show all
Self type
final case class RRF(k: Int) extends FusionStrategy

Reciprocal Rank Fusion (RRF).

Reciprocal Rank Fusion (RRF).

Combines results based on their rank positions across result lists. Score = sum(1 / (k + rank)) across all lists where the document appears.

RRF is robust to score scale differences and performs well when combining results from heterogeneous sources.

Value parameters

k

Smoothing constant (default: 60, as per original RRF paper)

Attributes

Supertypes
trait Serializable
trait Product
trait Equals
class Object
trait Matchable
class Any
Show all
case object VectorOnly extends FusionStrategy

Vector-only search (no keyword fusion).

Vector-only search (no keyword fusion).

Attributes

Supertypes
trait Singleton
trait Product
trait Mirror
trait Serializable
trait Product
trait Equals
class Object
trait Matchable
class Any
Show all
Self type
VectorOnly.type
final case class WeightedScore(vectorWeight: Double, keywordWeight: Double) extends FusionStrategy

Weighted score combination.

Weighted score combination.

Normalizes scores from each source to [0, 1] and combines with weights. Score = vectorWeight * normalizedVectorScore + keywordWeight * normalizedKeywordScore

Invalid weights are a programming error, like any require-guarded value here: the constructor throws IllegalArgumentException for a NaN, infinite, negative or all-zero pair, or one whose sum overflows (an infinite weight scores Inf, or NaN where a channel scored 0, and breaks the ranking). There is no Result twin: RAGConfig.withWeightedScore is a chainable builder that returns a RAGConfig, and a Left cannot be chained. Validate weights that come from user input before building the strategy (#1318, item 5).

Value parameters

keywordWeight

Weight for keyword matching (default: 0.5)

vectorWeight

Weight for vector similarity (default: 0.5)

Attributes

Supertypes
trait Serializable
trait Product
trait Equals
class Object
trait Matchable
class Any
Show all

Inherited and Abstract types

type MirroredElemLabels <: Tuple

The names of the product elements

The names of the product elements

Attributes

Inherited from:
Mirror
type MirroredLabel <: String

The name of the type

The name of the type

Attributes

Inherited from:
Mirror

Value members

Concrete fields

Default strategy: RRF with k=60

Default strategy: RRF with k=60

Attributes