Create a new DecisionReranker instance.
Not used, pass an empty string
The reranker model's API name, for logging only
ID of the decision prompt to ask, or an empty string for Default Decision
User context for the decision calls
Protected_OptionalParentThe MJ: AI Prompt Runs row this rerank is recorded under. When set, every prompt run the
reranker makes is created as its child (ParentID), so its cost rolls up to the rerank's run.
AIRerankerRunner sets it to its own run before it calls the driver.
ProtectedapiOnly sub-classes can access the API key
Get the model name used for this reranker
The ID of the decision prompt the reranker asks. Empty when it asks Default Decision.
ProtectedCombinedThe usage of several prompt runs together: their tokens added up, and the sum of the costs that are known, in the currency of the first run that has one. The cost is unset when no run's cost is known.
ProtectedcreateThe response for a call its signal ended, before or during the driver's work. A caller
cancellation is classified Cancelled, so it is never failed over; an abort caused by a
timeout reads as a retriable network error.
ProtectedcreateCreate a standardized error response. Used internally when validation fails or an exception occurs.
ProtecteddoScores every document with one Likelihood question, splitting the questions across parallel calls when there are more than one call may carry. Records the usage of every call, the failed ones included, before it fails on any of them.
ProtectedfilterFilter results by minimum relevance threshold. Utility method for implementations that need to filter low-scoring results.
ProtectedRecordRecords the usage of a rerank's prompt runs, for Rerank to put on the response. Record it
whenever a prompt ran, because a failed call still cost a model call.
Reranks through BaseReranker.Rerank, then puts the usage of the rerank's prompt runs on the
response as Usage. A failed response carries it too, because a failed call still cost a model
call. No Usage when no prompt ran.
ProtectedsortSort results by relevance score in descending order. Utility method for implementations.
ProtectedUsageThe tokens and cost of one prompt run. The runner's reported cost wins when it has one.
Otherwise it is the run's saved cost, which the server computes when the run is saved:
TotalCost, else Cost. The cost is unset when neither is known, so call this after the
runner's pending saves.
Decision-based implementation of the BaseReranker class. It asks through"), in one call or, for more documents than a call may carry, in parallel calls. A
document's relevance score is the probability. Documents with equal scores keep their input order.
AIDecisionRunner, with the query as the state and each document as one Likelihood question ("This note bears on the request:Every call writes an
MJ: AI Prompt Runsrow through the decision runner, which also selects the decision model, resolves its credentials and fails over. When the reranker is given a parent run (ParentPromptRunID, whichAIRerankerRunnersets), those rows are its children, and a rerank's response carries their tokens and cost asUsage.Configuration:
Default Decisionwhen it is given none. It receives that ID the same wayLLMRerankerreceives its prompt's.MaxQuestionsPerCallamong the prompt's models, or, when none declares one,DecisionRerankOptions.MaxDocumentsPerCallin the rerank'soptions, or DEFAULT_DECISION_RERANK_DOCUMENTS_PER_CALL.DecisionRerankOptions.TimeoutMSin the rerank'soptions, or DEFAULT_DECISION_RERANK_TIMEOUT_MS.A failed decision call, an answer missing for any document, or a budget that runs out fails the whole rerank. No score is ever invented.
The scores are Likelihood probabilities, which are not calibrated, so a low
RerankerConfiguration.minRelevanceThresholdsuits this reranker: 0.1 is the recommended start.Usage: