文档重排序
curl --request POST \
--url https://zero.cat/v1/rerank \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"model": "rerank-english-v2.0",
"query": "<string>",
"documents": [
"<string>"
],
"top_n": 123,
"return_documents": false
}
'import requests
url = "https://zero.cat/v1/rerank"
payload = {
"model": "rerank-english-v2.0",
"query": "<string>",
"documents": ["<string>"],
"top_n": 123,
"return_documents": False
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
model: 'rerank-english-v2.0',
query: '<string>',
documents: ['<string>'],
top_n: 123,
return_documents: false
})
};
fetch('https://zero.cat/v1/rerank', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));{
"id": "<string>",
"results": [
{
"index": 123,
"relevance_score": 123,
"document": {}
}
],
"meta": {}
}重排序
文档重排序
根据查询对文档列表进行相关性重排序
POST
/
v1
/
rerank
文档重排序
curl --request POST \
--url https://zero.cat/v1/rerank \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"model": "rerank-english-v2.0",
"query": "<string>",
"documents": [
"<string>"
],
"top_n": 123,
"return_documents": false
}
'import requests
url = "https://zero.cat/v1/rerank"
payload = {
"model": "rerank-english-v2.0",
"query": "<string>",
"documents": ["<string>"],
"top_n": 123,
"return_documents": False
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
model: 'rerank-english-v2.0',
query: '<string>',
documents: ['<string>'],
top_n: 123,
return_documents: false
})
};
fetch('https://zero.cat/v1/rerank', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));{
"id": "<string>",
"results": [
{
"index": 123,
"relevance_score": 123,
"document": {}
}
],
"meta": {}
}授权
ZeroCat API 密钥(sk- 开头),在控制台「API 密钥」页面创建。
格式:Authorization: Bearer sk-xxxxxx
请求体
application/json

