"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.LanguageModelFactory = void 0;
/**
 * Copyright (C) 2025 by Fonoster Inc (https://fonoster.com)
 * http://github.com/fonoster/fonoster
 *
 * This file is part of Fonoster
 *
 * Licensed under the MIT License (the "License");
 * you may not use this file except in compliance with
 * the License. You may obtain a copy of the License at
 *
 *    https://opensource.org/licenses/MIT
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
const logger_1 = require("@fonoster/logger");
const types_1 = require("../types");
const groq_1 = require("./groq");
const ollama_1 = require("./ollama");
const openai_1 = require("./openai");
const logger = (0, logger_1.getLogger)({ service: "autopilot", filePath: __filename });
class LanguageModelFactory {
    static registerLanguageModel(name, ctor) {
        logger.verbose("registering llm provider", { name });
        this.languageModels.set(name, ctor);
    }
    static getLanguageModel(languageModel, config, voice, telephonyContext) {
        const LanguageModelConstructor = this.languageModels.get(`llm.${languageModel}`);
        if (!LanguageModelConstructor) {
            throw new Error(`Language model ${languageModel} not found`);
        }
        return new LanguageModelConstructor(config, voice, telephonyContext);
    }
}
exports.LanguageModelFactory = LanguageModelFactory;
LanguageModelFactory.languageModels = new Map();
// Register language models
LanguageModelFactory.registerLanguageModel(openai_1.LANGUAGE_MODEL_NAME, openai_1.OpenAI);
LanguageModelFactory.registerLanguageModel(groq_1.LANGUAGE_MODEL_NAME, groq_1.Groq);
LanguageModelFactory.registerLanguageModel(ollama_1.LANGUAGE_MODEL_NAME, ollama_1.Ollama);
