MultiHopRetrieverOptions
Properties
Section titled “Properties”decompose
Section titled “decompose”decompose: QueryDecomposer;Query decomposer function. Takes a user query and returns sub-queries. When it returns a single-element array, multi-hop is bypassed. Caller-provided to avoid LLM dependency in the rag package.
maxSubQueries?
Section titled “maxSubQueries?”optional maxSubQueries?: number;Maximum sub-queries per decomposition. Default: 3.
qualityThreshold?
Section titled “qualityThreshold?”optional qualityThreshold?: number;Minimum top-result score to consider direct retrieval “good enough” and skip decomposition. When the top score from direct retrieval meets or exceeds this threshold, the decompose call is skipped entirely — saving ~1000ms of LLM latency.
Set to 0 to always decompose (original behavior). Set to 1 to never decompose (direct retrieval only).
Default: 0.5 (calibrated for Cohere reranker scores).
retriever
Section titled “retriever”retriever: Retriever;The underlying retriever for each sub-query (typically FusionRetriever).
subQueryTopK?
Section titled “subQueryTopK?”optional subQueryTopK?: number;TopK results per sub-query. Default: 3.
optional topK?: number;Final topK after merge + dedup. Default: 5.