"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.handleSttMissing = void 0;
const handleSttMissing = async ({ assertion, renderedValue, prompt, output, test, evaluateResult, }) => {
    if (evaluateResult) {
        const falseIntentDetected = output;
        const pass = falseIntentDetected.result.toLowerCase() === 'no';
        const reason = JSON.stringify(falseIntentDetected);
        return {
            pass,
            score: pass ? 1 : 0,
            reason,
            assertion,
        };
    }
    else {
        return {
            pass: true,
            score: 1,
            reason: '',
            metadata: {
                prompt: `Strictly compare the transcript that you have generated in the "transcript" field with the original_transcription provided and determine if any words or sentences spoken by the customer is missing in the original_transcription, but present in the transcription that you have generated in the "transcript" field. Consider messages as equivalent if the wording and meaning are the same and even if they are distributed across multiple turns. Ignore minor differences in punctuation or sentence splitting/merging. Do not report sentences that are present in both transcripts. We are only looking for the missing ones in the original_transcription. Do a STRICT comparison and do not be creative. Output a json value with two fields: a) a field called "result" with value "yes" if any words or sentences spoken by the customer is missing in the original_transcription and "no" otherwise, b) a field called "phrases" with value as an array of all words or sentences spoken by the customer that have been identified as missing in the original_transcription along with reason in brackets. Provide the result in a metric called 'stt-missing'. Output this metric even if you have emitted similar results in another metric.`,
                metric: '"stt-missing": {"result": "yes", "phrases": ["Nah (reason)"]},',
            },
        };
    }
};
exports.handleSttMissing = handleSttMissing;
//# sourceMappingURL=sttMissing.js.map