xinference.client.restful.restful_client.RESTfulRerankModelHandle.rerank#

RESTfulRerankModelHandle.rerank(documents: List[str | Dict[str, Any]], query: str | Dict[str, Any], top_n: int | None = None, max_chunks_per_doc: int | None = None, return_documents: bool | None = None, return_len: bool | None = None, **kwargs)[source]#

Returns an ordered list of documents ordered by their relevance to the provided query.

Parameters:
  • query (Union[str, Dict[str, Any]]) – Text or multimodal query.

  • documents (List[Union[str, Dict[str, Any]]]) – Text or multimodal documents to rerank.

  • top_n (int) – The number of results to return, defaults to returning all results

  • max_chunks_per_doc (int) – The maximum number of chunks derived from a document

  • return_documents (bool) – if return documents

  • return_len (bool) – if return tokens len

Returns:

The scores of documents ordered by their relevance to the provided query

Return type:

Scores

Raises:

RuntimeError – Report the failure of rerank and provide the error message.