Skip to content

Reranks the relevance of sources based on queries

Description

Reranks the relevance of sources based on queries. For more information, see Improve the relevance of query responses with a reranker model.

Usage

bedrockagentruntime_rerank(nextToken, queries, rerankingConfiguration,
  sources)

Arguments

  • nextToken

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

[required] An array of objects, each of which contains information about a query to submit to the reranker model.

  • rerankingConfiguration

[required] Contains configurations for reranking.

  • sources

[required] An array of objects, each of which contains information about the sources to rerank.

Value

A list with the following syntax:

list(
  nextToken = "string",
  results = list(
    list(
      document = list(
        jsonDocument = list(),
        textDocument = list(
          text = "string"
        ),
        type = "TEXT"|"JSON"
      ),
      index = 123,
      relevanceScore = 123.0
    )
  )
)

Request syntax

svc$rerank(
  nextToken = "string",
  queries = list(
    list(
      textQuery = list(
        text = "string"
      ),
      type = "TEXT"
    )
  ),
  rerankingConfiguration = list(
    bedrockRerankingConfiguration = list(
      modelConfiguration = list(
        additionalModelRequestFields = list(
          list()
        ),
        modelArn = "string"
      ),
      numberOfResults = 123
    ),
    type = "BEDROCK_RERANKING_MODEL"
  ),
  sources = list(
    list(
      inlineDocumentSource = list(
        jsonDocument = list(),
        textDocument = list(
          text = "string"
        ),
        type = "TEXT"|"JSON"
      ),
      type = "INLINE"
    )
  )
)