Member Junction
    Preparing search index...

    Interface MediaOperation<TParams, TDriver, TOutput>

    One operation a media runner performs: its name, how it validates and describes the request for the run row, and the driver call it makes.

    interface MediaOperation<TParams, TDriver, TOutput extends MediaDriverOutput> {
        CountUsage?: (params: TParams, output: TOutput) => ModelUsage;
        DescribeOutput: (output: TOutput) => string;
        DescribeRequest: (params: TParams) => string;
        Invoke: (
            driver: TDriver,
            apiName: string,
            signal: AbortSignal,
        ) => Promise<TOutput>;
        Name: string;
        Validate: (params: TParams) => string;
    }

    Type Parameters

    Index

    Properties

    CountUsage?: (params: TParams, output: TOutput) => ModelUsage

    The runner's own count of a successful call's usage (for example the characters sent), recorded when the driver reports no quantity of its own. Omit it when the runner can count nothing.

    DescribeOutput: (output: TOutput) => string

    The run row's Result for a successful call. Never media bytes.

    DescribeRequest: (params: TParams) => string

    The run row's Messages: JSON describing what was asked. Never media bytes.

    Invoke: (
        driver: TDriver,
        apiName: string,
        signal: AbortSignal,
    ) => Promise<TOutput>

    Calls the driver. apiName is the candidate's API name at its vendor, or undefined when it has none, in which case the driver uses its own default model. signal is the call's bound (the caller's token composed with the timeout), which the operation passes to the driver as its params' CancellationToken; it is undefined when the call is unbounded.

    Name: string

    The operation's name, for messages.

    Validate: (params: TParams) => string

    Why the params cannot run, or undefined when they can. Checked before a model is chosen.