重排序 (Rerank)
重排序(Rerank)接口用于在初步检索出候选文档列表后,使用更强大的交叉注意力(Cross-Attention)模型对候选文档根据与查询(Query)的相关性进行二次精确排序。该接口兼容 Cohere / Jina 等重排序服务。
POST /v1/rerank| 参数 | 类型 | 必填 | 默认值 | 说明 |
|---|---|---|---|---|
model | string | ✅ | - | 重排序模型 ID(例如 jina-reranker-v2-base-multilingual, rerank-v3.5)。 |
query | string | ✅ | - | 搜索或检索使用的查询语句。 |
documents | array | ✅ | - | 需要重排序的候选文档(字符串数组)。 |
top_n | integer | ❌ | - | 限制返回的相关文档数量。 |
cURL 请求
Section titled “cURL 请求”curl https://api.easytakeai.com/v1/rerank \ -H "Content-Type: application/json" \ -H "Authorization: Bearer YOUR_API_KEY" \ -d '{ "model": "jina-reranker-v2-base-multilingual", "query": "敏感肌如何进行面部护理", "documents": [ "天然有机无添加成分的护肤品更适合敏感肌使用。", "新型化妆技术主要侧重于色彩的搭配和修饰。", "针对干性或易敏皮肤,温和洁面和补水至关重要。" ], "top_n": 2 }'JSON 响应示例
Section titled “JSON 响应示例”{ "results": [ { "index": 0, "relevance_score": 0.8953, "document": "天然有机无添加成分的护肤品更适合敏感肌使用。" }, { "index": 2, "relevance_score": 0.8124, "document": "针对干性或易敏皮肤,温和洁面和补水至关重要。" } ], "usage": { "total_tokens": 42 }}