Docs
Cohere Reranker
Cohere Reranker
Supercharge your RAG applications with Cohere's advanced reranking API. Reorder and refine document relevance effortlessly.
Installation
Install peer dependencies:
Add Environment Variables
Copy the code
Add the following code to your utils/reranker.ts
file:
Usage
Props
CohereReranking
Prop | Type | Description | Default |
---|---|---|---|
apiKey | string | The api key of cohere. | "" |
model | string(optional) | The model name of cohere reranker. | "rerank-english-v3.0" |
topN | number(optional) | The number of documents to return in results. | Length of document |
maxChunksPerDoc | number(optional) | The maximum number of chunks to produce internally from a document. | 10 |
rankDocuments
Prop | Type | Description |
---|---|---|
documents | string[] | The list of documents to be reranked. |
query | string | The query of the user. |
returnDocuments | boolean(optional) | If false, returns results without the doc text. |
Credits
This component is built on top of Cohere Rerank