メインコンテンツへスキップ

リランキング

POST /v1/rerank

ドキュメント群を、クエリとの関連性でスコアリングして並べ替えます(Jina / Cohere Rerank 互換)。RAG のリコール結果を絞り込むのによく使われます。

RequestREQUEST
POSThttps://test.kailin.com.cn/v1/rerank
ResponseRESPONSE
Fill in the request and hit Send — the response shows up here

リクエスト​

curl https://test.kailin.com.cn/v1/rerank \
-H "Content-Type: application/json" \
-H "Authorization: Bearer sk-your-token" \
-d '{
"model": "jina-reranker-v2-base-multilingual",
"query": "What is vector search",
"documents": [
"Vector search computes semantic similarity over embedding vectors",
"The weather is nice today",
"RAG systems typically retrieve first, then rerank"
],
"top_n": 2
}'

リクエストボディ​

パラメーター型必須説明
modelstringはいリランキングモデル — 利用可能な一覧を参照
querystringはいクエリテキスト
documentsarrayはいドキュメント。文字列または { "text": "..." } オブジェクト
top_nintegerいいえ上位 N 件だけ返す。デフォルトはすべて
return_documentsbooleanいいえ結果に元テキストを含める。デフォルトは false

レスポンス​

{
"results": [
{
"index": 0,
"relevance_score": 0.93,
"document": { "text": "Vector search computes semantic similarity over embedding vectors" }
},
{
"index": 2,
"relevance_score": 0.71,
"document": { "text": "RAG systems typically retrieve first, then rerank" }
}
],
"usage": {
"total_tokens": 120
}
}
フィールド説明
results[].index入力 documents 配列内での元のインデックス
results[].relevance_score関連性スコア。高いほど関連が強い
usage.total_tokens課金対象トークン(チャネルによっては存在しない場合があります)
ヒント

典型的なパターン:ベクトル検索で上位 50 件をリコール → rerank で上位 5 件に絞り込み → チャットモデルのコンテキストとして渡す。