リランキング
ドキュメント群を、クエリとの関連性でスコアリングして並べ替えます(Jina / Cohere Rerank 互換)。RAG のリコール結果を絞り込むのによく使われます。
RequestREQUEST
POST
https://test.kailin.com.cn/v1/rerankResponseRESPONSE
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
}'
リクエストボディ
| パラメーター | 型 | 必須 | 説明 |
|---|---|---|---|
model | string | はい | リランキングモデル — 利用可能な一覧を参照 |
query | string | はい | クエリテキスト |
documents | array | はい | ドキュメント。文字列または { "text": "..." } オブジェクト |
top_n | integer | いいえ | 上位 N 件だけ返す。デフォルトはすべて |
return_documents | boolean | いいえ | 結果に元テキストを含める。デフォルトは 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 件に絞り込み → チャットモデルのコンテキストとして渡す。