import { SYSTEM_PROMPT_LAYOUT, SYSTEM_PROMPT_LAYOUT_GEMINI, USER_PROMPT_LAYOUT, USER_PROMPT_LAYOUT_GEMINI, } from './layout.js'; import type { PiModel, PromptProfile } from './types.js'; const ESTIMATED_INPUT_TOKENS_PER_PAGE = 1_400; const ESTIMATED_OUTPUT_TOKENS_PER_PAGE = 900; export const PROMPT_PROFILES: readonly PromptProfile[] = [ { id: 'layout-bbox-gemini-page', version: 1, displayName: 'Layout+bbox (Gemini yxyx)', bboxOrder: 'yxyx', system: SYSTEM_PROMPT_LAYOUT_GEMINI, user: USER_PROMPT_LAYOUT_GEMINI, modelIds: [ 'gemini-3-flash-preview', 'gemini-3.5-flash', 'gemini-3.1-flash-lite', 'gemini-3.1-pro-preview', 'gemini-2.5-flash', ], estimatedInputTokensPerPage: ESTIMATED_INPUT_TOKENS_PER_PAGE, estimatedOutputTokensPerPage: ESTIMATED_OUTPUT_TOKENS_PER_PAGE, }, { id: 'layout-bbox-generic-page', version: 1, displayName: 'Layout+bbox (xyxy)', bboxOrder: 'xyxy', system: SYSTEM_PROMPT_LAYOUT, user: USER_PROMPT_LAYOUT, modelIds: [ 'gpt-5.4-mini', 'meta/llama-3.2-90b-vision-instruct', 'qwen/qwen3-vl-235b-a22b-instruct', ], estimatedInputTokensPerPage: ESTIMATED_INPUT_TOKENS_PER_PAGE, estimatedOutputTokensPerPage: ESTIMATED_OUTPUT_TOKENS_PER_PAGE, }, ]; function matchesModelId(actual: string, curated: string): boolean { const normalizedActual = actual.toLowerCase(); const normalizedCurated = curated.toLowerCase(); return ( normalizedActual === normalizedCurated || normalizedActual.endsWith(`/${normalizedCurated}`) ); } export function promptForModel(model: Pick): PromptProfile | undefined { return PROMPT_PROFILES.find((profile) => profile.modelIds.some((modelId) => matchesModelId(model.id, modelId)), ); } export function promptRef(profile: PromptProfile): string { return `${profile.id}@${profile.version}`; }