Creating Plot Twists
    Preparing search index...

    Interface AIResponse<TOOLS, SCHEMA>

    Response from AI text generation, matching Vercel AI SDK's GenerateTextResult.

    interface AIResponse<TOOLS extends AIToolSet, SCHEMA extends TSchema = never> {
        text: string;
        toolCalls?: ToolCallArray<TOOLS>;
        toolResults?: ToolResultArray<TOOLS>;
        finishReason:
            | "other"
            | "error"
            | "stop"
            | "length"
            | "content-filter"
            | "tool-calls"
            | "unknown";
        usage: AIUsage;
        sources?: AISource[];
        output?: StaticType<[], "Encode", {}, {}, SCHEMA>;
        response?: {
            id?: string;
            timestamp?: Date;
            modelId?: string;
            messages?: AIMessage[];
        };
    }

    Type Parameters

    • TOOLS extends AIToolSet
    • SCHEMA extends TSchema = never
    Index

    Properties

    text: string

    The generated text.

    toolCalls?: ToolCallArray<TOOLS>

    Tool calls made by the model during generation.

    toolResults?: ToolResultArray<TOOLS>

    Results from tool executions.

    finishReason:
        | "other"
        | "error"
        | "stop"
        | "length"
        | "content-filter"
        | "tool-calls"
        | "unknown"

    Reason why the model stopped generating.

    usage: AIUsage

    Token usage information for this generation.

    sources?: AISource[]

    Sources used by the model (if supported).

    output?: StaticType<[], "Encode", {}, {}, SCHEMA>

    Structured output when using outputSchema. Type is automatically inferred from the Typebox schema.

    response?: {
        id?: string;
        timestamp?: Date;
        modelId?: string;
        messages?: AIMessage[];
    }

    Response metadata including messages.