rerank¶
Operation¶
rerank
async
¶
rerank(input: RerankInput, plugins: list[Plugin] | None = None) -> RerankOutput
Reranks the relevance of sources based on queries. For more information, see Improve the relevance of query responses with a reranker model.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
input
|
RerankInput
|
An instance of |
required |
plugins
|
list[Plugin] | None
|
A list of callables that modify the configuration dynamically. Changes made by these plugins only apply for the duration of the operation execution and will not affect any other operation invocations. |
None
|
Returns:
| Type | Description |
|---|---|
RerankOutput
|
An instance of |
Input¶
RerankInput
dataclass
¶
Dataclass for RerankInput structure.
Attributes¶
next_token
class-attribute
instance-attribute
¶
next_token: str | None = None
If the total number of results was greater than could fit in a response,
a token is returned in the nextToken field. You can enter that token
in this field to return the next batch of results.
queries
class-attribute
instance-attribute
¶
queries: list[RerankQuery] | None = field(repr=False, default=None)
An array of objects, each of which contains information about a query to submit to the reranker model.
reranking_configuration
class-attribute
instance-attribute
¶
reranking_configuration: RerankingConfiguration | None = None
Contains configurations for reranking.
sources
class-attribute
instance-attribute
¶
sources: list[RerankSource] | None = field(repr=False, default=None)
An array of objects, each of which contains information about the sources to rerank.
Output¶
RerankOutput
dataclass
¶
Dataclass for RerankOutput structure.
Attributes¶
next_token
class-attribute
instance-attribute
¶
next_token: str | None = None
If the total number of results is greater than can fit in the response,
use this token in the nextToken field when making another request to
return the next batch of results.
results
instance-attribute
¶
results: list[RerankResult]
An array of objects, each of which contains information about the results of reranking.