import type { LLMProviderConfig, SearchResult } from "../types.js"; import type { Logger } from "../utils/logger.js"; export type RerankProviderName = "cohere" | "voyage" | "llm"; export interface RerankConfig { provider: RerankProviderName; /** Defaults: cohere "rerank-v3.5", voyage "rerank-2.5". Ignored by "llm"; set `llm.model`. */ model?: string; apiKey?: string; baseURL?: string; /** For provider "llm"; defaults to the document's `llm`. */ llm?: LLMProviderConfig; /** Results retrieved and passed to the reranker before the topK cut (default max(30, topK)). */ candidates?: number; } /** Your own reranker: return the hits best first; RAGLite keeps the first topK. */ export type Reranker = (query: string, hits: SearchResult[]) => Promise; export declare const DEFAULT_RERANK_MODELS: { readonly cohere: "rerank-v3.5"; readonly voyage: "rerank-2.5"; }; /** How many results to retrieve before reranking. */ export declare function rerankCandidates(rerank: RerankConfig | Reranker, topK: number): number; /** * Reorders `hits` with the reranker and keeps the first `topK`. Each result's * `score` becomes the reranker's score, kept in `scores.rerank` next to the * retrieval scores. A reranker that fails at run time logs a warning and the * original order is kept; a misconfigured one throws ConfigError. */ export declare function rerankHits(query: string, hits: SearchResult[], rerank: RerankConfig | Reranker, topK: number, options: { logger: Logger; llm?: LLMProviderConfig; signal?: AbortSignal; }): Promise; /** Zero-based passage indexes from the first JSON array of numbers in `text`. */ export declare function parseRanking(text: string, count: number): number[];