File size: 306 Bytes
4dda9f7
 
 
 
 
 
 
1
2
3
4
5
6
7
8
from llama_index.postprocessor.cohere_rerank import CohereRerank

def reranker(cohere_key):
    # Define the Cohere Reranking object to return only the first two highest ranking chunks.
    cohere_rerank3 = CohereRerank(top_n=2, api_key=cohere_key,model = 'rerank-english-v3.0')
    return cohere_rerank3