rerank

Function

Calls the TEI service to calculate the relevance score of a text.

Prototype

def rerank(query, texts, batch_size)

Parameters

Parameter

Data Type

Required/Optional

Description

query

String

Required

Question, which participates in the relevance score calculation with all texts. The value is a string within the length range of [1, 1024 × 1024].

texts

List[str]

Required

Text list. The list length range is (0, 1000 × 1000], and the string length range 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.