重排
curl --request POST \
--url https://api.hubto.ai/v1/rerank \
--header 'Authorization: <authorization>' \
--header 'Content-Type: application/json' \
--data '
{
"model": "<string>",
"query": "<string>",
"documents": [
"<string>"
]
}
'import requests
url = "https://api.hubto.ai/v1/rerank"
payload = {
"model": "<string>",
"query": "<string>",
"documents": ["<string>"]
}
headers = {
"Authorization": "<authorization>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: '<authorization>', 'Content-Type': 'application/json'},
body: JSON.stringify({model: '<string>', query: '<string>', documents: ['<string>']})
};
fetch('https://api.hubto.ai/v1/rerank', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));{
"results": [
{}
]
}接口示例
重排
Rerank 文本重排接口。
POST
/
v1
/
rerank
重排
curl --request POST \
--url https://api.hubto.ai/v1/rerank \
--header 'Authorization: <authorization>' \
--header 'Content-Type: application/json' \
--data '
{
"model": "<string>",
"query": "<string>",
"documents": [
"<string>"
]
}
'import requests
url = "https://api.hubto.ai/v1/rerank"
payload = {
"model": "<string>",
"query": "<string>",
"documents": ["<string>"]
}
headers = {
"Authorization": "<authorization>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: '<authorization>', 'Content-Type': 'application/json'},
body: JSON.stringify({model: '<string>', query: '<string>', documents: ['<string>']})
};
fetch('https://api.hubto.ai/v1/rerank', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));{
"results": [
{}
]
}用途
用于对候选文本结果做相关性重排。请求头
string
默认值:"Bearer YOUR_API_KEY"
必填
Bearer 鉴权请求头。
请求体
string
默认值:"rerank-v1"
必填
Rerank 模型名称。
string
默认值:"统一大模型网关"
必填
查询文本。
string[]
默认值:"[\"HubTo 提供统一 API 入口。\",\"今天上海天气晴。\"]"
必填
候选文本数组。
integer
默认值:"3"
可选,返回前 N 条重排结果。
示例请求体
{
"model": "rerank-v1",
"query": "统一大模型网关",
"documents": [
"HubTo 提供统一 API 入口。",
"今天上海天气晴。"
]
}
响应
object[]
带相关性分数的重排结果。
⌘I