curl --request POST \
--url https://open.bigmodel.cn/api/paas/v4/rerank \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '{
"model": "rerank",
"query": "查询候选文本A",
"documents": [
"需要打分的候选文本A",
"需要打分的候选文本B"
]
}'
{
"created": 1732083164,
"id": "20241120141244890ab4ee4af84acf",
"request_id": "1111111111",
"results": [
{
"document": "Washington, D.C. is the capital of the United States.",
"index": 1,
"relevance_score": 0.99866986
}
],
"usage": {
"prompt_tokens": 72,
"total_tokens": 72
}
}
Rerank 用于文本重排序,通过接收用户的查询文本及候选文本列表,使用模型计算候选文本与查询文本的相关性得分并返回分数。适用于智能问答、信息检索等场景。
curl --request POST \
--url https://open.bigmodel.cn/api/paas/v4/rerank \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '{
"model": "rerank",
"query": "查询候选文本A",
"documents": [
"需要打分的候选文本A",
"需要打分的候选文本B"
]
}'
{
"created": 1732083164,
"id": "20241120141244890ab4ee4af84acf",
"request_id": "1111111111",
"results": [
{
"document": "Washington, D.C. is the capital of the United States.",
"index": 1,
"relevance_score": 0.99866986
}
],
"usage": {
"prompt_tokens": 72,
"total_tokens": 72
}
}
使用以下格式进行身份验证:Bearer <your api key>
业务处理成功
The response is of type object
.