()
| 98 | |
| 99 | let _app: ReturnType<typeof betterAgent> | null = null; |
| 100 | function getApp() { |
| 101 | if (_app) return _app; |
| 102 | const agent = defineAgent({ |
| 103 | name: 'insight-explain', |
| 104 | description: 'Explains why an insight changed (one-shot).', |
| 105 | model: explainModel(), |
| 106 | contextSchema: z.object({}), |
| 107 | outputSchema: { |
| 108 | schema: explanationJsonSchema, |
| 109 | name: 'insight_explanation', |
| 110 | strict: true, |
| 111 | }, |
| 112 | instruction: () => INSTRUCTION, |
| 113 | tools: () => [], |
| 114 | maxSteps: 1, |
| 115 | // biome-ignore lint/suspicious/noExplicitAny: same dodge as enrich.ts |
| 116 | } as any); |
| 117 | _app = betterAgent({ agents: [agent] }); |
| 118 | return _app; |
| 119 | } |
| 120 | |
| 121 | export async function generateInsightExplanation( |
| 122 | input: ExplainInsightInput, |
no test coverage detected