UNPKG

gepa-spo

Version:

Genetic-Pareto prompt optimizer to evolve system prompts from a few rollouts with modular support and intelligent crossover

11 lines (10 loc) 685 B
/** Minimal runtime schema for structured LLM outputs without external deps. */ export interface CompletionSchema<T> { parse(input: unknown): T; } /** Build a schema for an object whose known keys are numbers. Unknown keys are ignored. */ export declare function objectOfNumberKeys(keys: string[]): CompletionSchema<Record<string, number>>; /** Safe JSON.parse with schema enforcement. Returns schema defaults on failure. */ export declare function safeParseWithSchema<T>(raw: string, schema: CompletionSchema<T>): T; /** Helper to clamp numeric field to [min,max] with default. */ export declare function clampNumber(x: unknown, min?: number, max?: number, def?: number): number;