UNPKG

@promethean-os/prompt-optimization

Version:

Prompt Optimization v2.0 - qwen3:4b-instruct 100k context optimization system

123 lines 3.25 kB
/** * Deployment Manager for Prompt Optimization v2.0 * Handles phased rollout with shadow mode, gradual traffic increase, and monitoring */ export interface DeploymentConfig { phase: 'shadow' | 'gradual' | 'full'; trafficPercentage: number; enableABTesting: boolean; monitoringLevel: 'basic' | 'detailed' | 'comprehensive'; fallbackToLegacy: boolean; } export interface DeploymentMetrics { phase: string; trafficPercentage: number; totalRequests: number; v2Requests: number; legacyRequests: number; v2SuccessRate: number; legacySuccessRate: number; performanceImprovement: number; errorRate: number; timestamp: Date; } export interface DeploymentStatus { currentPhase: DeploymentConfig['phase']; isHealthy: boolean; uptime: number; lastHealthCheck: Date; issues: string[]; recommendations: string[]; } declare class DeploymentManager { private config; private startTime; private metrics; private healthCheckInterval; constructor(initialConfig?: Partial<DeploymentConfig>); /** * Initialize deployment with health checks and monitoring */ initialize(): Promise<void>; /** * Process request with intelligent routing based on deployment phase */ processRequest(userPrompt: string): Promise<{ output: string; usedV2: boolean; template: string; processingTime: number; success: boolean; metrics: any; }>; /** * Determine if request should route to v2.0 based on traffic percentage */ private shouldRouteToV2; /** * Apply template with comprehensive fallback handling */ private applyTemplateWithFallback; /** * Get fallback chain for a template */ private getFallbackChain; /** * Apply template to input (simplified implementation) */ private applyTemplate; /** * Validate output quality */ private validateOutput; /** * Process with legacy system (for comparison) */ private processWithLegacySystem; /** * Estimate token usage (rough approximation) */ private estimateTokens; /** * Record deployment metrics */ private recordMetrics; /** * Start automated health checks */ private startHealthChecks; /** * Perform comprehensive health check */ performHealthCheck(): Promise<DeploymentStatus>; /** * Transition to next deployment phase */ transitionToPhase(phase: DeploymentConfig['phase'], trafficPercentage?: number): Promise<void>; /** * Get current deployment status */ getStatus(): Promise<DeploymentStatus & { config: DeploymentConfig; metrics: DeploymentMetrics[]; }>; /** * Generate deployment report */ generateReport(): { summary: any; performance: any; recommendations: string[]; }; /** * Generate deployment recommendations */ private generateRecommendations; /** * Cleanup resources */ cleanup(): Promise<void>; } export declare const deploymentManager: DeploymentManager; export {}; //# sourceMappingURL=deployment-manager.d.ts.map