"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.checkTagsWithLLM = void 0;
const prompt_1 = require("./prompt");
const parser_1 = require("./parser");
const checkTagsWithLLM = async (props) => {
    const { model, existingTags, instructions, metadata, callbacks } = props;
    try {
        const chain = model.pipe(parser_1.parser);
        const formattedPrompt = await prompt_1.systemPrompt.format({
            existingTags: JSON.stringify(existingTags),
            instructions
        });
        const result = (await chain.invoke(formattedPrompt, {
            metadata,
            runName: 'ElationCheckPatientTags',
            callbacks
        }));
        return {
            tagsFound: result.tagsFound,
            explanation: result.explanation
        };
    }
    catch (error) {
        throw new Error('Failed to check patient tags.');
    }
};
exports.checkTagsWithLLM = checkTagsWithLLM;
//# sourceMappingURL=checkTagsWithLLM.js.map