CohereRerankRetriever
BaseRetriever
using the Cohere Re-ranking
model.
Parameters:
- model_name (str): The model name to use for re-ranking.
- api_key (Optional[str]): The API key for authenticating with the Cohere service.
- References:
- https: //txt.cohere.com/rerank/
init
- model_name (str): The name of the model to be used for re-ranking. Defaults to ‘rerank-multilingual-v2.0’.
- api_key (Optional[str]): The API key for authenticating requests to the Cohere API. If not provided, the method will attempt to retrieve the key from the environment variable ‘COHERE_API_KEY’.
query
- query (str): Query string for information retriever.
- retrieved_result (List[Dict[str, Any]]): The content to be re-ranked, should be the output from
BaseRetriever
likeVectorRetriever
. - top_k (int, optional): The number of top results to return during retriever. Must be a positive integer. Defaults to
DEFAULT_TOP_K_RESULTS
.