2026-03-28 23:44:37 -04:00

23 lines
799 B
TypeScript

import { z } from "zod";
import { LabelOutput } from "./label.ts";
/** Multi-model agreement result for a single paragraph. */
export const ConsensusResult = z.object({
paragraphId: z.uuid(),
finalLabel: LabelOutput,
method: z.enum(["unanimous", "majority", "judge-resolved", "unresolved"]),
categoryAgreement: z.object({
votes: z.record(z.string(), z.number()), // category → count
agreed: z.boolean(),
}),
specificityAgreement: z.object({
votes: z.record(z.string(), z.number()), // level → count
agreed: z.boolean(),
spread: z.number(), // max - min among votes
}),
stage1ModelIds: z.array(z.string()),
stage2JudgeModelId: z.string().nullable(),
confidence: z.number().min(0).max(1),
});
export type ConsensusResult = z.infer<typeof ConsensusResult>;