exif-ai
Version:
A powerful Node.js CLI and library that uses AI providers (OpenAI, Google Gemini, Anthropic Claude, Mistral, Ollama, Amazon Bedrock, Azure OpenAI, DeepInfra, Fireworks, XAI, OpenRouter, and more) to intelligently write image descriptions and tags to EXIF
145 lines (144 loc) • 3.39 kB
TypeScript
import { DescriptionKey } from "./tasks/description.js";
import { TagKey } from "./tasks/tags.js";
/**
* Configuration for AI providers
*/
export interface AIConfig {
/** AI provider name */
provider: string;
/** AI model (optional, uses provider default) */
model?: string;
/** Custom description prompt */
descriptionPrompt?: string;
/** Custom tag prompt */
tagPrompt?: string;
/** Additional provider arguments */
args?: string[];
}
/**
* Configuration for EXIF metadata
*/
export interface ExifConfig {
/** EXIF tags for descriptions */
descriptionTags?: DescriptionKey[];
/** EXIF tags for tags */
tagTags?: TagKey[];
/** Additional ExifTool arguments */
args?: string[];
}
/**
* Task types that can be performed
*/
export type TaskType = "description" | "tag" | "tags";
/**
* Processing options
*/
export interface ProcessingOptions {
/** Tasks to perform */
tasks?: TaskType[];
/** Preview mode - don't write to file */
preview?: boolean;
/** Skip if tags already exist */
skipExisting?: boolean;
/** Number of retry attempts */
retries?: number;
/** Enable verbose output */
verbose?: boolean;
}
/**
* Complete configuration for exif-ai
*/
export interface ExifAIConfig {
/** Path to image file */
image: string;
/** AI configuration */
ai: AIConfig;
/** EXIF configuration (optional) */
exif?: ExifConfig;
/** Processing options (optional) */
options?: ProcessingOptions;
}
/**
* Simplified configuration for common use cases
*/
export interface SimpleConfig {
/** Path to image file */
image: string;
/** AI provider */
provider: string;
/** AI model (optional) */
model?: string;
/** Tasks to perform (default: ["description", "tag"]) */
tasks?: TaskType[];
/** Custom description prompt */
descriptionPrompt?: string;
/** Custom tag prompt */
tagPrompt?: string;
/** Preview mode */
preview?: boolean;
/** Verbose output */
verbose?: boolean;
}
/**
* Builder class for fluent API
*/
export declare class ExifAI {
private config;
constructor(image: string);
/**
* Set AI provider
*/
provider(provider: string): this;
/**
* Set AI model
*/
model(model: string): this;
/**
* Set tasks to perform
*/
tasks(...tasks: TaskType[]): this;
/**
* Set description prompt
*/
descriptionPrompt(prompt: string): this;
/**
* Set tag prompt
*/
tagPrompt(prompt: string): this;
/**
* Enable preview mode
*/
preview(): this;
/**
* Enable verbose output
*/
verbose(): this;
/**
* Skip if tags already exist
*/
skipExisting(): this;
/**
* Set retry attempts
*/
retries(count: number): this;
/**
* Set EXIF tags for descriptions
*/
descriptionTags(...tags: DescriptionKey[]): this;
/**
* Set EXIF tags for tags
*/
tagTags(...tags: TagKey[]): this;
/**
* Execute the processing
*/
run(): Promise<void>;
}
/**
* Simple function for common use cases
*/
export declare function processImage(config: SimpleConfig): Promise<void>;
/**
* Advanced function with full configuration
*/
export declare function processImageAdvanced(config: ExifAIConfig): Promise<void>;