28 lines
1.2 KiB
TypeScript
28 lines
1.2 KiB
TypeScript
import { z } from "zod";
|
|
import { LabelOutput } from "./label.ts";
|
|
|
|
/** Full provenance for a single API call annotation. */
|
|
export const Provenance = z.object({
|
|
modelId: z.string(), // OpenRouter model ID e.g. "google/gemini-3.1-flash-lite-preview"
|
|
provider: z.string(), // Upstream provider e.g. "google", "xai", "anthropic"
|
|
generationId: z.string(), // OpenRouter generation ID (response `id` field)
|
|
stage: z.enum(["stage1", "stage2-judge", "benchmark"]),
|
|
runId: z.uuid(), // UUID per batch run
|
|
promptVersion: z.string(), // "v1.0" — tracks prompt iterations
|
|
inputTokens: z.number().int(),
|
|
outputTokens: z.number().int(),
|
|
reasoningTokens: z.number().int(), // from completion_tokens_details.reasoning_tokens
|
|
costUsd: z.number(), // REAL cost from OpenRouter usage.cost
|
|
latencyMs: z.number().int(), // wall clock per request
|
|
requestedAt: z.iso.datetime(), // ISO datetime
|
|
});
|
|
export type Provenance = z.infer<typeof Provenance>;
|
|
|
|
/** A label with full provenance — one per (paragraph, model) pair. */
|
|
export const Annotation = z.object({
|
|
paragraphId: z.uuid(),
|
|
label: LabelOutput,
|
|
provenance: Provenance,
|
|
});
|
|
export type Annotation = z.infer<typeof Annotation>;
|