import type { MessageBatchRequest } from "#tools/anthropic/batches"; /** * Why the model paired, or declined to pair, an added place with a WOF record. */ export declare const TwinReason: { /** * The two names write one name in two scripts or romanizations. */ readonly Transliteration: "transliteration"; /** * The two names are one name in two languages. */ readonly Translation: "translation"; /** * The two names differ by spelling, spacing, an article, an abbreviation or an administrative suffix. */ readonly Spelling: "spelling"; /** * The model recalls that the two names belong to one settlement. */ readonly Known: "known_same"; /** * The names belong to different settlements. */ readonly Different: "different_place"; /** * The evidence decides neither way. */ readonly Unclear: "unclear"; }; export type TwinReason = (typeof TwinReason)[keyof typeof TwinReason]; declare const CONFIDENCES: readonly ["high", "medium", "low"]; export type TwinConfidence = (typeof CONFIDENCES)[number]; /** * A WOF record near an added place. */ export interface TwinCandidate { wofID: number; /** * The record's primary name first, then its other names. */ names: string[]; placetype: string; km: number; } /** * One added place with the WOF records inside the match radius. */ export interface AddedPlaceItem { /** * The id of the place's own row in the admin database. */ id: number; source: "overture" | "geonames"; /** * The place's id in its source: an Overture GERS id or a GeoNames id. */ sourceID: string; /** * The place's primary name first, then its other names. */ names: string[]; placetype: string; country: string; latitude: number; longitude: number; candidates: TwinCandidate[]; /** * How the place's names compare with its candidates' names in code. * `rankItems` orders the items a budget admits by it. */ comparison: NameComparison; /** * The highest romanized edit similarity between one of the place's names and one of a candidate's. * It is `null` unless `comparison` is `romanized`. */ similarity: number | null; } /** * What the romanizer could compare between an added place's names and its candidates' names. */ export declare const NameComparison: { /** * At least one pair of names romanizes on both sides, so an edit similarity exists. */ readonly Romanized: "romanized"; /** * No pair romanizes on both sides, and at least one pair romanizes on exactly one: * the names are in different scripts. */ readonly CrossScript: "cross_script"; /** * No name on either side romanizes. */ readonly Uncovered: "uncovered"; }; export type NameComparison = (typeof NameComparison)[keyof typeof NameComparison]; /** * The model's answer for one added place. * * `match` is the paired candidate's index in the item's `candidates`, or `null` * when the place pairs with none. */ export interface TwinLabel { match: number | null; reason: TwinReason; confidence: TwinConfidence; } /** * The system prompt of every place-twin request states the four reasons that pair an * added place with a candidate, the two that pair it with none, and the rule that a * short distance without a name relation pairs no two places. */ export declare const PLACE_TWIN_SYSTEM_PROMPT = "You adjudicate duplicate settlements for a gazetteer.\n\nThe gazetteer holds Who's On First records and adds places from Overture and GeoNames. An added place joins a Who's On First record when the two share an identifier or a normalized name within 5 kilometers. Each item below is an added place that joined none, with the Who's On First settlements within 5 kilometers of it. The names differ, so either the added place is a separate settlement, or it is one of the candidates written in another script, language, romanization or spelling.\n\nFor each item you receive the added place's names, placetype, country and coordinates, and each candidate's index, names, placetype and distance in kilometers.\n\nDecide whether the added place is the same settlement as exactly one candidate:\n- transliteration: the names write one name in two scripts or romanization systems.\n- translation: the names are one name in two languages, including an exonym.\n- spelling: the names differ by spelling, diacritics, spacing, an article, an abbreviation, or an administrative word such as village, commune, town or its local equivalent.\n- known_same: you recall that the two names belong to one settlement, although the strings do not show it.\n- different_place: the names belong to different settlements. Two villages a few kilometers apart with unrelated names are different places, and so are places distinguished by a qualifier such as upper and lower, old and new, north and south, or a number.\n- unclear: the evidence decides neither way.\n\nGive \"match\" as the index of the candidate for the first four reasons, and -1 for different_place and unclear. A neighborhood or hamlet inside a larger candidate is a different place. Distance alone never establishes a match. State your confidence as high, medium or low, and prefer unclear over a guess.\n\nReturn one label per item, with the item's index."; /** * The structured-output schema of one response. */ export declare const PLACE_TWIN_RESPONSE_SCHEMA: { readonly type: "object"; readonly additionalProperties: false; readonly required: readonly ["labels"]; readonly properties: { readonly labels: { readonly type: "array"; readonly items: { readonly type: "object"; readonly additionalProperties: false; readonly required: readonly ["i", "match", "reason", "confidence"]; readonly properties: { readonly i: { readonly type: "integer"; }; readonly match: { readonly type: "integer"; }; readonly reason: { readonly type: "string"; readonly enum: ("different_place" | "known_same" | "spelling" | "translation" | "transliteration" | "unclear")[]; }; readonly confidence: { readonly type: "string"; readonly enum: readonly ["high", "medium", "low"]; }; }; }; }; }; }; /** * Renders the items of one request as the user message the model reads. */ export declare function renderPlaceTwinItems(items: readonly AddedPlaceItem[]): string; /** * Builds the Messages parameters of one request. */ export declare function placeTwinRequestParams(items: readonly AddedPlaceItem[], options: { model: string; effort: string; }): MessageBatchRequest["params"]; /** * Parses one response into a label per item, given the candidate count of each item of the request. * * @throws When the text fails to parse as the schema's object, an index is outside * the request or repeated, an item is unlabeled, a value is outside its enumeration, * a match index is outside the item's candidates, or a match and its reason disagree. */ export declare function parsePlaceTwinResponse(text: string, candidateCounts: readonly number[]): TwinLabel[]; export {}; //# sourceMappingURL=prompt.d.ts.map