JinaRerankerToolkit
init
- timeout (Optional[float]): The timeout value for API requests in seconds. If None, no timeout is applied. (default: :obj:
None
) - model_name (str): The reranker model name. (default: :obj:
"jinaai/jina-reranker-m0"
) - device (Optional[str]): Device to load the model on. If None, will use CUDA if available, otherwise CPU. Only effective when use_api=False. (default: :obj:
None
) - use_api (bool): A flag to switch between local model and API. (default: :obj:
True
)
_sort_documents
- documents (List[str]): List of documents to sort.
- scores (List[float]): Corresponding scores for each document.
_call_jina_api
- data (Dict[str]): The data to be passed into the api body.
rerank_text_documents
- query (str): The text query for reranking.
- documents (List[str]): List of text documents to be reranked.
- max_length (int): Maximum token length for processing. (default: :obj:
1024
)
rerank_image_documents
- query (str): The text query for reranking.
- documents (List[str]): List of image URLs or paths to be reranked.
- max_length (int): Maximum token length for processing. (default: :obj:
2048
)
image_query_text_documents
- image_query (str): The image URL or path used as query.
- documents (List[str]): List of text documents to be reranked.
- max_length (int): Maximum token length for processing. (default: :obj:
2048
)
image_query_image_documents
- image_query (str): The image URL or path used as query.
- documents (List[str]): List of image URLs or paths to be reranked.
- max_length (int): Maximum token length for processing. (default: :obj:
2048
)