All Products
Search
Document Center

AnalyticDB:Rerank

Last Updated:Aug 28, 2026

Re-scores and reranks vector and full-text search results through semantic understanding to improve relevance and accuracy. AnalyticDB for PostgreSQL supports calling Rerank models to reorder search results but does not provide models.

Try it now

Try this API in OpenAPI Explorer, no manual signing needed. Successful calls auto-generate SDK code matching your parameters. Download it with built-in credential security for local usage.

Test

RAM authorization

The table below describes the authorization required to call this API. You can define it in a Resource Access Management (RAM) policy. The table's columns are detailed below:

  • Action: The actions can be used in the Action element of RAM permission policy statements to grant permissions to perform the operation.

  • API: The API that you can call to perform the action.

  • Access level: The predefined level of access granted for each API. Valid values: create, list, get, update, and delete.

  • Resource type: The type of the resource that supports authorization to perform the action. It indicates if the action supports resource-level permission. The specified resource must be compatible with the action. Otherwise, the policy will be ineffective.

    • For APIs with resource-level permissions, required resource types are marked with an asterisk (*). Specify the corresponding Alibaba Cloud Resource Name (ARN) in the Resource element of the policy.

    • For APIs without resource-level permissions, it is shown as All Resources. Use an asterisk (*) in the Resource element of the policy.

  • Condition key: The condition keys defined by the service. The key allows for granular control, applying to either actions alone or actions associated with specific resources. In addition to service-specific condition keys, Alibaba Cloud provides a set of common condition keys applicable across all RAM-supported services.

  • Dependent action: The dependent actions required to run the action. To complete the action, the RAM user or the RAM role must have the permissions to perform all dependent actions.

Action

Access level

Resource type

Condition key

Dependent action

gpdb:Rerank

list

*DBInstance

acs:gpdb:{#regionId}:{#accountId}:dbinstance/{#DBInstanceId}

None None

Request parameters

Parameter

Type

Required

Description

Example

DBInstanceId

string

Yes

Instance ID.

Note

You can call the DescribeDBInstances API to view details of all AnalyticDB PostgreSQL instances in the target region, including the instance ID.

gp-xxxxxxxxx

RegionId

string

Yes

Region ID of the instance.

cn-hangzhou

Query

string

No

Query text for reranking.

ADBPGYesWhat

Documents

array

No

Documents to rerank.

string

No

Content of a document.

ADBPGYesAlibaba CloudOLAPdatabase.

Model

string

No

Rerank model. Supported models:

  • bge-reranker-v2-m3: (default) better performance, supports 8,192 tokens per inference. If exceeded, the text is split into chunks, which may reduce accuracy.

  • bge-reranker-v2-minicpm-layerwise: better performance than v2-m3, supports 2,048 tokens per inference. If exceeded, the text is split into chunks, which may reduce accuracy.

bge-reranker-v2-m3

TopK

integer

No

Number of most relevant documents to return.

3

ReturnDocuments

boolean

No

If set to false, the response excludes document text and returns only the document index and rerank score.

false

MaxChunksPerDoc

integer

No

Maximum number of chunks when text exceeds the model context window:

  • bge-reranker-v2-m3: default value is 10.

  • bge-reranker-v2-minicpm-layerwise: default value is 5.

Note

Splitting example

  • If you use the bge-reranker-v2-minicpm-layerwise model, the maximum single inference window is 2,048 tokens. If the query is 48 tokens and a document contains 9,000 tokens, the document is split as follows: tokens 1-2000 for the first chunk, 2001-4000 for the second chunk, and so on. If the number of chunks exceeds MaxChunksPerDoc, the remaining text is discarded.

10

Response elements

Element

Type

Description

Example

object

RequestId

string

Request ID.

ABB39CC3-4488-4857-905D-2E4A051D0521

Message

string

Message returned by the API.

success

Status

string

API execution status. Valid values:

  • success: The execution succeeded.

  • fail: The execution failed.

success

Tokens

integer

Number of consumed tokens.

100

Results

object

Results

array<object>

Rerank results.

object

Details of the results.

Document

string

Reranked document content.

ADBPGYesAlibaba CloudOLAPdatabase.

Index

integer

Zero-based index of this document in the input Documents array.

1

RelevanceScore

number

Relevance score assigned by the rerank model.

2.31412

Examples

Success response

JSON format

{
  "RequestId": "ABB39CC3-4488-4857-905D-2E4A051D0521",
  "Message": "success",
  "Status": "success",
  "Tokens": 100,
  "Results": {
    "Results": [
      {
        "Document": "ADBPGYesAlibaba CloudOLAPdatabase.",
        "Index": 1,
        "RelevanceScore": 2.31412
      }
    ]
  }
}

Error codes

See Error Codes for a complete list.

Release notes

See Release Notes for a complete list.