JinaRerankRetriever
BaseRetriever using the Jina AI Reranker
model.
This retriever uses Jina AI’s reranking API to re-order retrieved documents
based on their relevance to the query. It supports multilingual retrieval
across 100+ languages.
Parameters:
- model_name (Union[JinaRerankerModelType, str]): The model name to use for re-ranking.
- api_key (str, optional): The API key for authenticating with the Jina AI service.
- References:
- https: //jina.ai/reranker/
init
- model_name (Union[JinaRerankerModelType, str]): The name of the model to be used for re-ranking. Can be a JinaRerankerModelType enum value or a string. Defaults to
JinaRerankerModelType.JINA_RERANKER_V2_BASE_MULTILINGUAL. - api_key (Optional[str]): The API key for authenticating requests to the Jina AI API. If not provided, the method will attempt to retrieve the key from the environment variable ‘JINA_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
BaseRetrieverlikeVectorRetriever. Each dict should have a ‘text’ key containing the document text. - top_k (int, optional): The number of top results to return during retrieval. Must be a positive integer. Defaults to
DEFAULT_TOP_K_RESULTS.