"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.handleIncompleteAgentResponse = void 0;
const handleIncompleteAgentResponse = async ({ assertion, renderedValue, prompt, output, test, evaluateResult, }) => {
    if (!renderedValue) {
        renderedValue = 'No';
    }
    if (evaluateResult) {
        const agentResponse = output;
        const result = typeof agentResponse.result === 'string' ? agentResponse.result.toLowerCase() : '';
        const pass = renderedValue.toString().toLowerCase() === result;
        return {
            pass,
            score: pass ? 1 : 0,
            reason: JSON.stringify(agentResponse),
            assertion,
        };
    }
    else {
        return {
            pass: true,
            score: 1,
            reason: '',
            metadata: {
                prompt: `Analyze the transcript that you have generated in the "transcript" field and audio to identify if the AI Bot agent provided incomplete response to the customer. Examples of incomplete agent response are: a) When the agent was responding, the call ended before agent could complete the sentence. b) When the agent was responding, the customer interrupted in between and the agent could not complete the response even in subsequent turns. Output a json value with two fields: a) a field called "result" with value as either "Yes" if the agent failed to complete the response, otherwise "No", b) a field called "reason" with value as the reason why you came to this conclusion. Provide the result in a metric called 'incomplete-agent-response'.`,
                metric: '"incomplete-agent-response": {"result": "Yes", "reason": "The agent could not complete offering loan details as the customer interrupted."},',
            },
        };
    }
};
exports.handleIncompleteAgentResponse = handleIncompleteAgentResponse;
//# sourceMappingURL=incompleteAgentResponse.js.map