Creating Plot Twists
    Preparing search index...

    Interface AIRequest<TOOLS, SCHEMA>

    Request parameters for AI text generation, matching Vercel AI SDK's generateText() function.

    interface AIRequest<TOOLS extends AIToolSet, SCHEMA extends TSchema = never> {
        model: ModelPreferences;
        system?: string;
        prompt?: string;
        messages?: AIMessage[];
        tools?: TOOLS;
        toolChoice?: ToolChoice<TOOLS>;
        outputSchema?: SCHEMA;
        maxOutputTokens?: number;
        temperature?: number;
        topP?: number;
    }

    Type Parameters

    • TOOLS extends AIToolSet
    • SCHEMA extends TSchema = never
    Index

    Properties

    Model selection preferences based on desired speed and cost characteristics. Plot will automatically select the best available model matching these preferences.

    // Fast and cheap - good for simple tasks
    model: { speed: "fast", cost: "low" }
    // Balanced performance - general purpose
    model: { speed: "balanced", cost: "medium" }
    // Maximum capability - complex reasoning
    model: { speed: "capable", cost: "high" }
    // With a specific model hint
    model: { speed: "balanced", cost: "medium", hint: "anthropic/claude-sonnet-4-5" }
    system?: string

    System instructions to guide the model's behavior.

    prompt?: string

    The user's input prompt. Can be a simple string or an array of messages for multi-turn conversations.

    messages?: AIMessage[]

    Conversation messages for multi-turn interactions. Replaces 'prompt' for more complex conversations.

    tools?: TOOLS

    Tools that the model can call during generation. Each tool definition includes a description, input schema, and optional execute function.

    toolChoice?: ToolChoice<TOOLS>

    Controls which tools the model can use.

    • "auto": Model decides whether to use tools
    • "none": Model cannot use tools
    • "required": Model must use at least one tool
    • { type: "tool", toolName: string }: Model must use specific tool
    outputSchema?: SCHEMA

    Structured output schema using Typebox. Typebox schemas are JSON Schema objects that provide full TypeScript type inference.

    maxOutputTokens?: number

    Maximum number of tokens to generate.

    temperature?: number

    Temperature for controlling randomness (0-2). Higher values make output more random, lower values more deterministic.

    topP?: number

    Top P sampling parameter (0-1). Controls diversity by limiting to top probability tokens.