Cohere Reranker
The Cohere Reranker is a postprocessor that uses the Cohere API to rerank the results of a search query.
Setup
Firstly, you will need to install the llamaindex
package.
pnpm install llamaindex
Now, you will need to sign up for an API key at Cohere. Once you have your API key you can import the necessary modules and create a new instance of the CohereRerank
class.
import {
CohereRerank,
Document,
OpenAI,
VectorStoreIndex,
serviceContextFromDefaults,
} from "llamaindex";