@bobmatnyc/ai-code-review
Version:
A TypeScript-based tool for automated code reviews using AI models from Google Gemini, Anthropic Claude, and OpenRouter
94 lines (93 loc) • 3.4 kB
TypeScript
/**
* @fileoverview Model configuration registry for centralizing model-specific parameters and behaviors.
*
* This module provides a centralized location for all model-specific configurations,
* including API parameter mappings, constraints, and pricing information.
*/
import { Provider } from './modelMaps';
/**
* Model-specific API parameter configuration
*/
export interface ModelApiConfig {
/** The parameter name for max tokens (e.g., 'max_tokens' or 'max_completion_tokens') */
maxTokensParam?: 'max_tokens' | 'max_completion_tokens' | 'maxOutputTokens';
/** Whether the model supports temperature parameter */
supportsTemperature?: boolean;
/** Default temperature value if supported */
defaultTemperature?: number;
/** Whether the model supports top_p parameter */
supportsTopP?: boolean;
/** Whether the model supports frequency_penalty parameter */
supportsFrequencyPenalty?: boolean;
/** Whether the model supports presence_penalty parameter */
supportsPresencePenalty?: boolean;
/** Custom parameter mappings */
customParams?: Record<string, any>;
}
/**
* Model pricing configuration
*/
export interface ModelPricingConfig {
/** Price per 1K input tokens in USD */
inputPricePer1K: number;
/** Price per 1K output tokens in USD */
outputPricePer1K: number;
/** Tiered pricing if applicable */
tiers?: Array<{
threshold: number;
inputPricePer1K: number;
outputPricePer1K: number;
}>;
}
/**
* Complete model configuration
*/
export interface ModelConfig {
/** Model identifier */
modelId: string;
/** Provider */
provider: Provider;
/** API-specific configuration */
apiConfig: ModelApiConfig;
/** Pricing configuration */
pricing?: ModelPricingConfig;
/** Additional constraints or requirements */
constraints?: {
/** Maximum tokens per request */
maxTokensPerRequest?: number;
/** Maximum requests per minute */
maxRequestsPerMinute?: number;
/** Whether the model requires specific headers */
requiredHeaders?: Record<string, string>;
};
}
/**
* Model configuration registry
*/
export declare const MODEL_CONFIGS: Record<string, ModelConfig>;
/**
* Get model configuration by full model name
* @param fullModelName The full model name (e.g., 'openai:gpt-4o')
* @returns The model configuration or undefined if not found
*/
export declare function getModelConfig(fullModelName: string): ModelConfig | undefined;
/**
* Get API configuration for a model
* @param fullModelName The full model name
* @returns The API configuration or default configuration
*/
export declare function getModelApiConfig(fullModelName: string): ModelApiConfig;
/**
* Get pricing configuration for a model
* @param fullModelName The full model name
* @returns The pricing configuration or undefined
*/
export declare function getModelPricing(fullModelName: string): ModelPricingConfig | undefined;
/**
* Build API request parameters based on model configuration
* @param fullModelName The full model name
* @param baseParams Base parameters to augment
* @param maxTokens Maximum tokens to generate
* @returns The augmented parameters
*/
export declare function buildModelRequestParams(fullModelName: string, baseParams: Record<string, any>, maxTokens?: number): Record<string, any>;