How Reranking Works
The vector database finds candidates quickly using embedding similarity. The reranker then reads each candidate alongside the query and produces a more accurate relevance score.CohereReranker
Uses Cohere’s reranking API:str
default:"rerank-multilingual-v3.0"
Cohere reranking model. Options:
rerank-multilingual-v3.0, rerank-english-v3.0.str
Cohere API key. Defaults to the
COHERE_API_KEY environment variable.int
Maximum number of results to return after reranking. If not set, returns all reranked results.
Requires the
cohere package. Install with pip install cohere.Using with Knowledge
rerank=False to skip reranking for a specific query:
Standalone Usage
Creating a Custom Reranker
SubclassReranker: