@bobmatnyc/ai-code-review
Version:
A TypeScript-based tool for automated code reviews using AI models from Google Gemini, Anthropic Claude, and OpenRouter
42 lines (41 loc) • 1.69 kB
TypeScript
/**
* @fileoverview Model detection and initialization utilities for AI clients.
*
* This module provides common functionality for detecting model providers,
* parsing model names, validating API keys, and initializing client instances.
*/
/**
* Result of model detection
*/
export interface ModelDetectionResult {
/** Whether this is the correct client for the model */
isCorrect: boolean;
/** The provider/adapter name (e.g., "openai", "anthropic", "gemini") */
adapter: string;
/** The specific model name without provider prefix */
modelName: string;
}
/**
* Parse a model name string into provider and model components
* @param modelNameString The model name string (possibly with provider prefix)
* @param defaultProvider The default provider to use if none is specified
* @returns Object with adapter and modelName properties
*/
export declare function parseModelName(modelNameString: string, defaultProvider: string): {
adapter: string;
modelName: string;
};
/**
* Detect if a model name is for a specific provider
* @param providerName The provider to check for
* @param modelNameString The model name to check (with or without provider prefix)
* @returns ModelDetectionResult with detection information
*/
export declare function detectModelProvider(providerName: string, modelNameString?: string): ModelDetectionResult;
/**
* Validate API key for a provider
* @param providerName The provider to validate the API key for
* @param apiKeyName Environment variable name for the API key (optional)
* @returns Whether the API key is valid
*/
export declare function validateApiKey(providerName: string, apiKeyName?: string): boolean;