"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.handleCallDisconnection = void 0;
const handleCallDisconnection = async ({ assertion, renderedValue, prompt, output, test, evaluateResult, }) => {
    if (!renderedValue) {
        renderedValue = 'No';
    }
    if (evaluateResult) {
        const result = typeof output === 'string' ? output.toLowerCase() : '';
        const pass = renderedValue.toString().toLowerCase() === result;
        return {
            pass,
            score: pass ? 1 : 0,
            reason: result,
            assertion,
        };
    }
    else {
        return {
            pass: true,
            score: 1,
            reason: '',
            metadata: {
                prompt: `Analyze the reference transcription and audio provided to identify whether call ended in the middle of the conversation without waiting for the AI Bot agent to complete the response. Treat the call as disconnected if the audio file ends before the agent addressed the last question asked by the customer. Output a value as either "Yes" if the call ended before the agent addressed all questions, otherwise "No". Provide the result in a metric called 'call-disconnected'.`,
                metric: '"call-disconnected": "Yes",',
            },
        };
    }
};
exports.handleCallDisconnection = handleCallDisconnection;
//# sourceMappingURL=callDisconnection.js.map