import { ModelRegistry } from "../../models/ModelRegistry.js";
export class OllamaCapabilities {
    static findModel(modelId) {
        // Ollama specific: try exact match first, then strip tags
        let model = ModelRegistry.find(modelId, "ollama");
        if (!model && modelId?.includes(":")) {
            const baseId = modelId.split(":")[0];
            if (baseId) {
                model = ModelRegistry.find(baseId, "ollama");
            }
        }
        return model;
    }
    static getContextWindow(modelId) {
        const model = this.findModel(modelId);
        return model?.context_window || 8192;
    }
    static supportsVision(modelId) {
        const model = this.findModel(modelId);
        if (model) {
            return (model.modalities?.input?.includes("image") ||
                model.capabilities?.includes("vision") ||
                false);
        }
        // Fallback for custom models not in registry
        return /vision|llava|moondream|bakllava/.test(modelId.toLowerCase());
    }
    static supportsTools(modelId) {
        const model = this.findModel(modelId);
        if (model?.capabilities?.includes("tools"))
            return true;
        // Fallback heuristics for models not in registry
        return /gpt-|claude|gemini|deepseek|llama/.test(modelId.toLowerCase());
    }
    static supportsStructuredOutput(modelId) {
        const model = this.findModel(modelId);
        return model?.capabilities?.includes("structured_output") || false;
    }
    static supportsEmbeddings(modelId) {
        const model = this.findModel(modelId);
        return (model?.modalities?.output?.includes("embeddings") ||
            model?.capabilities?.includes("embeddings") ||
            false);
    }
    static supportsReasoning(modelId) {
        const model = this.findModel(modelId);
        return model?.capabilities?.includes("reasoning") || false;
    }
    static supportsImageGeneration(modelId) {
        const model = this.findModel(modelId);
        return model?.modalities?.output?.includes("image") || false;
    }
    static supportsTranscription(modelId) {
        const model = this.findModel(modelId);
        return model?.modalities?.input?.includes("audio") || false;
    }
    static supportsModeration(modelId) {
        const model = this.findModel(modelId);
        return model?.modalities?.output?.includes("moderation") || false;
    }
}
