Create a new LLMReranker instance.
Not used for LLM reranker, pass empty string
Not used for LLM reranker, pass empty string
ID of the AI Prompt to use for reranking
User context for executing the prompt
ProtectedapiOnly sub-classes can access the API key
Get the model name used for this reranker
Get the prompt ID used for reranking
ProtectedcreateCreate a standardized error response. Used internally when validation fails or an exception occurs.
ProtecteddoRerank documents using an LLM via the AI Prompts system.
The method:
ProtectedfilterFilter results by minimum relevance threshold. Utility method for implementations that need to filter low-scoring results.
Rerank documents based on their relevance to a query. This is the main entry point for reranking operations.
The method:
Reranking parameters including query and documents
Promise resolving to RerankResponse with reranked results
ProtectedsortSort results by relevance score in descending order. Utility method for implementations.
LLM-based implementation of the BaseReranker class. Uses AI Prompts to perform semantic reranking via large language models.
This reranker is useful when:
Configuration:
Usage: