ai-pp3
Version:
CLI tool combining multimodal AI analysis with RawTherapee's engine to generate optimized PP3 profiles for RAW photography
23 lines • 917 B
JavaScript
/**
* Centralized AI provider configuration and error handling
*/
import { provider } from "../provider.js";
/**
* Sets up the AI provider with the specified model
*
* @param providerName The name of the AI provider to use
* @param model A single model name or an array of model names
* @param modelIndex Optional index to use a specific model from the array (defaults to 0)
* @returns The configured AI provider
*/
export function handleProviderSetup(providerName, model, modelIndex) {
try {
// If model is an array, use the specified model index or default to the first model
const modelToUse = Array.isArray(model) ? model[modelIndex ?? 0] : model;
return provider(providerName)(modelToUse);
}
catch (error) {
throw new Error(`AI configuration error: ${error instanceof Error ? error.message : "Unknown error"}`);
}
}
//# sourceMappingURL=ai-provider.js.map