CohereReranker
Reranker backed by the Cohere Rerank API.
Uses fetch() directly — no SDK dependency. Compatible with all
runtimes including Cloudflare Workers, Vercel Edge, and Deno Deploy.
The Cohere Rerank API accepts a query and a list of documents, and returns relevance scores for each document. This reranker maps those scores back onto RetrievalResult objects and sorts by relevance.
Implements
Section titled “Implements”Constructors
Section titled “Constructors”Constructor
Section titled “Constructor”new CohereReranker(options?): CohereReranker;Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
|
|
Returns
Section titled “Returns”CohereReranker
Methods
Section titled “Methods”rerank()
Section titled “rerank()”rerank( query, results,options?): Promise<RetrievalResult[]>;Rerank retrieval results by relevance to the query.
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
|
|
|
|
|
|
|
|
Returns
Section titled “Returns”Promise<RetrievalResult[]>