@juspay/neurolink
Version:
Universal AI Development Platform with working MCP integration, multi-provider support, and professional CLI. Built-in tools operational, 58+ external MCP servers discoverable. Connect to filesystem, GitHub, database operations, and more. Build, test, and
122 lines (121 loc) • 4.12 kB
TypeScript
/**
* Provider Configuration Utility
* Consolidated configuration helpers for all AI providers
* Eliminates duplicate error messages and configuration logic
* Enhanced with format validation and advanced error classification
*/
/**
* Configuration options for provider validation
*/
export interface ProviderConfigOptions {
providerName: string;
envVarName: string;
setupUrl: string;
description: string;
instructions: string[];
fallbackEnvVars?: string[];
}
/**
* Enhanced validation result with format checking
*/
export interface ValidationResult {
isValid: boolean;
apiKey: string;
formatValid?: boolean;
errorType?: "missing" | "format" | "config";
error?: string;
}
/**
* Validates API key format for a specific provider
* @param providerKey Provider identifier (e.g., 'openai', 'anthropic')
* @param apiKey The API key to validate
* @returns True if format is valid
*/
export declare function validateApiKeyFormat(providerKey: string, apiKey: string): boolean;
/**
* Enhanced validation with format checking
* @param config Provider configuration options
* @param enableFormatValidation Whether to validate API key format
* @returns Validation result with detailed information
*/
export declare function validateApiKeyEnhanced(config: ProviderConfigOptions, enableFormatValidation?: boolean): ValidationResult;
/**
* Validates an API key for a provider and returns it (BACKWARD COMPATIBLE)
* Throws detailed error message if validation fails
* @param config Provider configuration options
* @returns The validated API key
*/
export declare function validateApiKey(config: ProviderConfigOptions): string;
/**
* Gets a provider model with fallback to default
* @param envVar Environment variable name for the model
* @param defaultModel Default model to use if env var not set
* @returns The model name to use
*/
export declare function getProviderModel(envVar: string, defaultModel: string): string;
/**
* Checks if provider credentials are available
* @param envVars Array of environment variable names to check
* @returns True if one of the credentials is available
*/
export declare function hasProviderCredentials(envVars: string[]): boolean;
/**
* Creates Anthropic provider configuration
*/
export declare function createAnthropicConfig(): ProviderConfigOptions;
/**
* Creates OpenAI provider configuration
*/
export declare function createOpenAIConfig(): ProviderConfigOptions;
/**
* Creates HuggingFace provider configuration
*/
export declare function createHuggingFaceConfig(): ProviderConfigOptions;
/**
* Creates Mistral provider configuration
*/
export declare function createMistralConfig(): ProviderConfigOptions;
/**
* Creates AWS Access Key configuration for Bedrock
*/
export declare function createAWSAccessKeyConfig(): ProviderConfigOptions;
/**
* Creates AWS Secret Key configuration for Bedrock
*/
export declare function createAWSSecretConfig(): ProviderConfigOptions;
/**
* Creates Azure OpenAI API Key configuration
*/
export declare function createAzureAPIKeyConfig(): ProviderConfigOptions;
/**
* Creates Azure OpenAI Endpoint configuration
*/
export declare function createAzureEndpointConfig(): ProviderConfigOptions;
/**
* Creates OpenAI Compatible provider configuration
*/
export declare function createOpenAICompatibleConfig(): ProviderConfigOptions;
/**
* Creates Google Vertex Project ID configuration
*/
export declare function createVertexProjectConfig(): ProviderConfigOptions;
/**
* Creates Google Cloud Authentication configuration
*/
export declare function createGoogleAuthConfig(): ProviderConfigOptions;
/**
* Creates Anthropic Base Provider configuration
*/
export declare function createAnthropicBaseConfig(): ProviderConfigOptions;
/**
* Gets AWS Region with default fallback
*/
export declare function getAWSRegion(): string;
/**
* Gets AWS Session Token if available
*/
export declare function getAWSSessionToken(): string | undefined;
/**
* Checks if HuggingFace credentials are available
*/
export declare function hasHuggingFaceCredentials(): boolean;