rerank

Function

Calculates the relevance score of the text list and query.

Prototype

def rerank(query, texts, batch_size)

Parameters

Parameter

Data Type

Required/Optional

Description

query

String

Required

Question for relevance score calculation with all texts. The value is a string with a length range of [1, 1024 × 1024].

texts

List[str]

Required

Text list. The list length range is [1, 1000 × 1000], and the length range of a single text in the list is [1, 1024 × 1024].

batch_size

Integer

Optional

Batch size. texts of batch_size is combined for embedding each time. The value range is [1, 1024]. The default value is 32.

Return Value

Data Type

Description

numpy.array

NumPy array with the same length as texts, indicating the relevance score of each text and query.