/** * SelfConsistency — sample N answers, pick the majority. * * Paper: "Self-Consistency Improves Chain of Thought Reasoning in * Language Models" — Wang et al., 2022 (https://arxiv.org/abs/2203.11171). * * Pattern: Factory (GoF) → produces a `Runner` that composes `Parallel` * of N `LLMCall` branches with a majority-vote merge function. * Role: patterns/ layer. Pure composition of core primitives + * core-flow compositions — no new abstractions. * Emits: Everything `Parallel` + `LLMCall` emit (stream / composition / * context). No pattern-specific event domain needed; consumers * observe via the standard typed listeners. */ import type { LLMProvider } from '../adapters/types.js'; import type { Runner } from '../core/runner.js'; export interface SelfConsistencyOptions { readonly provider: LLMProvider; readonly model: string; readonly systemPrompt: string; /** Number of parallel samples. 3 / 5 are typical; paper uses up to 40. */ readonly samples: number; /** Sampling temperature. Defaults to a higher value (0.7) to get diverse samples. */ readonly temperature?: number; readonly maxTokens?: number; /** * Consumer-provided extractor: given a full LLM response, return the * "vote token" (e.g., the final answer stripped of the chain-of-thought * preamble). Defaults to returning the trimmed string. */ readonly extract?: (response: string) => string; readonly name?: string; readonly id?: string; } /** * Build a SelfConsistency Runner. Given a system prompt, the Runner * runs `samples` parallel LLMCalls with the same input, extracts each * response's vote token, then returns the most-frequent token. Ties * are broken by the first response's extract. */ export declare function selfConsistency(opts: SelfConsistencyOptions): Runner<{ message: string; }, string>; //# sourceMappingURL=SelfConsistency.d.ts.map