"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.summarizeCareFlowWithLLM = void 0;
const prompt_1 = require("./prompt");
/**
 * Uses LLM to summarize care flow activities.
 * The function follows these steps:
 * 1. Formats prompt with stakeholder context and instructions
 * 2. Runs LLM to generate summary
 * 3. Returns formatted summary
 *
 * @example
 * const summary = await summarizeCareFlowWithLLM({
 *   model,
 *   careFlowActivities: "...",
 *   stakeholder: "Patient",
 *   additionalInstructions: "Focus on medications",
 *   metadata: { ... }
 * })
 */
const summarizeCareFlowWithLLM = async ({ model, careFlowActivities, stakeholder, additionalInstructions, metadata, callbacks, }) => {
    const prompt = await prompt_1.systemPrompt.format({
        stakeholder,
        additionalInstructions,
        input: careFlowActivities,
    });
    try {
        const response = await model.invoke(prompt, {
            metadata,
            runName: 'ShellySummarizeCareFlow',
            callbacks
        });
        return response.content;
    }
    catch (error) {
        throw new Error('Failed to summarize the care flow due to an internal error.');
    }
};
exports.summarizeCareFlowWithLLM = summarizeCareFlowWithLLM;
//# sourceMappingURL=summarizeCareFlowWithLLM.js.map