UNPKG

@juspay/neurolink

Version:

Universal AI Development Platform with working MCP integration, multi-provider support, voice (TTS/STT/realtime), and professional CLI. 58+ external MCP servers discoverable, multimodal file processing, RAG pipelines. Build, test, and deploy AI applicatio

213 lines (212 loc) 6.79 kB
/** * Provider Health Checking System * Prevents 500 errors by validating provider availability and configuration */ import { AIProviderName } from "../constants/enums.js"; import type { ProviderHealthCheckOptions, ProviderHealthStatusOptions } from "../types/index.js"; export declare class ProviderHealthChecker { private static healthCache; private static readonly DEFAULT_TIMEOUT; private static readonly DEFAULT_CACHE_AGE; private static readonly CONSECUTIVE_FAILURE_THRESHOLD; private static consecutiveFailures; /** * Validate and return a safe failure threshold value */ private static getValidatedFailureThreshold; /** * Comprehensive health check for a provider */ static checkProviderHealth(providerName: AIProviderName, options?: ProviderHealthCheckOptions): Promise<ProviderHealthStatusOptions>; /** * Check environment configuration for a provider */ private static checkEnvironmentConfiguration; /** * Check API key validity (format validation) */ private static checkApiKeyValidity; /** * Check connectivity to provider endpoints */ private static checkConnectivity; private static getConnectivityHeaders; /** * Check model availability (if possible without making API calls) */ private static checkModelAvailability; /** * Get required environment variables for a provider */ private static getRequiredEnvironmentVariables; /** * Get API key environment variable for a provider */ private static getApiKeyEnvironmentVariable; /** * Validate API key format for a provider */ private static validateApiKeyFormat; /** * Get health check endpoint for connectivity testing */ private static getProviderHealthEndpoint; /** * Provider-specific configuration checks */ private static checkProviderSpecificConfig; /** * Check Vertex AI configuration */ private static checkVertexAIConfig; /** * Get Vertex AI project ID from environment variables */ private static getVertexProjectId; /** * Check Vertex AI authentication */ private static checkVertexAuthentication; /** * Check Google Application Credentials file */ private static checkGoogleApplicationCredentials; /** * Check individual Google credentials */ private static checkIndividualGoogleCredentials; /** * Check AWS Bedrock configuration */ private static checkBedrockConfig; /** * Check AWS region configuration */ private static checkAWSRegion; /** * Check AWS credentials */ private static checkAWSCredentials; /** * Check Bedrock models */ private static checkBedrockModels; /** * Check Bedrock endpoint */ private static checkBedrockEndpoint; /** * Check Azure OpenAI configuration */ private static checkAzureConfig; private static getLiteLLMBaseUrl; private static getLiteLLMModelsUrl; private static getConfiguredLiteLLMModel; private static getOllamaBaseUrl; private static getOllamaTagsUrl; private static getConfiguredOllamaModel; private static fetchJsonWithTimeout; private static normalizeModelList; private static hasRequestedModel; private static getOllamaAvailableModels; private static getLiteLLMAvailableModels; private static checkOllamaAvailability; private static checkLiteLLMAvailability; private static checkLiteLLMConfig; /** * Check Ollama configuration */ private static checkOllamaConfig; /** * Get common models for a provider */ private static getCommonModelsForProvider; /** * Get cached health status if still valid */ private static getCachedHealth; /** * Check if Vertex AI supports Anthropic models (dual provider architecture) */ static checkVertexAnthropicSupport(): Promise<{ isSupported: boolean; hasCreateVertexAnthropic: boolean; hasCorrectTypes: boolean; hasValidProject: boolean; hasRegionalSupport: boolean; hasNetworkAccess: boolean; hasAnthropicModels: boolean; authentication: { isValid: boolean; method: string; issues: string[]; }; projectConfiguration: { isValid: boolean; projectId: string | undefined; region: string | undefined; issues: string[]; }; modelSupport: { availableModels: string[]; recommendedModels: string[]; deprecatedModels: string[]; }; recommendations: string[]; troubleshooting: string[]; }>; /** * Validate Vertex AI authentication configuration */ private static validateVertexAuthentication; /** * Validate Vertex AI project configuration */ private static validateVertexProjectConfiguration; /** * Check if the specified region supports Anthropic models */ private static checkVertexRegionalSupport; /** * Check network connectivity to Vertex AI endpoints */ private static checkVertexNetworkConnectivity; /** * Check if Anthropic model integration is enabled in the project */ private static checkAnthropicModelIntegration; /** * Initialize health checks in the background (NON-BLOCKING) * Starts background health monitoring without blocking initialization */ static initializeBackgroundHealthChecks(): void; /** * Clear health cache for a provider or all providers */ static clearHealthCache(providerName?: AIProviderName): void; static checkFallbackProviderAvailability(providerName: string, model: string): Promise<{ available: boolean; reason?: string; }>; /** * Get the best healthy provider from a list of options (NON-BLOCKING) * Prioritizes healthy providers over configured but unhealthy ones * Uses fast, cached health checks to avoid blocking initialization */ static getBestHealthyProvider(preferredProviders?: string[]): Promise<string | null>; /** * Get health status for all registered providers */ static checkAllProvidersHealth(options?: ProviderHealthCheckOptions): Promise<ProviderHealthStatusOptions[]>; /** * Get a summary of provider health */ static getHealthSummary(healthStatuses: ProviderHealthStatusOptions[]): { total: number; healthy: number; configured: number; hasIssues: number; healthyProviders: string[]; unhealthyProviders: string[]; }; }