Member Junction
    Preparing search index...

    Driver that answers typed decision questions with a chat LLM through an MJ prompt. It is the fallback BaseDecision driver: everything downstream can be written against BaseDecision before a native decision model is configured. Unlike a native driver it must parse, because a chat model can return malformed JSON.

    The prompt receives three template variables:

    • state: the decision state, as-is when it is a string, otherwise as indented JSON;
    • questions: JSON mapping each question key to { kind, instructions, options?, levels? };
    • outputFormat: the reply's shape as JSON, with every option or level listed and an unquoted placeholder where each number goes.

    It must reply with one JSON object with the same keys: a number for a Likelihood, and an object mapping every option value (Choice) or level name (Score) to a number. Choice and Score distributions are normalised here, so BaseDecision.Decide can validate them strictly. A value that is present but is not a usable number fails the question; it is never read as 0.

    Registered with ClassFactory under BaseDecision with key 'LLMDecision'.

    Hierarchy (View Summary)

    Index

    Constructors

    Properties

    ExecutionScope?: AIPromptExecutionScope

    The decision's AIPromptExecutionScope — configuration, runtime API keys and credential scope — which the chat prompt runs under. AIDecisionRunner sets it from the decision's params. Without it the chat prompt carried only the user, so it answered on the platform's keys even when the decision itself was restricted to the caller's.

    ParentPromptRunID?: string

    The MJ: AI Prompt Runs row this decision is recorded under. When set, the chat prompt's run is created as its child (ParentID), so the chat call's cost rolls up to the decision's run. AIDecisionRunner sets it to its own run before it calls the driver.

    Accessors

    • get apiKey(): string

      Only sub-classes can access the API key

      Returns string

    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.

    • Validates driver output DecisionResult against the requested questions.

      Parameters

      Returns string[]

      An array of error descriptions, empty if valid.

    • Validates input DecisionParams against the decision contract.

      Parameters

      Returns string[]

      An array of error descriptions, empty if valid.