const { output } = await generateText({ model: "google/gemini-3.8-flash", instructions: "Write 3 replies: curt, friendly, detailed", prompt: comment, output: Output.object({ schema: repliesSchema }), }); // always three replies as data: no text to parse
const questions = { quality: score("How helpful and polite is this reply?", levels), }; // 3 calls at once: the time is the slowest one, not the sum const results = await Promise.all(replies.map((reply) => jev.systemOne({ state: `${comment}\n${reply}`, questions })));
const scores = results.map((r) => r.answers.quality.score / 3); // [0.50, 0.74, 1.00] → best: "detailed"