TagoIO SDK for JavaScript and TypeScript
    Preparing search index...

    Interface AIGeneration<T>

    A generation job. T types output.json when response_format was given. The API does not check the output against the schema, and neither does the SDK, so T is what you expect, not a guarantee.

    interface AIGeneration<T = unknown> {
        billing: {
            charged?: string;
            currency?: string;
            mode: "free" | "wallet" | "byok";
        };
        callback?: { analysis: string; status: "failed"
        | "pending"
        | "sent" };
        completed_at?: Date;
        created_at: Date;
        error?: { code: AIGenerationErrorCode; message: string };
        id: string;
        incomplete_details?: { reason: "max_output_tokens" | "content_filter" };
        model: AIGenerationModel;
        output?: {
            json?: T;
            messages: { message: string; type: "assistant" }[];
            text: string;
        };
        status: AIGenerationStatus;
    }

    Type Parameters

    • T = unknown
    Index

    Properties

    billing: {
        charged?: string;
        currency?: string;
        mode: "free" | "wallet" | "byok";
    }

    How the generation is billed. A finished wallet job that was charged also includes the amount, as a decimal string, and usually its currency. Token counts are never returned.

    callback?: { analysis: string; status: "failed" | "pending" | "sent" }

    The callback requested with the job. Inside the callback Analysis it still reads pending: the API records sent or failed after the run.

    completed_at?: Date

    Set when the job finishes. Absent while it runs and on jobs that read as interrupted.

    created_at: Date
    error?: { code: AIGenerationErrorCode; message: string }
    id: string

    Job ID, for getGeneration.

    incomplete_details?: { reason: "max_output_tokens" | "content_filter" }

    Present from the start. null only when the model could not be resolved (model_unavailable).

    output?: {
        json?: T;
        messages: { message: string; type: "assistant" }[];
        text: string;
    }

    Type declaration

    • Optionaljson?: T

      Present on completed jobs that gave response_format: the parsed object, or null when the model did not return valid JSON.

    • messages: { message: string; type: "assistant" }[]

      Assistant turns, ready to append to your messages history.

    • text: string

    queued or in_progress while running; completed, incomplete or failed once finished.