"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.handleSttNumberCorrectness = void 0;
const handleSttNumberCorrectness = async ({ assertion, renderedValue, prompt, output, test, evaluateResult, }) => {
    if (evaluateResult) {
        const falseIntentDetected = output;
        const pass = falseIntentDetected.result.toLowerCase() === 'correct';
        const reason = JSON.stringify(falseIntentDetected);
        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 any of the customer's sentences which contains number has been wrongly identified by the AI Bot. Some examples of wrong identification are: a) If the AI Bot agent did not understand a number and asked to repeat. b) if the AI agent understood number as something else. Output a json value with three fields: a) a field called "result" with value "incorrect" if number was not identified properly and "correct" otherwise, b) a field called "phrases" with value as an array of all numbers that have not been identified correctly, c) a field called "reason" with value as the reason why you came to this conclusion. Provide the result in a metric called 'number-correctness'.`,
                metric: '"number-correctness": {"result": "incorrect", "phrases": ["2345"], "reason": "The number 2345 mentioned by the customer was not heard by the agent."},',
            },
        };
    }
};
exports.handleSttNumberCorrectness = handleSttNumberCorrectness;
//# sourceMappingURL=sttNumberCorrectness.js.map