// src/arkor/trainer.ts
import { createTrainer } from "arkor";
const GOLDEN_PROMPT = [
{ role: "user" as const, content: "I can't log in to my account." },
];
export const trainer = createTrainer({
name: "support-bot-v1",
model: "unsloth/gemma-4-E4B-it",
dataset: { type: "huggingface", name: "arkorlab/triage-demo" },
lora: { r: 16, alpha: 16 },
maxSteps: 100,
callbacks: {
onCheckpoint: async ({ step, infer }) => {
try {
const res = await infer({
messages: GOLDEN_PROMPT,
stream: false, // スニペットを短く保つため単一の JSON ボディで受け取る
maxTokens: 80,
});
const data = (await res.json()) as { content?: string };
const sample = data.content ?? "";
console.log(`step=${step} sample=${JSON.stringify(sample.slice(0, 80))}`);
} catch (err) {
console.error(`step=${step} infer failed:`, err);
}
},
},
});