"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.createChain = createChain;
const runnables_1 = require("@langchain/core/runnables");
function createChain(model, knowledgeBase, promptTemplate, chatHistory) {
    return runnables_1.RunnableSequence.from([
        {
            input: (input) => input.text,
            context: async (input) => knowledgeBase?.queryKnowledgeBase(input.text),
            history: async () => chatHistory.getMessages()
        },
        promptTemplate,
        model
    ]);
}
