Endpoints
Reranking
POST /rerankings
Score and rank documents by their relevance to queries with an Isaacus reranker.
Base URL: https://api.isaacus.com/v1
Request body
| Field | Type | Description |
|---|---|---|
model | string | string | The ID of the model to use for reranking, being either a reranking model or universal classification model. |
query | string | The query to evaluate the relevance of the texts to. |
texts | array[string] | The texts to rerank. |
top_n | integer | null | The number of highest scoring results to return. |
is_iql | boolean | Whether the query should be interpreted as an Isaacus Query Language (IQL) query, which is not the case by default. |
scoring_method | enum (auto | chunk_max | chunk_avg | chunk_min) | The method to use for producing an overall relevance score for a text that exceeds the model’s local context window and has, therefore, been split into multiple chunks. |
chunking_options | object | null | Settings for how texts should be chunked into smaller segments by semchunk before reranking. |
model string
The ID of the model to use for reranking, being either a reranking model or universal classification model.
model string
The ID of the model to use for reranking, being either a reranking model or universal classification model.
query string
The query to evaluate the relevance of the texts to.
The query must contain at least one non-whitespace character.
Unlike the texts being reranked, the query cannot be so long that it exceeds the maximum input length of the reranker.
texts array[string]
The texts to rerank.
There must be at least one text.
Each text must contain at least one non-whitespace character.
top_n integer
The number of highest scoring results to return.
If null, which is the default, all results will be returned.
is_iql boolean
Whether the query should be interpreted as an Isaacus Query Language (IQL) query, which is not the case by default.
If you allow untrusted users to construct their own queries, think carefully before enabling IQL since queries can be crafted to consume an excessively large amount of tokens.
scoring_method enum (auto | chunk_max | chunk_avg | chunk_min)
The method to use for producing an overall relevance score for a text that exceeds the model’s local context window and has, therefore, been split into multiple chunks.
auto is the default scoring method and is recommended for most use cases. Currently, it is equivalent to chunk_max. In the future, it will automatically select the best method based on the model and inputs.
chunk_max uses the highest relevance score of all of a text’s chunks.
chunk_avg averages the relevance scores of all of a text’s chunks.
chunk_min uses the lowest relevance score of all of a text’s chunks.
chunking_options object
Settings for how texts should be chunked into smaller segments by semchunk before reranking.
If null, the texts will not be chunked and will instead be truncated to the maximum input length of the reranker less overhead if found to exceed that limit.
Chunking is enabled by default.
size integer
The maximum number of tokens allowed in a chunk.
If null, the maximum input length of the model will be used less overhead.
overlap_ratio number
The proportion of the chunk size by which chunks should overlap.
The ratio must be less than 1.
If null, no overlapping will occur unless overlap_tokens is set.
overlap_ratio and overlap_tokens cannot both be set.
overlap_tokens integer
The number of tokens by which chunks should overlap.
If null, no overlapping will occur unless overlap_ratio is set.
overlap_tokens and overlap_ratio cannot both be set.
Response
| Field | Type | Description |
|---|---|---|
results | array[object] | The texts reranked by relevance to the query, in order from highest to lowest relevance score. |
usage | object | Statistics about the usage of resources in the process of reranking the texts. |
results array[object]
The texts reranked by relevance to the query, in order from highest to lowest relevance score.
index integer
The index of the text in the input array of texts, starting from 0 (and, therefore, ending at the number of texts minus 1).
score number
A score between 0 and 1, inclusive, representing the relevance of the text to the query.
usage object
Statistics about the usage of resources in the process of reranking the texts.
input_tokens integer
The number of tokens inputted to the model.
See making requests for authentication, SDK usage, and errors.