Returns an ordered list of documents ordered by their relevance to the provided query.
rerank(
self,
documents: Sequence[Union[str, Document, dict]],
query: str,
*,
model: Optional[str] = None,
top_n: Optional[int] = 1
) -> List[Dict[str, Any]]| Name | Type | Description |
|---|---|---|
query* | str | The query to use for reranking. |
documents* | Sequence[Union[str, Document, dict]] | A sequence of documents to rerank. |
model | Optional[str] | Default: NoneThe model to use for re-ranking. Default to self.model. |
top_n * | unknown | The number of results to return. If None returns all results. Defaults to self.top_n. |
max_chunks_per_doc * | unknown | The maximum number of chunks derived from a document. |