"use strict";
var __importDefault = (this && this.__importDefault) || function (mod) {
    return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.handleGreeting = void 0;
const invariant_1 = __importDefault(require("../../util/invariant"));
const handleGreeting = async ({ assertion, renderedValue, prompt, output, test, evaluateResult, }) => {
    (0, invariant_1.default)(typeof renderedValue === 'string', 'The branding string should be specified');
    if (evaluateResult) {
        const result = output;
        const pass = result.result;
        return {
            pass,
            score: pass ? 1 : 0,
            reason: pass ? result.result.toString() : result.reason || '',
            assertion,
        };
    }
    else {
        return {
            pass: true,
            score: 1,
            reason: '',
            metadata: {
                prompt: `Analyze the reference transcription and audio provided to identify if the AI Bot agent greeted the customer with a phrase similar to the following: "${renderedValue}". The greeting should have the same meaning as "${renderedValue}" and should be a complete sentence unless the customer interrupts in between. Output a json value with two fields: a) a field called "result" with value true if the agent greeted the customer 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 'greeting'.`,
                metric: '"greeting": {"result": false, "reason": "The bot started directly with asking the name of the customer."},',
            },
        };
    }
};
exports.handleGreeting = handleGreeting;
//# sourceMappingURL=greeting.js.map