import type { PathBuilder } from "path-ts"; import { type MessageBatch, type MessageBatchRequest, type MessageUsage, type TokenPrice } from "#tools/anthropic/batches"; /** * Returns the batch price of `model`. * * @throws When no price is recorded for it, so a cost is never reported from a guessed rate. */ export declare function batchPrice(model: string): TokenPrice; /** * The items one request labels. */ export interface LabelingChunk { custom_id: string; items: Item[]; } /** * What `submitLabelingBatch` records, so a later `status` or `collect` reads * the settings the batch ran under. */ export interface LabelingBatchRecord { id: string; model: string; effort: string; requests: number; items: number; } /** * The model and effort a tool's requests run under. */ export interface LabelingSettings { model: string; effort: string; } type ToParams = (items: readonly Item[], settings: LabelingSettings) => MessageBatchRequest["params"]; /** * Parses one response into a label per item of its request, in item order, * and throws on a response it refuses. */ type ParseLabels = (text: string, items: readonly Item[]) => Label[]; /** * Splits `items` into requests of `size`, with ids `-`. */ export declare function toLabelingChunks(items: readonly Item[], size: number, prefix: string): LabelingChunk[]; /** * Sends `count` evenly spaced chunks one at a time at the standard price. * * @returns Each chunk with its labels and token use, and the batch cost per request those requests imply. * @throws When a response stops at `max_tokens` or the parser refuses it, * since a batch of the same requests would fail the same way. */ export declare function pilotLabelingRequests(chunks: ReadonlyArray>, count: number, settings: LabelingSettings, toParams: ToParams, parse: ParseLabels): Promise<{ requests: Array<{ chunk: LabelingChunk; labels: Label[]; usage: MessageUsage; }>; batchCostPerRequestUSD: number; }>; /** * Writes `chunks.jsonl`, creates one batch of the chunks, and records it in `batch.json`. */ export declare function submitLabelingBatch(out: PathBuilder, chunks: ReadonlyArray>, settings: LabelingSettings, toParams: ToParams): Promise; /** * Reads the state of the batch `batch.json` records. */ export declare function readLabelingBatch(out: PathBuilder): Promise; /** * A request whose items received no label, and why. */ export interface FailedChunk { custom_id: string; reason: string; items: number; } /** * Joins the finished batch to its chunks and writes `failed-chunks.jsonl`. * * @returns Every labeled item beside its label, the failed requests, the result * count per outcome type, and the dollars the batch cost. * @throws When the batch is still in progress. */ export declare function collectLabelingBatch(out: PathBuilder, parse: ParseLabels): Promise<{ record: LabelingBatchRecord; labeled: Array<{ item: Item; label: Label; }>; failed: FailedChunk[]; resultsByType: Record; costUSD: number; }>; /** * Counts each distinct value. */ export declare function countEach(values: Iterable): Record; export {}; //# sourceMappingURL=labeling.d.ts.map