Skip to content

LLMReranker

Reranker that uses a language model to judge relevance.

Each candidate document is presented to the LLM alongside the query. The LLM scores each candidate on a 0-10 scale and optionally provides a reason for the score. Results are reordered by LLM-assigned score.

new LLMReranker(options): LLMReranker;
Parameter Type

options

LLMRerankerOptions

LLMReranker

rerank(
query,
results,
options?): Promise<RetrievalResult[]>;

Rerank retrieval results by relevance to the query.

Parameter Type

query

string

results

RetrievalResult[]

options?

RerankerOptions

Promise<RetrievalResult[]>

Reranker.rerank