Jina AI 重排序格式(Rerank)
Jina AI 重排序格式(Rerank)
Jina AI Rerank
在New API中,Jina AI的rerank格式被采用为标准格式。所有其他供应商(如Xinference、Cohere等)的rerank响应都会被格式化为Jina AI的格式,以提供统一的开发体验。
📝 简介
💡 请求示例
基础重排序请求 ✅
{
"results": [
{
"document": {
"text": "Organic skincare for sensitive skin with aloe vera and chamomile..."
},
"index": 0,
"relevance_score": 0.8783142566680908
},
{
"document": {
"text": "Bio-Hautpflege für empfindliche Haut mit Aloe Vera und Kamille..."
},
"index": 2,
"relevance_score": 0.7624675869941711
}
],
"usage": {
"prompt_tokens": 815,
"completion_tokens": 0,
"total_tokens": 815
}
}
📮 请求
端点
POST /v1/rerank
鉴权方法
Authorization: Bearer $NEWAPI_API_KEY
$NEWAPI_API_KEY
是您的 API 密钥。请求体参数
model
query
top_n
documents
📥 响应
成功响应
results
document
: 包含文档文本的对象index
: 文档在原始列表中的索引relevance_score
: 相关性分数(0-1之间)usage
prompt_tokens
: 提示使用的 token 数completion_tokens
: 补全使用的 token 数total_tokens
: 总 token 数prompt_tokens_details
: 提示 token 详细信息cached_tokens
: 缓存的 token 数audio_tokens
: 音频 token 数completion_tokens_details
: 补全 token 详细信息reasoning_tokens
: 推理 token 数audio_tokens
: 音频 token 数accepted_prediction_tokens
: 接受的预测 token 数rejected_prediction_tokens
: 拒绝的预测 token 数错误响应
400 Bad Request
: 请求参数无效401 Unauthorized
: API 密钥无效或未提供429 Too Many Requests
: 请求频率超限500 Internal Server Error
: 服务器内部错误💡 最佳实践
查询优化建议
1.
2.
3.
文档处理建议
1.
2.
3.
性能优化
1.
2.
3.
多语言支持
修改于 2025-05-30 01:38:46