Reranking
Scores documents against a query using a reranking model.#
/lmkit/v1/rerank/scoreComputes relevance scores for one or more documents against a query. Uses a cross-encoder or embedding-based reranking model to produce sigmoid-normalized similarity scores. Supports batch scoring. If processing exceeds the configured timeout, returns 202 Accepted with a job_id. Poll GET /lmkit/v1/jobs/ for status and results.
Request body
application/json ·
| Property | Type | Description |
|---|---|---|
queryrequired | string | The query text to score documents against. |
documentsrequired | string[] | A list of text passages to score against the query. |
model | string | The reranking model identifier. If not provided, the default reranking model is used. |
normalize | boolean | If true, scores are normalized to [0,1] range using sigmoid. Defaults to true. |
top_k | object (int32) | If specified, returns only the top K results sorted by score descending. If not specified, returns all results. |
Responses
| Status | Type | Description |
|---|---|---|
| 200 | OK | |
| 202 | Accepted | |
| 400 | Bad Request |
curl -X POST "$LMKIT_ONE_URL/lmkit/v1/rerank/score" \
-H "Authorization: Bearer $LMKIT_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"query": "string",
"documents": [
"string"
],
"model": "string",
"normalize": true,
"top_k": "string"
}'Reranks search results with alpha-blended score fusion.#
/lmkit/v1/rerank/rerankTakes caller-supplied search results (each carrying its raw similarity score) and applies a reranking model to produce blended scores. The final score is computed as: (alpha * raw_similarity) + ((1 - alpha) * reranker_score). Results are returned sorted by blended score descending. If processing exceeds the configured timeout, returns 202 Accepted with a job_id. Poll GET /lmkit/v1/jobs/ for status and results.
Request body
application/json ·
| Property | Type | Description |
|---|---|---|
queryrequired | string | The query text to rerank results against. |
resultsrequired | [] | The search results to rerank. Each must include content and raw_similarity. |
model | string | The reranking model identifier. If not provided, the default reranking model is used. |
alpha | object (float) | Blending factor between original similarity and reranker score. 0.0 = original similarity only, 0.5 = equal blend (default), 1.0 = reranker score only. |
top_k | object (int32) | If specified, returns only the top K results after reranking. If not specified, returns all results. |
normalize | boolean | If true, reranker scores are normalized using sigmoid before blending. Defaults to true. |
Responses
| Status | Type | Description |
|---|---|---|
| 200 | OK | |
| 202 | Accepted | |
| 400 | Bad Request |
curl -X POST "$LMKIT_ONE_URL/lmkit/v1/rerank/rerank" \
-H "Authorization: Bearer $LMKIT_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"query": "string",
"results": [
{
"content": "string",
"raw_similarity": "string",
"collection_identifier": "string",
"section_identifier": "string",
"metadata": {}
}
],
"model": "string",
"alpha": 0.5,
"top_k": "string",
"normalize": true
}'