Interface HybridRetrieverOptions

Options for constructing a HybridRetriever.

interface HybridRetrieverOptions {
    memoryStore: MemoryStore;
    bm25Config?: BM25Config;
    rerankerService?: RerankerService;
    hydeRetriever?: HydeRetriever;
    splitAmbiguousThreshold?: number;
    defaultDenseWeight?: number;
    defaultSparseWeight?: number;
    defaultRrfK?: number;
    factStore?: FactStore;
    factGraphQueryClassifier?: FactGraphQueryClassifier;
}

Properties

memoryStore: MemoryStore
bm25Config?: BM25Config

BM25 config (k1, b, optional tokenizer). Defaults match BM25Index.

rerankerService?: RerankerService

Optional neural reranker. When provided, the merged pool is reranked before truncation. Passing the same reranker the baseline uses is the matched-ablation path.

hydeRetriever?: HydeRetriever

Optional HyDE retriever for query expansion (Step 4). When set, each retrieve() call generates a hypothesis and uses it as the query for BOTH dense (memoryStore.query) and sparse (bm25.search). The reranker continues to use the ORIGINAL user query so it scores documents against real user intent, not the hypothesis. HyDE generation is non-critical — errors fall back to the raw query without aborting retrieval.

splitAmbiguousThreshold?: number

Step-6: enable split-on-ambiguous rerank refinement. When set to a value in (0, 1], the bottom fraction of traces by first-pass rerank score are split at sentence boundaries, rescored with a second rerank call (same query), and replaced by their better half ONLY IF the better half outscores the original. Monotonic.

Default: undefined (no split, Step 3 behavior preserved).

defaultDenseWeight?: number

Default dense weight in RRF.

Default

0.7
defaultSparseWeight?: number

Default sparse weight in RRF.

Default

0.3
defaultRrfK?: number

Default RRF constant.

Default

60
factStore?: FactStore

Step-9: optional FactStore of (subject, predicate) → Fact[] tuples extracted at session-ingest time. When present AND the query classifier extracts at least one (subject, predicate) pair from the query, the latest fact per pair is prepended as a synthetic ScoredMemoryTrace (retrievalScore: 1.0, sourceType: 'fact_graph') to the merged pool BEFORE rerank. Preserves literal object tokens where summary-based approaches (Steps 5/7/8) paraphrased them away.

factGraphQueryClassifier?: FactGraphQueryClassifier

Step-9: optional query classifier. Given the user's query, returns (subject, predicate) pairs to look up in the factStore, plus whether the query is temporal (in which case ALL facts for a subject are prepended, not just the latest). When absent and factStore is set, a keyword-based default is used.