"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.getPrompt = void 0;
const langfuse_1 = require("langfuse");
const langfuseParams = {
    publicKey: process.env.LANGFUSE_PUBLIC_KEY,
    secretKey: process.env.LANGFUSE_SECRET_KEY,
    baseUrl: process.env.LANGFUSE_HOST,
};
const langfuse = new langfuse_1.Langfuse(langfuseParams);
async function getPrompt(id, vars, type, version) {
    let prompt;
    if (type === 'text' || type === undefined) {
        prompt = await langfuse.getPrompt(id, version, { type: 'text' });
    }
    else {
        prompt = await langfuse.getPrompt(id, version, { type: 'chat' });
    }
    const compiledPrompt = prompt.compile(vars);
    if (typeof compiledPrompt !== 'string') {
        return JSON.stringify(compiledPrompt);
    }
    return compiledPrompt;
}
exports.getPrompt = getPrompt;
//# sourceMappingURL=langfuse.js.map