UNPKG

throughmark

Version:

Find and Annotate Features in Images, From Objects to Concepts

79 lines (78 loc) 2.31 kB
import { ImageProcessor } from "../image/processor.js"; import type { LLMConfig, AnnotationConfig } from "./types.js"; export declare const RESPONSE_TEMPLATE: string; export declare const INITIAL_ANALYSIS_PROMPT: string; export declare const VERIFICATION_PROMPT_TEMPLATE: (contiguousMode: boolean) => string; export interface Region { title: string; description: string; cells: string[]; details: string; } export interface AnalysisResponse { regions: Region[]; summary: string; tokens?: { input: number; output: number; total: number; cost?: number; modelName?: string; }; } interface AccuracyScore { foundCells: string[]; missedCells: string[]; extraCells: string[]; recall: number; precision: number; } interface GridDimensions { rows: number; cols: number; } export declare class ImageAnalyzer { private gridConfig; private client; private processor; private totalTokens; private numPasses; constructor(config: LLMConfig | undefined, gridConfig: GridDimensions); private createClient; private calculateCost; analyze(imageBuffer: Buffer, prompt?: string, imagePath?: string, options?: { contiguousRegions?: boolean; }): Promise<AnalysisResponse>; private compareAnalyses; private performInitialAnalysis; private performAnalysis; calculateAccuracy(analysis: AnalysisResponse, truthFile: string): AccuracyScore; getCells(imageBuffer: Buffer, gridImage: Buffer, prompt?: string): Promise<string[]>; updateGridConfig(config: { rows: number; cols: number; }): void; } export declare class Analysis { private response; private imagePath; private processor; private gridConfig; private annotations?; constructor(response: AnalysisResponse, imagePath: string, processor: ImageProcessor, gridConfig: { rows: number; cols: number; }, annotations?: AnnotationConfig[] | undefined); renderVerification(): Promise<Buffer>; render(): Promise<Buffer>; get regions(): Region[]; get summary(): string; get tokens(): { input: number; output: number; total: number; cost?: number; modelName?: string; } | undefined; } export {};