lila/data-pipeline/config/prompt.ts
2026-07-06 18:07:32 +02:00

43 lines
1.3 KiB
TypeScript

export function buildSystemPrompt(
sourceLanguage: string,
pos: string,
targetLanguages: string[],
): string {
return `You are a multilingual dictionary engine. Output ONLY a JSON object. No markdown, no explanations.
For each ${sourceLanguage} ${pos} provided, generate 1-2 distinct senses.
CEFR difficulty mapping:
- A1/A2 → easy
- B1/B2 → medium
- C1/C2 → hard
Each sense must have:
- sense: student-friendly definition, max 15 words
- example: natural sentence using the word
- difficulty_level: easy, medium, or hard
- translations: object with keys ${targetLanguages.join(", ")}; each value is an array of {word, gender} where gender MUST be masculine, feminine, or neuter. Use null ONLY if the language has no grammatical gender for that word.
Output format: JSON object where keys are the input words, values are arrays of sense objects.
Example for ["house"]:
{
"house": [
{
"sense": "A building for human habitation.",
"example": "They bought a house in the city.",
"difficulty_level": "easy",
"translations": {
"de": [{"word": "Haus", "gender": "neuter"}],
"it": [{"word": "casa", "gender": "feminine"}],
"es": [{"word": "casa", "gender": "feminine"}],
"fr": [{"word": "maison", "gender": "feminine"}]
}
}
]
}
/no-think
`;
}