Member Junction
    Preparing search index...

    A BaseDecision driver for any server that speaks TypeSafe's System One API, POST {base}/v1/systemone:

    • Kev's own server, such as a modal deploy kev_serve.py deployment at https://<workspace>--kev-api.modal.run (one deployment serves one Kev size);
    • llama.cpp's llama-server with a decision model, such as llama-server -hf ggml-org/Kev-4B-GGUF, on any machine, VM or Hugging Face Inference Endpoint;
    • TypeSafe's own API.

    The wire mapping comes from BaseSystemOneDecision. These servers return the response bare.

    Endpoint. The base URL comes from the constructor, else the credential's endpoint (an API Key with Endpoint AI Credential), else the SYSTEMONE_BASE_URL environment variable. /v1/systemone is appended unless the URL already ends with it (a URL ending in /v1 gets /systemone). With no base URL the call fails before any request.

    Token. Optional. With an API key the request carries Authorization: Bearer <key>; with none it carries no Authorization header, because a local llama-server or Kev server is open by default.

    Model. The body's model is DecisionParams.Model, the model-vendor row's APIName, defaulting to kev-latest. Kev's server accepts kev-latest and jev-latest.

    Timeouts. The driver sets none of its own: a Kev deployment that scaled to zero takes 35 to 55 seconds to start. The caller's cancellation and timeout apply.

    Hierarchy (View Summary)

    Index

    Constructors

    Properties

    BASE_URL_ENV_VAR: "SYSTEMONE_BASE_URL" = 'SYSTEMONE_BASE_URL'

    The environment variable the base URL is read from when neither the constructor nor the credential gives one.

    DEFAULT_MODEL: "kev-latest" = 'kev-latest'

    The model used when DecisionParams.Model is empty.

    Accessors

    • get apiKey(): string

      Only sub-classes can access the API key

      Returns string

    • get SecretsToRedact(): string[]

      The secrets an error message must never show, each removed with RedactSecret. Defaults to the credential's API key; a driver that sends only part of it (Cloudflare's token) adds that part.

      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.

    • The error type for a non-2xx status whose ErrorAnalyzer reading is wrong for this API, or undefined (the default) to leave it to ErrorAnalyzer, which reads the message and the status. A type returned here is attached to the thrown error as a Retriable error that allows failover: another candidate may answer what this API refused.

      Parameters

      • _status: number

        The HTTP status.

      Returns AIErrorType

    • The request body's model field. Defaults to the model unchanged.

      Parameters

      • model: string

        The model being asked.

      Returns string

    • Sends the request. This is the driver's only network call; a test double overrides it to stand in for the network.

      Parameters

      • url: string

        The endpoint from GetEndpointURL.

      • init: RequestInit

        The POST: method, headers, JSON body and the caller's cancellation signal.

      Returns Promise<Response>

    • Returns the System One response ({ model, answers, usage }) from a parsed 2xx body. Defaults to the body itself. A vendor that wraps the response in an envelope unwraps it here, and throws (with CreateSystemOneHTTPError) when the envelope reports a failure.

      Parameters

      • body: unknown

        The parsed JSON body.

      • _status: number

        The HTTP status, for an error thrown from here.

      Returns unknown

    • Validates input DecisionParams against the decision contract.

      Parameters

      Returns string[]

      An array of error descriptions, empty if valid.