重新排序文件
post/v1/rerank
依與查詢的相關性重新排序文件清單。
驗證
把 OLETOKEN 的 API Key 作為 Bearer Token 放進 Authorization 請求標頭。金鑰在控制台的「API 金鑰」頁建立。
Authorization: Bearer $OLETOKEN_API_KEY請求主體
Content-Type:application/json
| 欄位 | 類型 | 必填 | 說明 |
|---|---|---|---|
| model | string | — | |
| query | string | 查詢文字 | |
| documents | string | object[] | 要重新排序的文件 | |
| top_n | integer | — | 回傳前 N 筆結果 |
| return_documents | booleandefault: false | — | — |
回應
200已重新排序文件
| 欄位 | 類型 | 必填 | 說明 |
|---|---|---|---|
| id | string | — | — |
| results | object[] | — | — |
| index | integer | — | — |
| relevance_score | number | — | — |
| document | object | — | — |
| meta | object | — | — |
請求範例
curl -X POST 'https://api.oletoken.ai/v1/rerank' \
-H "Authorization: Bearer $OLETOKEN_API_KEY" \
-H 'Content-Type: application/json' \
-d '{
"model": "rerank-english-v2.0",
"query": "string",
"documents": []
}'
