import { agent } from '@llamaindex/workflow';
import { OpenAI } from '@llamaindex/openai';
import { createMemory } from 'llamaindex';
const llm = new OpenAI({
model: process.env.OPENAI_MODEL || 'gpt-4o-mini',
apiKey: process.env.OPENAI_API_KEY,
baseURL: process.env.OPENAI_BASE_URL
});
const translatorAgent = agent({
llm,
name: 'TranslatorAgent',
description: 'Translate fetched content to target language while preserving structure',
systemPrompt: `You are TranslatorAgent. Translate the provided content.
Preserve headings, lists, tables, code blocks, quotes, and links.
If already in target language, return unchanged. Output markdown only.`
});
const summarizerAgent = agent({
llm,
name: 'SummarizerAgent',
description: 'Extract entities and facts; produce structured content and mind-map',
systemPrompt: 'You are SummarizerAgent. From the translated article, extract key entities and facts with citations, build a topical outline.',
memory: createMemory({ tokenLimit: 100 * 1024 })
});