Member Junction
    Preparing search index...

    Class BaseDecisionAbstract

    Abstract base class for typed decision model implementations. Subclasses wrap provider APIs to produce structured Likelihood, Choice, and Score answers.

    Implementations should:

    1. Register with @RegisterClass(BaseDecision, 'ProviderName')
    2. Implement the protected DoDecide() method
    3. Honor params.CancellationToken, which the base does not check

    Decide() validates the request before calling DoDecide() and the answers after it, so a driver does not repeat those checks.

    Example:

    @RegisterClass(BaseDecision, 'ExampleDecision')
    export class ExampleDecision extends BaseDecision {
    protected async DoDecide(params: DecisionParams): Promise<DecisionResult> {
    // Call the provider and map its output onto DecisionAnswer shapes
    }
    }

    const decider = MJGlobal.Instance.ClassFactory.CreateInstance<BaseDecision>(BaseDecision, 'ExampleDecision', apiKey);
    const result = await decider.Decide(params);

    Hierarchy (View Summary)

    Index

    Constructors

    Accessors

    Methods

    • Executes a typed decision request across one or more questions about a given state. This method wraps driver execution with input validation, output verification, execution timing, and structured error handling. It never throws.

      Parameters

      • params: DecisionParams

        Decision request parameters including state, questions, and model.

      Returns Promise<DecisionResult>

      A Promise resolving to a DecisionResult.

    • Driver-specific implementation of the decision logic. Must be implemented by concrete provider subclasses. Returned probabilities must already be normalised, in range, and keyed correctly.

      The driver owns cancellation: Decide() passes params.CancellationToken through unchecked, so the driver should check it before calling the provider and hand it to the provider's HTTP client.

      Parameters

      Returns Promise<DecisionResult>

      A Promise resolving to a DecisionResult.