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
Test
RAM authorization
|
Action |
Access level |
Resource type |
Condition key |
Dependent action |
|
gpdb:Rerank |
list |
*DBInstance
|
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 |
| 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:
Note
Splitting example
|
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 |
| 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.