Skip to content
Français

decide

import { decide } from "@elie-laloum/outpost";

Execute one decision-provider request against lossless JSON state, validate all answers and return normalized usage and native metadata. Distribution totals and weighted scores allow accumulated four-decimal rounding without changing native values. Reported truncation fails unless explicitly allowed.

Complete example and detailed rules.

  • optionsRequired
    DecideOptions<Q>
    Provider, named model, declaration and lossless JSON state for one immediate evaluation.
  • options.providerRequired
    DecisionProvider
    Decision provider that performs this evaluation.
  • options.modelRequired
    string
    Nonempty decision model name, without generation or reasoning settings.
  • options.decisionRequired
    Decision<Q>
    Frozen typed question declaration created with defineDecision.
  • options.stateRequired
    DecisionState
    Text, object or array validated as lossless JSON before the request.
  • options.signalOptional
    AbortSignal | undefined
    Optional caller cancellation signal forwarded to the decision provider.
  • options.observationOptional
    ObservationHub | undefined
    Optional scoped observation hub; detailed state and answers require verbose mode.
  • options.allowTruncatedOptional
    boolean | undefined
    False by default; true accepts a reported truncation while retaining its flag in the result.

Promise<DecisionResult<Q>>

export declare function decide<const Q extends DecisionQuestions>(
  options: DecideOptions<Q>,
): Promise<DecisionResult<Q>>;