"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.OpenAI = exports.LANGUAGE_MODEL_NAME = void 0;
const openai_1 = require("@langchain/openai");
const tools_1 = require("../../tools");
const AbstractLanguageModel_1 = require("../AbstractLanguageModel");
const LANGUAGE_MODEL_NAME = "llm.openai";
exports.LANGUAGE_MODEL_NAME = LANGUAGE_MODEL_NAME;
class OpenAI extends AbstractLanguageModel_1.AbstractLanguageModel {
    constructor(params, voice, telephonyContext) {
        const model = new openai_1.ChatOpenAI({
            ...params
        }).bind({
            tools: params.tools.map(tools_1.convertToolToOpenAITool)
        });
        super({
            ...params,
            model
        }, voice, telephonyContext);
    }
}
exports.OpenAI = OpenAI;
