Member Junction
    Preparing search index...

    Class BaseHostedSystemOneDecisionAbstract

    A BaseSystemOneDecision for a hosted System One API at one fixed URL that requires an API key, such as Perplexity's, SubQ's and Inception's Decisions APIs. It owns what those drivers share:

    • The endpoint, EndpointURL: the constructor's URL, else the credential's endpoint (an API Key with Endpoint credential), else DefaultEndpoint. Each is the full request URL, used for every model, since the model travels in the body. Trailing slashes are removed.
    • Error messages: the vendor's message read with ReadSystemOneErrorMessage, else the base default (the status and the start of the body).
    • The missing-key check: no API key fails before any request, as a NoCredentials error that allows failover, since another candidate may be configured.

    A subclass supplies ServiceName, DefaultModel, DefaultEndpoint, APIKeyDescription and LegacyKeyVariable, and, when ErrorAnalyzer misreads one of its vendor's statuses, GetHTTPErrorType.

    Hierarchy (View Summary)

    Index

    Constructors

    Accessors

    • 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

    • 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

    • 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