"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.ModelRouter = void 0;
class ModelRouter {
    constructor() {
        this.routes = new Map();
        this.initializeRoutes();
    }
    initializeRoutes() {
        // Simple keyword-based routing (would be enhanced with ML/LLM in reality)
        this.routes.set("flash", {
            tier: "flash",
            modelName: "gemini-pro",
            description: "Fast responses for simple queries"
        });
        this.routes.set("pro", {
            tier: "pro",
            modelName: "gemini-pro",
            description: "Balanced performance for medium complexity"
        });
        this.routes.set("ultra", {
            tier: "ultra",
            modelName: "gemini-2.5-pro",
            description: "Highest quality for complex reasoning"
        });
    }
    /**
     * Determine model tier based on prompt complexity
     * This is a simplified implementation - in reality, this would use
     * sophisticated analysis (length, keywords, reasoning requirements, etc.)
     */
    getModelTier(prompt) {
        const lowerPrompt = prompt.toLowerCase();
        const wordCount = lowerPrompt.split(/\s+/).length;
        // Simple heuristics
        if (wordCount < 20) {
            return "flash";
        }
        else if (wordCount < 100) {
            // Check for complex keywords
            const complexKeywords = ["analyze", "compare", "explain", "design", "architecture",
                "optimize", "refactor", "debug", "investigate", "research"];
            if (complexKeywords.some(keyword => lowerPrompt.includes(keyword))) {
                return "ultra";
            }
            return "pro";
        }
        else {
            return "ultra";
        }
    }
    /**
     * Get model name for a given tier
     */
    getModelName(tier) {
        const route = this.routes.get(tier);
        return route?.modelName || "gemini-pro";
    }
    /**
     * Get route information for a tier
     */
    getRoute(tier) {
        return this.routes.get(tier);
    }
    /**
     * Estimate token usage for a prompt (very simplified)
     */
    estimateTokenUsage(prompt) {
        // Rough estimate: 4 characters per token
        return Math.ceil(prompt.length / 4);
    }
    /**
     * Determine if a task should use agentic reasoning based on complexity
     */
    shouldUseAgenticReasoning(prompt) {
        const lowerPrompt = prompt.toLowerCase();
        // Use agentic reasoning for tasks that likely require multiple steps
        const agenticTriggers = ["create", "build", "implement", "design", "plan",
            "analyze", "compare", "optimize", "refactor",
            "write a script", "develop", "architect"];
        return agenticTriggers.some(trigger => lowerPrompt.includes(trigger));
    }
}
exports.ModelRouter = ModelRouter;
//# sourceMappingURL=model-router.js.map