/** * LLM block annotator. * * Produces labels for an already segmented message. It does not replace the segmenter: the model * only ever sees blocks the deterministic pipeline produced, and only ever returns labels for those * block indices. That keeps the annotation aligned with the pipeline it is meant to evaluate, and * keeps generated text out of the system entirely. * * These labels are weak supervision, not ground truth. They are stored with their model and prompt * version, kept separate from human labels, and are meant for bootstrapping, disagreement mining * and sampling, exactly as the project's plan requires of any non human label source. */ import { type Block } from '../segment/types'; import { type Label } from '../types'; import { type CompletionClient } from './client'; import { type LabelProbabilities } from './probabilities'; import { type SystemOneClient } from './typesafe-client'; /** Characters of each block sent to the model. Enough for a decision, bounded for cost. */ export declare const MAX_BLOCK_CHARS = 700; /** Blocks per message. Longer messages are truncated with a recorded flag. */ export declare const MAX_BLOCKS = 60; export interface LlmLabel { index: number; label: Label; confidence: number; /** Full distribution, from annotators that return one. The label is derived from it. */ probabilities?: LabelProbabilities; } export interface AnnotationResult { labels: LlmLabel[]; model: string; promptVersion: string; /** Blocks that were sent but came back unlabelled, defaulted to UNKNOWN. */ missing: number[]; /** Indices the model invented that do not exist. Discarded. */ spurious: number[]; blocksSent: number; blocksTotal: number; } /** Blocks worth spending a token on. Blank blocks carry no decision. */ export declare function annotatableBlocks(blocks: readonly Block[]): Block[]; /** * Annotate one message's blocks. * * @param client configured OpenAI client * @param blocks blocks from the primary representation * @param isReply whether the message carries threading headers */ export declare function annotateBlocks(client: CompletionClient, blocks: readonly Block[], isReply: boolean): Promise; /** * Annotate one message's blocks with TypeSafe: one Choice question per block. * * The stored label is the cost rule applied to the returned distribution at DEFAULT_COST_RATIO, not * the model's top choice, and the raw distribution is kept alongside so other ratios can be applied * later without re-running inference. An answer without a usable distribution is treated as * missing: the cost rule cannot be checked against it, so it must not be allowed to hide anything. * * @param client configured TypeSafe client * @param blocks blocks from the primary representation * @param isReply whether the message carries threading headers */ export declare function annotateBlocksWithTypeSafe(client: SystemOneClient, blocks: readonly Block[], isReply: boolean): Promise; //# sourceMappingURL=llm.d.ts.map