POST
/
rerankings
import os
from isaacus import Isaacus

client = Isaacus(
    api_key=os.environ.get("ISAACUS_API_KEY"),  # This is the default and can be omitted
)
reranking = client.rerankings.create(
    model="kanon-universal-classifier",
    query="What are the essential elements required to establish a negligence claim?",
    texts=["To form a contract, there must be an offer, acceptance, consideration, and mutual intent to be bound.", "Criminal cases involve a completely different standard, requiring proof beyond a reasonable doubt.", "In a negligence claim, the plaintiff must prove duty, breach, causation, and damages.", "Negligence in tort law requires establishing a duty of care that the defendant owed to the plaintiff.", "The concept of negligence is central to tort law, with courts assessing whether a breach of duty caused harm."],
)
print(reranking.results)
{
"results": [
{
"index": 2,
"score": 0.7727372261985272
},
{
"index": 3,
"score": 0.7332913519466231
},
{
"index": 4,
"score": 0.32399687407609323
},
{
"index": 1,
"score": 0.09480246485705024
},
{
"index": 0,
"score": 0.06929198572432578
}
],
"usage": {
"input_tokens": 170
}
}

Authorizations

Authorization
string
header
required

An Isaacus-issued API key passed as a bearer token via the Authorization header in the format Authorization: Bearer YOUR_API_KEY.

Body

application/json

A request to rerank legal documents by their relevance to a query with an Isaacus legal AI reranker.

Response

200
application/json

The documents have been successfully reranked.

The reranking of texts, by relevance to a query, out of an input array of texts.