Interface StructuredGenerationOptions

Options for structured output generation.

interface StructuredGenerationOptions {
    prompt: string | {
        role: string;
        content: string;
    }[];
    schema: JSONSchema;
    schemaName: string;
    schemaDescription?: string;
    strategy?: StructuredOutputStrategy;
    providerId?: string;
    modelId?: string;
    temperature?: number;
    maxTokens?: number;
    maxRetries?: number;
    includeReasoning?: boolean;
    systemPrompt?: string;
    timeoutMs?: number;
    strict?: boolean;
    customValidator?: ((data) => ValidationIssue[]);
}

Properties

prompt: string | {
    role: string;
    content: string;
}[]

The prompt or messages to send to the LLM

schema: JSONSchema

JSON Schema the output must conform to

schemaName: string

Human-readable name for the schema (used in function calling)

schemaDescription?: string

Description of what output is expected

Strategy for enforcing structure

providerId?: string

LLM provider to use

modelId?: string

Model ID to use

temperature?: number

Temperature for generation (0-2)

maxTokens?: number

Maximum tokens to generate

maxRetries?: number

Number of retry attempts on validation failure

includeReasoning?: boolean

Whether to include reasoning/chain-of-thought before output

systemPrompt?: string

Custom system prompt to prepend

timeoutMs?: number

Timeout in milliseconds

strict?: boolean

Whether to strictly enforce schema (fail on extra properties)

customValidator?: ((data) => ValidationIssue[])

Custom validation function for additional checks

Type declaration