llmwire - v2.2.0
    Preparing search index...

    Interface AIRequest

    interface AIRequest {
        jsonMode?: boolean;
        maxSteps?: number;
        maxTokens?: number;
        messages?: Message[];
        metadata?: Record<string, any>;
        modelId?: string;
        onStep?: (step: Step) => void | Promise<void>;
        prompt?: string;
        providerOptions?: Record<string, unknown>;
        reasoning?: boolean;
        schema?: Record<string, unknown> | StandardSchemaV1<unknown, unknown>;
        signal?: AbortSignal;
        streamIdleTimeout?: number;
        systemPrompt?: string;
        temperature?: number;
        timeout?: number;
        toolChoice?: { name: string } | "auto" | "none" | "required";
        tools?: Tool[];
    }
    Index
    jsonMode?: boolean

    Ask the provider for JSON. Providers that support a native JSON mode use it.

    maxSteps?: number

    Rounds of model call + tool execution the factory runs before returning (default 1: calls are returned, not executed).

    maxTokens?: number
    messages?: Message[]

    The conversation so far. A user message may carry image parts.

    metadata?: Record<string, any>
    modelId?: string
    onStep?: (step: Step) => void | Promise<void>

    Called after each round of the tool loop, with what the model said, what it called and what came back. Awaited.

    prompt?: string

    Shorthand for a final user message; appended after messages. One of prompt or messages is required.

    providerOptions?: Record<string, unknown>

    Provider-specific fields merged last into the wire body, one level deep ({ options: { num_ctx: 8192 } } for Ollama, { top_p: 0.9 } for an OpenAI-format host). Whatever you put here wins over what the client sets.

    reasoning?: boolean

    Ask a reasoning model to think before answering (Ollama think, Anthropic extended thinking, Gemini includeThoughts). The thinking text comes back as reasoning on the response and as reasoning deltas on stream chunks, never mixed into text. Off by default for Ollama, where a model that thinks into its output budget otherwise returns an empty answer; whatever an OpenAI-format server sends (reasoning_content, inline <think> tags) is surfaced regardless of this flag.

    schema?: Record<string, unknown> | StandardSchemaV1<unknown, unknown>

    Structured output: a JSON Schema object, or any Standard Schema (Zod, Valibot, ArkType, ...). Implies jsonMode. The answer is parsed (and, for a Standard Schema, validated) onto response.object; a bad answer fails with INVALID_JSON or SCHEMA_MISMATCH. Not applied to streams.

    signal?: AbortSignal

    Aborts an in-flight request/stream.

    streamIdleTimeout?: number

    Streaming: ms of upstream silence before the stream fails with STREAM_IDLE (default 60000; 0 disables).

    systemPrompt?: string
    temperature?: number
    timeout?: number

    Whole-request timeout in ms for non-streaming calls (default 30000; 0 disables).

    toolChoice?: { name: string } | "auto" | "none" | "required"
    tools?: Tool[]

    Functions the model may call. Calls come back on toolCalls; with maxSteps > 1 and execute set, the factory runs them and continues.