import { Agent } from '@mastra/core/agent'; import { createOpenAICompatible } from '@ai-sdk/openai-compatible'; import { P, MODEL, BASE } from './prompts.mjs'; const { SYSTEM, TASK } = P; const xai = createOpenAICompatible({ name: 'xai', baseURL: BASE, apiKey: 'via-proxy' }); const ag = new Agent({ id: 'clerk', name: 'clerk', instructions: SYSTEM, model: xai(MODEL) }); const s = Date.now(); const r = await ag.generate(TASK, { modelSettings: { temperature: 0 } }); console.log('\n=====FINAL=====\n', r.text); console.log(`\nELAPSED ${((Date.now()-s)/1000).toFixed(1)}s`);