WeightedScore

org.llm4s.vectorstore.FusionStrategy.WeightedScore
final case class WeightedScore(vectorWeight: Double, keywordWeight: Double) extends FusionStrategy

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

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

Members list

Value members

Inherited methods

def productElementNames: Iterator[String]

Attributes

Inherited from:
Product
def productIterator: Iterator[Any]

Attributes

Inherited from:
Product