"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.handleFalseIntentIdentification = void 0;
const handleFalseIntentIdentification = async ({ assertion, renderedValue, prompt, output, test, evaluateResult, }) => {
    if (evaluateResult) {
        const falseIntentDetected = output;
        const pass = falseIntentDetected.result;
        const reason = falseIntentDetected.reason || '';
        return {
            pass,
            score: pass ? 1 : 0,
            reason,
            assertion,
        };
    }
    else {
        return {
            pass: true,
            score: 1,
            reason: '',
            metadata: {
                prompt: `Analyze the transcript that you have generated in the "transcript" field and audio to determine if the customer's intent was identified correctly or not by the AI Bot Agent. Some examples: 1) if the customer asked for more information, but the AI bot did not provide additional information or answer the customer's question precisely. 2) If the AI Bot agent did not coherently respond to the customer conversation, consider it as wrongly identified. 3) If the customer declined the offer provided, but the AI Bot went ahead as if the customer has accepted, consider it as wrongly identified. 4) If the customer asked for more information, but the AI bot treated that as an approval for the offer from customer, consider it as wrongly identified. 5) If the bot did not interpret the meaning of the customer reponse properly, consider it as wrongly identified. 6) The customer is talking to someone else, but the AI Bot did not realize and kept talking as if the customer is takking to it. 7)If the customer did not respond to the offer provided, but the AI Bot went ahead as if the customer has accepted, consider it as wrongly identified. Output a json value with two fields: a) a field called "result" with value true if customer's intent was identified properly and false otherwise, b) a field called "reason" with value as the reason why you came to this conclusion. Provide the result in a metric called 'intent-identification'.`,
                metric: '"intent-identification": {"result": false, "reason": "The customer declined the offer, but the AI agent provided details of the offer."},',
            },
        };
    }
};
exports.handleFalseIntentIdentification = handleFalseIntentIdentification;
//# sourceMappingURL=falseIntentIdentification.js.map