"use strict";
var __importDefault = (this && this.__importDefault) || function (mod) {
    return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.handleImageEditing = void 0;
const path_1 = __importDefault(require("path"));
const matchers_1 = require("../../matchers");
const defaults_1 = require("../../providers/defaults");
const pythonUtils_1 = require("../../python/pythonUtils");
const utils_1 = require("./utils");
const handleImageEditing = async ({ assertion, outputString, test, context, }) => {
    const modelProvider = await (0, matchers_1.getAndCheckProvider)('text', test.options?.provider, (await (0, defaults_1.getDefaultProviders)()).gradingProvider, assertion.type);
    const output = (0, utils_1.getImageContent)(outputString);
    const input = (0, utils_1.getInputContent)(outputString);
    context.prompt = input;
    if (!output || !input) {
        return {
            assertion,
            pass: false,
            score: 0,
            reason: 'Missing trusys.output or output not valid JSON. or Missing trusys.input or input not valid JSON.',
        };
    }
    const pythonScriptPath = path_1.default.join(__dirname, '..', 'python', 'multimodal', `${assertion.type}.py`);
    const pythonScriptOutput = await (0, pythonUtils_1.runPython)(pythonScriptPath, 'get_assert', [
        output,
        context,
    ]);
    return {
        assertion,
        ...pythonScriptOutput
    };
};
exports.handleImageEditing = handleImageEditing;
//# sourceMappingURL=imageEditing.js.map